diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-03-19 22:09:18 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-04-07 13:18:59 -0400 |
commit | 8b40228f3f5b1fa926c116ec444476d32bc470f6 (patch) | |
tree | 62e9613b5a6304fc1586aa5e85c6b2e17250ee40 /drivers/scsi/scsi_debug.c | |
parent | a75869d1ff73de74249373c2a1d80fbbc3b6c8fc (diff) |
[SCSI] scsi_debug: use list_for_each_entry_safe
This replaces list_for_each_safe and list_entry with
list_for_each_entry_safe.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/scsi_debug.c')
-rw-r--r-- | drivers/scsi/scsi_debug.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 1a9106353f72..681b591fc4c0 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -2930,8 +2930,7 @@ static int sdebug_add_adapter(void) | |||
2930 | int k, devs_per_host; | 2930 | int k, devs_per_host; |
2931 | int error = 0; | 2931 | int error = 0; |
2932 | struct sdebug_host_info *sdbg_host; | 2932 | struct sdebug_host_info *sdbg_host; |
2933 | struct sdebug_dev_info *sdbg_devinfo; | 2933 | struct sdebug_dev_info *sdbg_devinfo, *tmp; |
2934 | struct list_head *lh, *lh_sf; | ||
2935 | 2934 | ||
2936 | sdbg_host = kzalloc(sizeof(*sdbg_host),GFP_KERNEL); | 2935 | sdbg_host = kzalloc(sizeof(*sdbg_host),GFP_KERNEL); |
2937 | if (NULL == sdbg_host) { | 2936 | if (NULL == sdbg_host) { |
@@ -2971,9 +2970,8 @@ static int sdebug_add_adapter(void) | |||
2971 | return error; | 2970 | return error; |
2972 | 2971 | ||
2973 | clean: | 2972 | clean: |
2974 | list_for_each_safe(lh, lh_sf, &sdbg_host->dev_info_list) { | 2973 | list_for_each_entry_safe(sdbg_devinfo, tmp, &sdbg_host->dev_info_list, |
2975 | sdbg_devinfo = list_entry(lh, struct sdebug_dev_info, | 2974 | dev_list) { |
2976 | dev_list); | ||
2977 | list_del(&sdbg_devinfo->dev_list); | 2975 | list_del(&sdbg_devinfo->dev_list); |
2978 | kfree(sdbg_devinfo); | 2976 | kfree(sdbg_devinfo); |
2979 | } | 2977 | } |
@@ -3062,9 +3060,8 @@ static int sdebug_driver_probe(struct device * dev) | |||
3062 | 3060 | ||
3063 | static int sdebug_driver_remove(struct device * dev) | 3061 | static int sdebug_driver_remove(struct device * dev) |
3064 | { | 3062 | { |
3065 | struct list_head *lh, *lh_sf; | ||
3066 | struct sdebug_host_info *sdbg_host; | 3063 | struct sdebug_host_info *sdbg_host; |
3067 | struct sdebug_dev_info *sdbg_devinfo; | 3064 | struct sdebug_dev_info *sdbg_devinfo, *tmp; |
3068 | 3065 | ||
3069 | sdbg_host = to_sdebug_host(dev); | 3066 | sdbg_host = to_sdebug_host(dev); |
3070 | 3067 | ||
@@ -3076,9 +3073,8 @@ static int sdebug_driver_remove(struct device * dev) | |||
3076 | 3073 | ||
3077 | scsi_remove_host(sdbg_host->shost); | 3074 | scsi_remove_host(sdbg_host->shost); |
3078 | 3075 | ||
3079 | list_for_each_safe(lh, lh_sf, &sdbg_host->dev_info_list) { | 3076 | list_for_each_entry_safe(sdbg_devinfo, tmp, &sdbg_host->dev_info_list, |
3080 | sdbg_devinfo = list_entry(lh, struct sdebug_dev_info, | 3077 | dev_list) { |
3081 | dev_list); | ||
3082 | list_del(&sdbg_devinfo->dev_list); | 3078 | list_del(&sdbg_devinfo->dev_list); |
3083 | kfree(sdbg_devinfo); | 3079 | kfree(sdbg_devinfo); |
3084 | } | 3080 | } |