[PATCH 2/4] gdth: do not use struct scsi_cmnd as argument for bus reset

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

 



Bus reset just needs the number of the bus to reset as argument,
so introduce a function gdth_bus_reset() and avoid allocating
a temporary scsi command when bus reset is triggered via ioctl.

Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
---
 drivers/scsi/gdth.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index b65edccb3147..b62ecfc24bb6 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -3323,18 +3323,14 @@ static enum blk_eh_timer_return gdth_timed_out(struct scsi_cmnd *scp)
 }
 
 
-static int gdth_eh_bus_reset(struct scsi_cmnd *scp)
+static int gdth_bus_reset(gdth_ha_str *ha, u8 b)
 {
-	gdth_ha_str *ha = shost_priv(scp->device->host);
 	int i;
 	unsigned long flags;
 	struct scsi_cmnd *cmnd;
-	u8 b;
 
 	TRACE2(("gdth_eh_bus_reset()\n"));
 
-	b = scp->device->channel;
-
 	/* clear command tab */
 	spin_lock_irqsave(&ha->smp_lock, flags);
 	for (i = 0; i < GDTH_MAXCMDS; ++i) {
@@ -3375,6 +3371,11 @@ static int gdth_eh_bus_reset(struct scsi_cmnd *scp)
 	return SUCCESS;
 }
 
+static int gdth_eh_bus_reset(struct scsi_cmnd *scp)
+{
+	return gdth_bus_reset(shost_priv(scp->device->host), scp->device->channel);
+}
+
 static int gdth_bios_param(struct scsi_device *sdev,struct block_device *bdev,
 			   sector_t cap,int *ip)
 {
@@ -3897,7 +3898,6 @@ static int ioc_rescan(void __user *arg, char *cmnd)
 static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 {
 	gdth_ha_str *ha;
-	struct scsi_cmnd *scp;
 	unsigned long flags;
 	char cmnd[MAX_COMMAND_SIZE];
 	void __user *argp = (void __user *)arg;
@@ -4013,15 +4013,8 @@ static int gdth_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 		    (NULL == (ha = gdth_find_ha(res.ionode))))
 			return -EFAULT;
 
-		scp  = kzalloc(sizeof(*scp), GFP_KERNEL);
-		if (!scp)
-			return -ENOMEM;
-		scp->device = ha->sdev;
-		scp->cmd_len = 12;
-		scp->device->channel = res.number;
-		rval = gdth_eh_bus_reset(scp);
+		rval = gdth_bus_reset(ha, res.number);
 		res.status = (rval == SUCCESS ? S_OK : S_GENERR);
-		kfree(scp);
 
 		if (copy_to_user(argp, &res, sizeof(gdth_ioctl_reset)))
 			return -EFAULT;
-- 
2.16.4




[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