helper for device list traversal
Subsystems (3)
PATCH 1/1 helper for device list traversal
This patch adds shost_for_each_device(). It's used to abstract out scsi_host.my_devices traversal. The next step will be to replace the current simple implementation with one that's fully locked down an reference counted.
drivers/scsi/dpt_i2o.c +1 -1
@@ -2483,7 +2483,7 @@Scsi_Cmnd * cmd =NULL ;Scsi_Device * d =NULL ; -list_for_each_entry (d, &pHba->host->my_devices, siblings) { +shost_for_each_device (d, pHba->host) {unsigned long flags;spin_lock_irqsave (&d->list_lock, flags);list_for_each_entry (cmd, &d->cmd_list, list) {
drivers/scsi/fcal.c +1 -1
@@ -245,7 +245,7 @@ alpa, u1[0], u1[1], u2[0], u2[1]); }else {Scsi_Device *scd; - list_for_each_entry (scd, &host->my_devices, siblings) +shost_for_each_device (scd, host)if (scd->id == target) {SPRINTF (" [AL-PA: %02x, Id: %02d, Port WWN: %08x%08x, Node WWN: %08x%08x] " , alpa, target, u1[0 ], u1[1 ], u2[0 ], u2[1 ]);
drivers/scsi/g_NCR5380.c +1 -1
@@ -825,7 +825,7 @@PRINTP (" %d pending writes" ANDP hostdata->pendingw);if (hostdata->pendingr || hostdata->pendingw)PRINTP ("\n" ); - list_for_each_entry (dev, &scsi_ptr->my_devices, siblings) { +shost_for_each_device (dev, scsi_ptr) {unsigned long br = hostdata->bytes_read[dev->id];unsigned long bw = hostdata->bytes_write[dev->id];long tr = hostdata->time_read[dev->id] /HZ ;
drivers/scsi/scsi_error.c +6 -6
@@ -211,8 +211,7 @@int cmd_cancel =0 ;int devices_failed =0 ; - -list_for_each_entry (sdev, &shost->my_devices, siblings) { +shost_for_each_device (sdev, shost) {list_for_each_entry (scmd, work_q, eh_entry) {if (scmd->device == sdev) { ++total_failures;
@@ -850,7 +849,7 @@struct scsi_device *sdev;int rtn; -list_for_each_entry (sdev, &shost->my_devices, siblings) { +shost_for_each_device (sdev, shost) { bdr_scmd =NULL ;list_for_each_entry (scmd, work_q, eh_entry)if (scmd->device == sdev) {
@@ -1363,9 +1362,10 @@* onto the head of the SCSI request queue for the device. There * is no point trying to lock the door of an off-line device. */ -list_for_each_entry (sdev, &shost->my_devices, siblings) +shost_for_each_device (sdev, shost) {if (sdev->online && sdev->locked)scsi_eh_lock_door (sdev); + }/* * next free up anything directly waiting upon the host. this
@@ -1621,7 +1621,7 @@ {struct scsi_device *sdev; -list_for_each_entry (sdev, &shost->my_devices, siblings) { +shost_for_each_device (sdev, shost) {if (channel == sdev->channel) { sdev->was_reset =1 ; sdev->expecting_cc_ua =1 ;
@@ -1655,7 +1655,7 @@ {struct scsi_device *sdev; -list_for_each_entry (sdev, &shost->my_devices, siblings) { +shost_for_each_device (sdev, shost) {if (channel == sdev->channel && target == sdev->id) { sdev->was_reset =1 ;
drivers/scsi/scsi_lib.c +1 -1
@@ -462,7 +462,7 @@ {struct scsi_device *sdev; -list_for_each_entry (sdev, &shost->my_devices, siblings) +shost_for_each_device (sdev, shost)scsi_run_queue (sdev->request_queue); }
drivers/scsi/arm/fas216.c +2 -2
@@ -2592,7 +2592,7 @@* all command structures. Leave the running * command in place. */ -list_for_each_entry (SDpnt, &info->host->my_devices, siblings) { +shost_for_each_device (SDpnt, info->host) {int i;if (SDpnt->soft_reset)
@@ -3007,7 +3007,7 @@ p +=sprintf (p,"Device/Lun TaggedQ Parity Sync\n" ); -list_for_each_entry (scd, &info->host->my_devices, siblings) { +shost_for_each_device (scd, info->host) { dev = &info->device[scd->id]; p +=sprintf (p," %d/%d " , scd->id, scd->lun);if (scd->tagged_supported)
include/scsi/scsi_device.h +3 -0
@@ -111,6 +111,9 @@extern int scsi_device_get (struct scsi_device *);extern void scsi_device_put (struct scsi_device *); +#define shost_for_each_device (sdev, shost) \ + list_for_each_entry((sdev), &((shost)->my_devices), siblings) +extern void scsi_adjust_queue_depth (struct scsi_device *,int ,int );extern int scsi_track_queue_full (struct scsi_device *,int );