Re: 2.5.65-ac2 -- hda/ide trouble on ICH4

From: Dominik Brodowski (linux@brodo.de)
Date: Sun Mar 23 2003 - 13:15:33 EST


On Sun, Mar 23, 2003 at 06:41:10PM +0000, Alan Cox wrote:
> > printk("%4s\n", drive->name) prints out "hdd" all the time.
> >
> > hda is an ATA disk drive
> > hdb is empty
> > hdc is an ATAPI CD/DVD-ROM drive
> > hdd is an ATAPI CD-ROM CD-R/RW drive
>
> This gets weirder by the minute, and I still can't get it to happen here
> annoyingly.
>
> The list thats breaking is a private list. We delete the drive from that
> list, if its present (it may be an empty bay) we then use ata_attach
> to add it to a device list (or back to ata_unused).
>
> I find it hard to believe something like this is a compiler bug, but right
> now I don't see how stuff is reappearing on the list.

Just got it to boot :) -- the while(!list_empty...) { list_entry ... looks
suspicious. Might be better to use list_for_each_safe() which is designed
exactly for this purpouse. I'm currently recompiling
2.5.65-bk-current-as-of-yesterday with the attached patch. Let's see whether
it works with this kernel, too...

        Dominik

--- linux/drivers/ide/ide.c.original 2003-03-23 19:08:40.000000000 +0100
+++ linux/drivers/ide/ide.c 2003-03-23 19:10:25.000000000 +0100
@@ -2392,6 +2392,8 @@
 int ide_register_driver(ide_driver_t *driver)
 {
         struct list_head list;
+ struct list_head *list_loop;
+ struct list_head *tmp_storage;
 
         spin_lock(&drivers_lock);
         list_add(&driver->drivers, &drivers);
@@ -2402,8 +2404,8 @@
         list_splice_init(&ata_unused, &list);
         spin_unlock(&drives_lock);
 
- while (!list_empty(&list)) {
- ide_drive_t *drive = list_entry(list.next, ide_drive_t, list);
+ list_for_each_safe(list_loop, tmp_storage, &list) {
+ ide_drive_t *drive = container_of(list_loop, ide_drive_t, list);
                 list_del_init(&drive->list);
                 if (drive->present)
                         ata_attach(drive);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Mar 23 2003 - 22:00:45 EST