1 |
Hello! |
2 |
I am beginner with Gentoo and absolute rookie about writing drivers, but I |
3 |
am trying to write one. |
4 |
I hope I have choose the right mailing list for my questions :-) |
5 |
I have encountered following error: |
6 |
I have a simple char driver. Everything is working like should be, I can |
7 |
compile functional driver, which after inserting into system appears in the |
8 |
sys file system. |
9 |
But when I add this lines in order to create my own attribute in directory |
10 |
of my module: |
11 |
|
12 |
#include <linux/sysfs.h> |
13 |
#include <linux/kobject.h> |
14 |
|
15 |
sysfs_create_file(&device->cdev.kobj,&pid_sfs); |
16 |
|
17 |
I can not insert module. Kernel says something like this: |
18 |
Error inserting module -1: unknown symbol sysfs_create_file |
19 |
|
20 |
And my second problem is, when I try to create my own kobject and add it to |
21 |
sys fs, when I call insmod, segmentation fault occures on kobejct_add() |
22 |
|
23 |
struct kobject mykobject; |
24 |
static int __init mymodule_init(void) |
25 |
{ |
26 |
int err; |
27 |
|
28 |
kobject_init(&mykobject); |
29 |
mykobject.parent->cdev.kobj; |
30 |
mykobject.ktype=&kotype; |
31 |
kobject_set_name(&mykobject,"mymodule"); |
32 |
err=kobject_add(&mykobject); |
33 |
.... |
34 |
|
35 |
|
36 |
Do you have any suggesions what may be wrong? |
37 |
(is it necessary to do something special to interact with sysfs? I have do |
38 |
exactly what was written in Linux Device Drivers from O'Reilly publishing) |
39 |
|
40 |
|
41 |
-- |
42 |
gentoo-dev@g.o mailing list |