• Patrick Mochel's avatar
    [PATCH] Adding driver model support in IDE · 18277e88
    Patrick Mochel authored
    This adds the basic driver model support for the IDE subsystem.
    
    Basically, it registers the controllers and devices with the driver
    model core, which puts them in the device tree and gets them a directory
    in driverfs.  The driverfs layout looks like this (on my workstation):
    
    	[mochel@cherise mochel]$ tree -d /sys/root/pci0/
    	/sys/root/pci0/
    	|-- 00:00.0
    	|-- 00:01.0
    	|   `-- 01:00.0
    	|-- 00:02.0
    	|   `-- 02:1f.0
    	|       `-- 03:00.0
    	|-- 00:1e.0
    	|   `-- 04:04.0
    	|-- 00:1f.0
    	|-- 00:1f.1
    	|   |-- ide0
    	|   |   |-- 0.0
    	|   |   `-- 0.1
    	|   `-- ide1
    	|       |-- 1.0
    	|       `-- 1.1
    
    The drive bus IDs (the directory names)  are created using this:
    
    	sprintf(bus_id,"%u.%u",hwif->index,unit);
    
    which should give each drive a unique name for the entire system, right?
    
    I've also created a struct bus_type for IDE, which gives ide a directory
    in the driverfs bus/ directory. The layout of that is:
    
    	[mochel@cherise mochel]$ tree -d /sys/bus/ide/
    	/sys/bus/ide/
    	|-- devices
    	|   |-- 0.0 -> ../../../root/pci0/00:1f.1/ide0/0.0
    	|   |-- 0.1 -> ../../../root/pci0/00:1f.1/ide0/0.1
    	|   |-- 1.0 -> ../../../root/pci0/00:1f.1/ide1/1.0
    	|   `-- 1.1 -> ../../../root/pci0/00:1f.1/ide1/1.1
    	`-- drivers
    
    Those are symlinks under devices/ (which is why the drive names must be
    unique..). When drivers are registered with the IDE core, they should also
    be passed through the core, which will give them a directory in the
    drivers/ directory just above.
    
    In general, there is a bit of code that can be cleaned up, and some
    explicit calls removed, because of the way the driver model core works.
    Most of these are pretty simple, and barring any objections, I will
    implement and send them to you.
    18277e88
ide-probe.c 30.6 KB