Commit 8d6a9f56 authored by Vitaly Kuznetsov's avatar Vitaly Kuznetsov Committed by James Bottomley

storvsc: use shost_for_each_device() instead of open coding

Comment in struct Scsi_Host says that drivers are not supposed to access
__devices directly. storvsc_host_scan() doesn't happen in irq context
so we can just use shost_for_each_device().
Signed-off-by: default avatarVitaly Kuznetsov <vkuznets@redhat.com>
Reviewed-by: default avatarLong Li <longli@microsoft.com>
Acked-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Odin.com>
parent cb1cf080
...@@ -426,7 +426,6 @@ static void storvsc_host_scan(struct work_struct *work) ...@@ -426,7 +426,6 @@ static void storvsc_host_scan(struct work_struct *work)
struct storvsc_scan_work *wrk; struct storvsc_scan_work *wrk;
struct Scsi_Host *host; struct Scsi_Host *host;
struct scsi_device *sdev; struct scsi_device *sdev;
unsigned long flags;
wrk = container_of(work, struct storvsc_scan_work, work); wrk = container_of(work, struct storvsc_scan_work, work);
host = wrk->host; host = wrk->host;
...@@ -443,14 +442,8 @@ static void storvsc_host_scan(struct work_struct *work) ...@@ -443,14 +442,8 @@ static void storvsc_host_scan(struct work_struct *work)
* may have been removed this way. * may have been removed this way.
*/ */
mutex_lock(&host->scan_mutex); mutex_lock(&host->scan_mutex);
spin_lock_irqsave(host->host_lock, flags); shost_for_each_device(sdev, host)
list_for_each_entry(sdev, &host->__devices, siblings) {
spin_unlock_irqrestore(host->host_lock, flags);
scsi_test_unit_ready(sdev, 1, 1, NULL); scsi_test_unit_ready(sdev, 1, 1, NULL);
spin_lock_irqsave(host->host_lock, flags);
continue;
}
spin_unlock_irqrestore(host->host_lock, flags);
mutex_unlock(&host->scan_mutex); mutex_unlock(&host->scan_mutex);
/* /*
* Now scan the host to discover LUNs that may have been added. * Now scan the host to discover LUNs that may have been added.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment