views:

144

answers:

2

I'm porting a linux kernel module. It used to create a device file for itself (using dirty hacks with syscalls from kernelspace), but now I want to do this in udev. Where can I find documentation on supporting udev in in kernel module?

Note that module itself is not a device driver. It serves as a multiplexor for a set of drivers. Therefor default ways of registering devices (i.e. pci ones) are not suitable for my task.

A: 

Do you mean your module enumerates devices, which each then need a driver loaded?

If so, your module is best represented as a bus driver. See bus_register() info in Documentation/driver-model/*, especially bus.txt. You can look at other kernel code (PCI, USB, ACPI) for usage examples.

By using the driver-model APIs it should automatically handle exposing your bus driver and all attached devices through udev.

Andy Grover
A: 

device_create function allowed me to register a device in a "virtual" bus and automatially published major and minor numbers for my character device in sysfs.

Basilevs