porting driver 2.4 -> 2.6, confused by device model

Sebastian Kuzminsky seb at highlab.com
Sat Feb 24 00:03:04 CST 2007


Greg KH <greg at kroah.com> wrote:
> If you really want to do this on your own, see the chapter about the
> driver model in the book, Linux Device Drivers, third edition, online
> for free, that talks about how to hook up your code to let udev work
> properly.
> 
> Note that the book is a bit out of date, and the functions that it tells
> you to use there are no longer present.  Instead use the device_create()
> functions.

Ok, that helps thanks!

Now in my driver, I detect the cards, request their IO ports and IRQs,
then do this:

    alloc_chrdev_region();

    cdev_init();
    cdev.owner = THIS_MODULE;
    cdev_add();

    class_create();

    for each card:
        for each feature of card:
            device_create();


Seem reasonable?


One thing I'm not sure how to do, I'd like to group the device files
in directories.  Something like /dev/dmm/cardX/adcY.  How do I create
the directories?


-- 
Sebastian Kuzminsky                  The Stage is too big for the Drama.
                                                   -- Richard P. Feynman


More information about the Kernel-mentors mailing list