Patch: linux-2.5.34/drivers/ide/ide.c was building list of drives in reverse order
ata_attach in linux-2.5.34/drivers/ide/ide.c builds a list of
IDE drives that do not yet have a device driver bound to them, in case ide-disk, ide-scsi, or whatever driver you want to use is not loaded yet.
The problem was that ata_attach was adding to the head of
the list, so the list was being built in reverse order. So, if you had two IDE disks, and ide-disk was a loadable module, the devfs entries for the disks would be numbered in reverse (the first disk would be /dev/discs/disc1, and the second would be /dev/discs/disc0).
The follow patch fixes the problem by changing the relevantlist_add to list_add_tail. Incidentally, the generic code in drivers/base/ already does it this way.
Signature · 4 lines
Adam J. Richter __ ______________ 575 Oroville Road [email protected] \ / Milpitas, California 95035 +1 408 309-6081 | g g d r a s i l United States of America "Free Software For The Rest Of Us."
drivers/ide/ide.c +1 -1
@@ -2478,11 +2478,11 @@if (driver->owner)__MOD_DEC_USE_COUNT (driver->owner); }spin_unlock (&drivers_lock);spin_lock (&drives_lock); -list_add (&drive->list, &ata_unused); +list_add_tail (&drive->list, &ata_unused);spin_unlock (&drives_lock);return 1 ; } static int ide_ioctl (struct inode *inode, struct file *file,
Quoted 12 lines · Adam J. Richter
ata_attachinlinux-2.5.34/drivers/ide/ide.cbuilds a list of
IDE drives that do not yet have a device driver bound to them, in case ide-disk, ide-scsi, or whatever driver you want to use is not loaded yet.The problem was that
ata_attachwas adding to the head of
the list, so the list was being built in reverse order. So, if you had two IDE disks, and ide-disk was a loadable module, the devfs entries for the disks would be numbered in reverse (the first disk would be/dev/discs/disc1, and the second would be/dev/discs/disc0).
Quoted 3 lines
The follow patch fixes the problem by changing the relevant
list_addtolist_add_tail. Incidentally, the generic code indrivers/base/already does it this way.
Patch looks right (its obviously the right thing to do), thanks
Signature · 1 line
Jens Axboe