On Wed, Dec 07, 2005 at 13:15:07 +0200, John Que wrote: > Hello, > > I am calling register_chrdev_region(dev, MAX_DVB_MINORS, "mydevice") in > a module. > > The return of register_chrdev_region(dev, MAX_DEV_MINORS, "mydevice") is 0 > even when the device does not exist. (I mean there > is no /dev/mydevice special file). > > 0 means success. That's right. It is success. 1) /dev/mydevice should not exist -- you are registering a RANGE, so it should rather be /dev/mydevice0, /dev/mydevice1 etc. 2) The devices are NOT accessed by names. They are accessed by their numbers. The /dev/mydevice "device node" just contains the number. Userland may choose to call it /dev/foo instead and the module should not work. > I want that the init method of my module will print > an error message and will not load the module if > my device special file does not exist. > > How can I do it ? You can't and you shouldn't. You should make sure something creates them when you do the registration above. That's a job for the udev daemon. Registering a device should notify udevd, which will then take care of creating the device nodes. -- Jan 'Bulb' Hudec <bulb@xxxxxx>
Attachment:
signature.asc
Description: Digital signature