Skip to contentSkip to conversation

scsi_report_device_reset

PATCH New Christoph Hellwig 1 participant 1 message May 8, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_report_device_reset

aic7xxx/79xx wants a variant of scsi_report_bus_reset that operates only on a single device. Implement it to get rid of shost->my_devices traversals in drivers. (and move both to scsi_error.c)

drivers/scsi/hosts.h +1 -0
@@ -514,6 +514,7 @@
 extern void scsi_unblock_requests(struct Scsi_Host *);
 extern void scsi_block_requests(struct Scsi_Host *);
 extern void scsi_report_bus_reset(struct Scsi_Host *, int);
+extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
 
 static inline void scsi_assign_lock(struct Scsi_Host *shost, spinlock_t *lock)
 {
drivers/scsi/scsi_error.c +68 -0

74 lines not on this page · raw message

drivers/scsi/scsi_lib.c +0 -33
@@ -1313,39 +1313,6 @@
 	scsi_run_host_queues(shost);
 }
 
-/*
- * Function:    scsi_report_bus_reset()
- *
- * Purpose:     Utility function used by low-level drivers to report that
- *		they have observed a bus reset on the bus being handled.
- *
- * Arguments:   shost       - Host in question
- *		channel     - channel on which reset was observed.
- *
- * Returns:     Nothing
- *
- * Lock status: No locks are assumed held.
- *
- * Notes:       This only needs to be called if the reset is one which
- *		originates from an unknown location.  Resets originated
- *		by the mid-level itself don't need to call this, but there
- *		should be no harm.
- *
- *		The main purpose of this is to make sure that a CHECK_CONDITION
- *		is properly treated.
- */
-void scsi_report_bus_reset(struct Scsi_Host *shost, int channel)
-{
-	struct scsi_device *sdev;
-
-	list_for_each_entry(sdev, &shost->my_devices, siblings) {
-		if (channel == sdev->channel) {
-			sdev->was_reset = 1;
-			sdev->expecting_cc_ua = 1;
-		}
-	}
-}
-
 int __init scsi_init_queue(void)
 {
 	int i;
drivers/scsi/scsi_syms.c +1 -0
@@ -65,6 +65,7 @@
 EXPORT_SYMBOL(scsi_put_command);
 
 EXPORT_SYMBOL(scsi_report_bus_reset);
+EXPORT_SYMBOL(scsi_report_device_reset);
 EXPORT_SYMBOL(scsi_block_requests);
 EXPORT_SYMBOL(scsi_unblock_requests);
 EXPORT_SYMBOL(scsi_adjust_queue_depth);
drivers/scsi/aic7xxx/aic79xx_osm.c +5 -8
@@ -4404,22 +4404,19 @@
 	}
         case AC_SENT_BDR:
 	{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+		WARN_ON(lun != CAM_LUN_WILDCARD);
+		scsi_report_device_reset(ahd->platform_data->host,
+					 channel - 'A', target);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
 		Scsi_Device *scsi_dev;
 
 		/*
 		 * Find the SCSI device associated with this
 		 * request and indicate that a UA is expected.
-		 * XXX This should really be handled by the mid-layer.
 		 */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-		list_for_each_entry(scsi_dev,
-				    &ahd->platform_data->host->my_devices,
-				    siblings) {
-#else
 		for (scsi_dev = ahd->platform_data->host->host_queue;
 		     scsi_dev != NULL; scsi_dev = scsi_dev->next) {
-#endif
 			if (channel - 'A' == scsi_dev->channel
 			 && target == scsi_dev->id
 			 && (lun == CAM_LUN_WILDCARD
drivers/scsi/aic7xxx/aic7xxx_osm.c +5 -8
@@ -4086,22 +4086,19 @@
 	}
         case AC_SENT_BDR:
 	{
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
+		WARN_ON(lun != CAM_LUN_WILDCARD);
+		scsi_report_device_reset(ahc->platform_data->host,
+					 channel - 'A', target);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)
 		Scsi_Device *scsi_dev;
 
 		/*
 		 * Find the SCSI device associated with this
 		 * request and indicate that a UA is expected.
-		 * XXX This should really be handled by the mid-layer.
 		 */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-		list_for_each_entry(scsi_dev,
-				    &ahc->platform_data->host->my_devices,
-				    siblings) {
-#else
 		for (scsi_dev = ahc->platform_data->host->host_queue;
 		     scsi_dev != NULL; scsi_dev = scsi_dev->next) {
-#endif
 			if (channel - 'A' == scsi_dev->channel
 			 && target == scsi_dev->id
 			 && (lun == CAM_LUN_WILDCARD