]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] Use device_for_each_child() to unregister devices in scsi_remove_target().
authormochel@digitalimplant.org <mochel@digitalimplant.org>
Fri, 25 Mar 2005 03:03:59 +0000 (19:03 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 20 Jun 2005 22:15:19 +0000 (15:15 -0700)
Signed-off-by: Patrick Mochel <mochel@digitalimplant.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Index: gregkh-2.6/drivers/scsi/scsi_sysfs.c
===================================================================

drivers/scsi/scsi_sysfs.c

index e75ee4671ee3a0a6dcb608a73d6bd2f4007eff09..7134618f0a1f8594aaa04b525f7eca4dc0842a0c 100644 (file)
@@ -669,6 +669,13 @@ void __scsi_remove_target(struct scsi_target *starget)
        scsi_target_reap(starget);
 }
 
+static int __remove_child (struct device * dev, void * data)
+{
+       if (scsi_is_target_device(dev))
+               __scsi_remove_target(to_scsi_target(dev));
+       return 0;
+}
+
 /**
  * scsi_remove_target - try to remove a target and all its devices
  * @dev: generic starget or parent of generic stargets to be removed
@@ -679,7 +686,7 @@ void __scsi_remove_target(struct scsi_target *starget)
  */
 void scsi_remove_target(struct device *dev)
 {
-       struct device *rdev, *idev, *next;
+       struct device *rdev;
 
        if (scsi_is_target_device(dev)) {
                __scsi_remove_target(to_scsi_target(dev));
@@ -687,10 +694,7 @@ void scsi_remove_target(struct device *dev)
        }
 
        rdev = get_device(dev);
-       list_for_each_entry_safe(idev, next, &dev->children, node) {
-               if (scsi_is_target_device(idev))
-                       __scsi_remove_target(to_scsi_target(idev));
-       }
+       device_for_each_child(dev, NULL, __remove_child);
        put_device(rdev);
 }
 EXPORT_SYMBOL(scsi_remove_target);