public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Trouble with sys fs
@ 2005-09-09  7:36 Kormos Matej
  2005-09-09  7:56 ` Daniel Drake
  0 siblings, 1 reply; 2+ messages in thread
From: Kormos Matej @ 2005-09-09  7:36 UTC (permalink / raw
  To: 'gentoo-dev@gentoo.org'

Hello!
I am beginner with Gentoo and absolute rookie about writing drivers, but I
am trying to write one.
I hope I have choose the right mailing list for my questions :-)
I have encountered following error:
I have a simple char driver. Everything is working like should be, I can
compile functional driver, which after inserting into system appears in the
sys file system.
But when I add this lines in order to create my own attribute in directory
of my module:

#include <linux/sysfs.h>
#include <linux/kobject.h>

sysfs_create_file(&device->cdev.kobj,&pid_sfs);

I can not insert module. Kernel says something like this:
Error inserting module -1: unknown symbol sysfs_create_file

And my second problem is, when I try to create my own kobject and add it to
sys fs, when I call insmod, segmentation fault occures on kobejct_add()

struct kobject mykobject;
static int __init mymodule_init(void)
{
  int err;
 
  kobject_init(&mykobject);
  mykobject.parent->cdev.kobj;
  mykobject.ktype=&kotype;  
  kobject_set_name(&mykobject,"mymodule");
  err=kobject_add(&mykobject);
  ....


Do you have any suggesions what may be wrong?
(is it necessary to do something special to interact with sysfs? I have do
exactly what was written in Linux Device Drivers from O'Reilly publishing)


-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] Trouble with sys fs
  2005-09-09  7:36 [gentoo-dev] Trouble with sys fs Kormos Matej
@ 2005-09-09  7:56 ` Daniel Drake
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Drake @ 2005-09-09  7:56 UTC (permalink / raw
  To: gentoo-dev

Kormos Matej wrote:
> Hello!
> I am beginner with Gentoo and absolute rookie about writing drivers, but I
> am trying to write one.
> I hope I have choose the right mailing list for my questions :-)

You should try the kernel-newbies mailing list, or the linux kernel mailing list.

> I have encountered following error:
> I have a simple char driver. Everything is working like should be, I can
> compile functional driver, which after inserting into system appears in the
> sys file system.
> But when I add this lines in order to create my own attribute in directory
> of my module:
> 
> #include <linux/sysfs.h>
> #include <linux/kobject.h>
> 
> sysfs_create_file(&device->cdev.kobj,&pid_sfs);
> 
> I can not insert module. Kernel says something like this:
> Error inserting module -1: unknown symbol sysfs_create_file

sysfs_create_file is only available to GPL modules. Is yours 
MODULE_LICENSE("GPL")?

Daniel

-- 
gentoo-dev@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-09-09  7:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-09  7:36 [gentoo-dev] Trouble with sys fs Kormos Matej
2005-09-09  7:56 ` Daniel Drake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox