device driver using devfs on system with not mounted devfs

device driver using devfs on system with not mounted devfs

Post by Mathias Waac » Tue, 11 Dec 2001 20:20:38

Hi all,

I've got a problem with a driver under a devfs-enabled kernel. The kernel
(2.4.16 SMP) is configured as:

Devfs is not mounted (and devfsd is not running). The driver is a char
device. I'm initializing the driver by calling:

handle = devfs_mk_dir(NULL,"mydriver",NULL);

I think I can use this handle to access all my devices even if devfs isn't
mounted and so this directory doesn't exits, right?

major = devfs_register_chrdev( 0, "mydriver", &mydriver_device_fops ))

I use this to get a dynamic major id for my driver.
After that I create some device nodes by calling


in loop modifying name and dev_cnt in each iteration.

To unload the driver I'm just calling


At a first view this seems to work. But if I cat /proc/devices after that,
I'm getting a segmentation fault and /var/log/messages says:

Dec  7 16:20:41 nala kernel: Unable to handle kernel paging request at
virtual address d11adc82
Dec  7 16:20:41 nala kernel:  printing eip:
Dec  7 16:20:41 nala kernel: c02445ea
Dec  7 16:20:41 nala kernel: *pde = 0ff12067
Dec  7 16:20:41 nala kernel: *pte = 00000000
Dec  7 16:20:41 nala kernel: Oops: 0000
Dec  7 16:20:41 nala kernel: CPU:    0
Dec  7 16:20:41 nala kernel: EIP:    0010:[rwsem_wake+898/9524]    Not
Dec  7 16:20:41 nala kernel: EFLAGS: 00010297
Dec  7 16:20:41 nala kernel: eax: d11adc82   ebx: cdacf08a   ecx: d11adc82  
 edx: fffffffe
Dec  7 16:20:41 nala kernel: esi: cd78bf38   edi: ffffffff   ebp: d11adc82  
 esp: cd78bedc
Dec  7 16:20:41 nala kernel: ds: 0018   es: 0018   ss: 0018
Dec  7 16:20:41 nala kernel: Process cat (pid: 1606, stackpage=cd78b000)

On a devfs mounted system the driver seems to be ok. On Systems without
devfs it works too. So what I'm doing wrong? From my understanding the
procedure I've used should be ok. Or is there a _need_ to mount devfs if
its enabled in the kernel?

I've enabled some debugging options in the kernel:


Maybe there's a correlation between this options and the error above? Or
does anybody know about general problem with this kernel version?



Tel.:  +49 621 181 2717  Fax.:  +49 621 181 2713


1. Using devfs to address device driver

Hi All
I am writing a device driver that should use the existing serial port +
custom hardware.
Problem is that I want to use loadable modules and need to talk with the
serial port driver via the devfs (is this the best way ?).
I can get a file handle , no problem,  but when I want to call the
tty_open() procedure it requires parameters (inode, file *).
How do I get hold of them ?

Thanks in advance

2. Installing Linux on a a AMD k6 200 system

3. devfs (3/7) - cleanup devfs use in ide

4. Which FCAL to buy for 3510 array?

5. devfs and temrinal creation problems (devfs & pts)

6. trouble installing redhat with ide drive

7. devfs (4/7) - cleanup devfs use in scsi

8. a.out says "Corrupt fixup table."

9. keep devfs partition nodes in sync with block device drivers

10. PROBLEM: bad device file for cdrom while using devfs and ide-scsi

11. devfs: BKL *not* taken while opening devices

12. PATCH: support for IDE devices in ide-scsi with devfs

13. devfs: device permissions