Messages in this thread Patch in this message |  | | | Date | Thu, 24 Mar 2005 21:54:54 -0800 (PST) | | From | Patrick Mochel <> | | Subject | [10/12] More Driver Model Locking Changes |
| |
ChangeSet@1.2248, 2005-03-24 19:03:59-08:00, mochel@digitalimplant.org [scsi] Use device_for_each_child() to unregister devices in scsi_remove_target().
Signed-off-by: Patrick Mochel <mochel@digitalimplant.org>
diff -Nru a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c --- a/drivers/scsi/scsi_sysfs.c 2005-03-24 20:32:54 -08:00 +++ b/drivers/scsi/scsi_sysfs.c 2005-03-24 20:32:54 -08:00 @@ -672,6 +672,13 @@ 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 @@ -682,7 +689,7 @@ */ 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)); @@ -690,10 +697,7 @@ }
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); - 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/
|  |