linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Patch: linux-2.5.34/drivers/ide/ide.c was building list of drives in reverse order
@ 2002-09-12 11:48 Adam J. Richter
  2002-09-12 11:52 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Adam J. Richter @ 2002-09-12 11:48 UTC (permalink / raw)
  To: andre, alan, axboe; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 970 bytes --]

	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 relevant
list_add to list_add_tail.  Incidentally, the generic code
in drivers/base/ already does it this way.

-- 
Adam J. Richter     __     ______________   575 Oroville Road
adam@yggdrasil.com     \ /                  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."

[-- Attachment #2: ide.diff --]
[-- Type: text/plain, Size: 474 bytes --]

--- linux-2.5.34/drivers/ide/ide.c	2002-09-09 10:35:06.000000000 -0700
+++ linux/drivers/ide/ide.c	2002-09-12 04:30:20.000000000 -0700
@@ -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,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Patch: linux-2.5.34/drivers/ide/ide.c was building list of drives in reverse order
  2002-09-12 11:48 Patch: linux-2.5.34/drivers/ide/ide.c was building list of drives in reverse order Adam J. Richter
@ 2002-09-12 11:52 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2002-09-12 11:52 UTC (permalink / raw)
  To: Adam J. Richter; +Cc: andre, alan, linux-kernel

On Thu, Sep 12 2002, Adam J. Richter wrote:
> 	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 relevant
> list_add to list_add_tail.  Incidentally, the generic code
> in drivers/base/ already does it this way.

Patch looks right (its obviously the right thing to do), thanks

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-12 11:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-12 11:48 Patch: linux-2.5.34/drivers/ide/ide.c was building list of drives in reverse order Adam J. Richter
2002-09-12 11:52 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).