]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Make ide use proper removal-safe list handling (removes endless looping ...
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Sun, 23 Mar 2003 10:07:07 +0000 (02:07 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 23 Mar 2003 10:07:07 +0000 (02:07 -0800)
Fix the IDE hang people see with 2.5.65-bk

From Dominik Brodowski <linux@brodo.de>

drivers/ide/ide.c

index 0cd9927b16a2db5fc16fb7518acdc0275d8bf5f8..c5d59ccfa366fe748c287609b752fad02b3f0319 100644 (file)
@@ -2392,6 +2392,8 @@ static int ide_drive_remove(struct device * dev)
 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 @@ int ide_register_driver(ide_driver_t *driver)
        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);