aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authormochel@digitalimplant.org <mochel@digitalimplant.org>2005-03-24 22:03:59 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-20 18:15:19 -0400
commit20b1e674230b642be662c5975923a0160ab9cbdc (patch)
tree749e1384c57576bfbe3ffd1414df321cc783296f /drivers
parent0293a509405dccecc30783a5d729d615b68d6a77 (diff)
[PATCH] Use device_for_each_child() to unregister devices in scsi_remove_target().
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 ===================================================================
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/scsi_sysfs.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index e75ee4671ee3..7134618f0a1f 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -669,6 +669,13 @@ void __scsi_remove_target(struct scsi_target *starget)
669 scsi_target_reap(starget); 669 scsi_target_reap(starget);
670} 670}
671 671
672static int __remove_child (struct device * dev, void * data)
673{
674 if (scsi_is_target_device(dev))
675 __scsi_remove_target(to_scsi_target(dev));
676 return 0;
677}
678
672/** 679/**
673 * scsi_remove_target - try to remove a target and all its devices 680 * scsi_remove_target - try to remove a target and all its devices
674 * @dev: generic starget or parent of generic stargets to be removed 681 * @dev: generic starget or parent of generic stargets to be removed
@@ -679,7 +686,7 @@ void __scsi_remove_target(struct scsi_target *starget)
679 */ 686 */
680void scsi_remove_target(struct device *dev) 687void scsi_remove_target(struct device *dev)
681{ 688{
682 struct device *rdev, *idev, *next; 689 struct device *rdev;
683 690
684 if (scsi_is_target_device(dev)) { 691 if (scsi_is_target_device(dev)) {
685 __scsi_remove_target(to_scsi_target(dev)); 692 __scsi_remove_target(to_scsi_target(dev));
@@ -687,10 +694,7 @@ void scsi_remove_target(struct device *dev)
687 } 694 }
688 695
689 rdev = get_device(dev); 696 rdev = get_device(dev);
690 list_for_each_entry_safe(idev, next, &dev->children, node) { 697 device_for_each_child(dev, NULL, __remove_child);
691 if (scsi_is_target_device(idev))
692 __scsi_remove_target(to_scsi_target(idev));
693 }
694 put_device(rdev); 698 put_device(rdev);
695} 699}
696EXPORT_SYMBOL(scsi_remove_target); 700EXPORT_SYMBOL(scsi_remove_target);