need to make my chrdev visible to udev: how to tug at sysfs from kspace?

From: Frantisek Rysanek
Date: Fri Nov 24 2006 - 11:37:39 EST


Dear Everyone,

this may be a RTFM question, I just can't seem to find the right docs
:-)

I have a simple custom device called the UNO-2050 - essentially a PCI
device based on a generic slave bridge by PLX (PLX9052).
I've written a driver that registers a character device, so that I
have something to open() when I need to send some ioctl()'s into
kernel space.

After some quick search in drivers/char/mem.c and other places,
I've come up with a sequence of register_chrdev(), class_create()
and class_device_create(), along the lines of

uno2050_major = register_chrdev(0,"uno-2050",&uno2050_fops);
uno2050_class = class_create(THIS_MODULE, "uno-2050");
class_device_create(
uno2050_class,
&board->fn[1].pdev->bus->class_dev,
MKDEV(uno2050_major,
board->fn[1].uno2050_minor),
&board->fn[1].pdev->dev,
"uno-2050-%d", board->fn[1].uno2050_minor
);

I get a nice sysfs class "uno-2050" and a sysfs class device called
"uno-2050-0".

Now comes the interesting point:

If I insert my driver module at runtime, well after udev has started,
I get a nice and functional device node of /dev/uno-2050-0.

If OTOH I compile that same driver monolithically into the kernel, so
that the device is detected before initrd is mounted and before udev
is started ("cold plug"?), udev doesn't create the device node,
although the sysfs entries (and a line in /proc/devices) are clearly
there, and if I make the device node by hand, I can use the device...

At least, this is the way it behaves in Fedora 6 and Mandriva 2006.0.
What am I doing wrong? Should I better post my initrc/rc.sysinit?
I do have /proc, /sys and /dev/pts mounted before I attempt to start
udev.

Thanks in advance for any ideas...

Frank Rysanek

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/