Re: [PATCH 2/7] scsi: Use Scsi_Host and channel number as argument for eh_bus_reset_handler()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




diff --git a/Documentation/scsi/scsi_eh.rst b/Documentation/scsi/scsi_eh.rst
index da95971b4f44..dbbfd754a928 100644
--- a/Documentation/scsi/scsi_eh.rst
+++ b/Documentation/scsi/scsi_eh.rst
@@ -216,7 +216,7 @@ considered to fail always.
int (* eh_abort_handler)(struct scsi_cmnd *);
      int (* eh_device_reset_handler)(struct scsi_cmnd *);
-    int (* eh_bus_reset_handler)(struct scsi_cmnd *);
+    int (* eh_bus_reset_handler)(struct Scsi_Host *, int);

scsi_device.channel and scsi_target.channel are both unsigned int, so could this also be unsigned int?

      int (* eh_host_reset_handler)(struct Scsi_Host *);
Higher-severity actions are taken only when lower-severity actions
diff --git a/Documentation/scsi/scsi_mid_low_api.rst b/Documentation/scsi/scsi_mid_low_api.rst
index 85b1384ba4fd..88bb3b7578ba 100644
--- a/Documentation/scsi/scsi_mid_low_api.rst
+++ b/Documentation/scsi/scsi_mid_low_api.rst
@@ -741,7 +741,8 @@ Details::

...

/* If we can't locate our host adapter structure, return FAILED status.
  	 */
-	if ((hd = shost_priv(SCpnt->device->host)) == NULL){
+	if ((hd = shost_priv(shost)) == NULL){
  		printk(KERN_ERR MYNAM ": bus reset: "
-		   "Can't locate host! (sc=%p)\n", SCpnt);
+		   "Can't locate host!\n");
  		return FAILED;
  	}
ioc = hd->ioc;
-	printk(MYIOC_s_INFO_FMT "attempting bus reset! (sc=%p)\n",
-	       ioc->name, SCpnt);
-	scsi_print_command(SCpnt);
+	printk(MYIOC_s_INFO_FMT "attempting bus reset!\n",

maybe printing the channel number may be helpful

+	       ioc->name);
if (ioc->timeouts < -1)
  		ioc->timeouts++;
- vdevice = SCpnt->device->hostdata;
-	if (!vdevice || !vdevice->vtarget)
-		return SUCCESS;
  	retval = mptscsih_IssueTaskMgmt(hd,
  					MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS,
-					vdevice->vtarget->channel, 0, 0, 0,
+					channel, 0, 0, 0,
  					mptscsih_get_tm_timeout(ioc));
- printk(MYIOC_s_INFO_FMT "bus reset: %s (sc=%p)\n",
-	    ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ), SCpnt);
+	printk(MYIOC_s_INFO_FMT "bus reset: %s\n",
+	    ioc->name, ((retval == 0) ? "SUCCESS" : "FAILED" ));

Outer () can be removed

if (retval == 0)
  		return SUCCESS;
diff --git a/drivers/message/fusion/mptscsih.h b/drivers/message/fusion/mptscsih.h

...

  	struct AdapterCtlBlk *acb =
-		(struct AdapterCtlBlk *)cmd->device->host->hostdata;
+		(struct AdapterCtlBlk *)shost->hostdata;
  	dprintkl(KERN_INFO,
-		"eh_bus_reset: (0%p) target=<%02i-%i> cmd=%p\n",
-		cmd, cmd->device->id, (u8)cmd->device->lun, cmd);
+		 "eh_bus_reset: bus=<%02i>\n", channel);
if (timer_pending(&acb->waiting_timer))
  		del_timer(&acb->waiting_timer);
/*
-	 * disable interrupt
+	 * disable interrupt

what changed here?

  	 */
  	DC395x_write8(acb, TRM_S1040_DMA_INTEN, 0x00);
  	DC395x_write8(acb, TRM_S1040_SCSI_INTEN, 0x00);
@@ -1172,7 +1171,7 @@ static int __dc395x_eh_bus_reset(struct scsi_cmnd *cmd)
  	    HZ * acb->eeprom.delay_time;
/*
-	 * re-enable interrupt
+	 * re-enable interrupt
  	 */

...

/* Internal functions */
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index 168f01a34acc..ae647e2586d0 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -1097,10 +1097,8 @@ int esas2r_host_reset(struct Scsi_Host *shost)
  	return esas2r_host_bus_reset(shost, true);
  }
-int esas2r_bus_reset(struct scsi_cmnd *cmd)
+int esas2r_bus_reset(struct Scsi_Host *shost, int channel)
  {
-	struct Scsi_Host *shost = cmd->device->host;
-
  	esas2r_log(ESAS2R_LOG_INFO, "bus_reset (%p)", shost);

surely printing the channel would be better than the shost pointer

return esas2r_host_bus_reset(shost, false);
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index 355fec046220..c6a5721aef23 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2604,9 +2604,9 @@ static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
  	return FAILED;
  }

...

- sdev_printk(KERN_INFO, scmd->device,
-		"Bus reset is %s for scmd(%p)\n",
-		((retval == SUCCESS) ? "SUCCESS" : "FAILED"), scmd);
+	shost_printk(KERN_INFO, shost,
+		"Bus reset is %s\n",
+		((retval == SUCCESS) ? "SUCCESS" : "FAILED"));

again, () can be removed

  	return retval;
  }
diff --git a/drivers/scsi/ncr53c8xx.c b/drivers/scsi/ncr53c8xx.c
index 35869b4f9329..59efe064b304 100644
--- a/drivers/scsi/ncr53c8xx.c
+++ b/drivers/scsi/ncr53c8xx.c
@@ -7936,9 +7936,9 @@ static void ncr53c8xx_timeout(struct timer_list *t)
  		ncr_flush_done_cmds(done_list);
  }
-static int ncr53c8xx_bus_reset(struct scsi_cmnd *cmd)
+static int ncr53c8xx_bus_reset(struct Scsi_Host *host, int channel)
  {
-	struct ncb *np = ((struct host_data *) cmd->device->host->hostdata)->ncb;
+	struct ncb *np = ((struct host_data *) host->hostdata)->ncb;
  	int sts;
  	unsigned long flags;
  	struct scsi_cmnd *done_list;
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c
index 104647a6170e..c709bb955d05 100644
--- a/drivers/scsi/pcmcia/nsp_cs.c
+++ b/drivers/scsi/pcmcia/nsp_cs.c
@@ -1486,11 +1486,11 @@ static int nsp_bus_reset(nsp_hw_data *data)
  	return SUCCESS;
  }
-static int nsp_eh_bus_reset(struct scsi_cmnd *SCpnt)
+static int nsp_eh_bus_reset(struct Scsi_Host *host, int channel)
  {
-	nsp_hw_data *data = (nsp_hw_data *)SCpnt->device->host->hostdata;
+	nsp_hw_data *data = (nsp_hw_data *)host->hostdata;
- nsp_dbg(NSP_DEBUG_BUSRESET, "SCpnt=0x%p", SCpnt);
+	nsp_dbg(NSP_DEBUG_BUSRESET, "channel=0x%d", channel);

0x%x, and I am not sure that is even better than printing in decimal

return nsp_bus_reset(data);
  }
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h
index f532adb5f166..8636f0053c02 100644
--- a/drivers/scsi/pcmcia/nsp_cs.h
+++ b/drivers/scsi/pcmcia/nsp_cs.h
@@ -299,7 +299,7 @@ static int nsp_queuecommand(struct Scsi_Host *h, struct scsi_cmnd *SCpnt);

...
  	return rc;
  }
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index bb0323d05640..a9d9d0a9abd7 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1588,7 +1588,7 @@ qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)
  *    commands.
  *
  * Input:
-*    cmd = Linux SCSI command packet of the command that cause the
+*    host = Linux SCSI command packet of the command that cause the
  *          bus reset.

"Linux SCSI command packet " - really?

  *
  * Returns:
@@ -1596,12 +1596,10 @@ qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)
  *
  **************************************************************************/
...

- scmd_printk(KERN_INFO, cmd, "SCSI Bus reset\n");
+	shost_printk(KERN_INFO, host, "SCSI Bus reset\n");

how about this the channel #?

/*
  	 * We don't want to queue new requests for this bus after
diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index 42134f9510d5..bc48152e74b8 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -484,11 +484,11 @@ static int wd719x_abort(struct scsi_cmnd *cmd)
  	return SUCCESS;
  }



  /* Simulate a SCSI bus reset by resetting the device's USB port. */
-static int bus_reset(struct scsi_cmnd *srb)
+static int bus_reset(struct Scsi_Host *shost, int channel)
  {
-	struct us_data *us = host_to_us(srb->device->host);
+	struct us_data *us = host_to_us(shost);

Incidentally host_to_us() seems a copy of shost_priv()

  	int result;
usb_stor_dbg(us, "%s called\n", __func__);
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 9e3ec411cdc6..32ef595db028 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -152,7 +152,7 @@ struct scsi_host_template {
  	int (* eh_abort_handler)(struct scsi_cmnd *);
  	int (* eh_device_reset_handler)(struct scsi_cmnd *);
  	int (* eh_target_reset_handler)(struct scsi_cmnd *);
-	int (* eh_bus_reset_handler)(struct scsi_cmnd *);
+	int (* eh_bus_reset_handler)(struct Scsi_Host *, int);
  	int (* eh_host_reset_handler)(struct Scsi_Host *);
/*




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux