From: Quentin Lambert <lambert.quentin@gmail.com>
To: joe@perches.com
Cc: Nagalakshmi Nandigama <nagalakshmi.nandigama@avagotech.com>,
Praveen Krishnamoorthy <praveen.krishnamoorthy@avagotech.com>,
Sreekanth Reddy <sreekanth.reddy@avagotech.com>,
Abhijit Mahajan <abhijit.mahajan@avagotech.com>,
"James E.J. Bottomley" <JBottomley@parallels.com>,
MPT-FusionLinux.pdl@avagotech.com, linux-scsi@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/3] [SCSI] mpt2sas: Merge two similar functions
Date: Fri, 19 Dec 2014 12:38:58 +0000 [thread overview]
Message-ID: <20141219123858.GA20271@sloth> (raw)
mpt2sas_scsih_set_tm_flag and mpt2sas_scsih_clear_tm_flag
shared a lot of code. Therefore, they are merged into one
function whose behaviour is given by a new parameter
named action.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---
drivers/scsi/mpt2sas/mpt2sas_scsih.c | 43 +++++++-----------------------------
1 file changed, 8 insertions(+), 35 deletions(-)
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 6a1c036..a6f89fd 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -2253,14 +2253,15 @@ _scsih_tm_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
}
/**
- * mpt2sas_scsih_set_tm_flag - set per target tm_busy
+ * mpt2sas_scsih_tm_flag - set/clear per target tm_busy
* @ioc: per adapter object
* @handle: device handle
+ * @action: 1 set per target tm_busy, 0 clear per target tm_busy
*
* During taskmangement request, we need to freeze the device queue.
*/
void
-mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle)
+mpt2sas_scsih_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 action)
{
struct MPT2SAS_DEVICE *sas_device_priv_data;
struct scsi_device *sdev;
@@ -2273,37 +2274,9 @@ mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle)
if (!sas_device_priv_data)
continue;
if (sas_device_priv_data->sas_target->handle = handle) {
- sas_device_priv_data->sas_target->tm_busy = 1;
+ sas_device_priv_data->sas_target->tm_busy = action;
skip = 1;
- ioc->ignore_loginfos = 1;
- }
- }
-}
-
-/**
- * mpt2sas_scsih_clear_tm_flag - clear per target tm_busy
- * @ioc: per adapter object
- * @handle: device handle
- *
- * During taskmangement request, we need to freeze the device queue.
- */
-void
-mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle)
-{
- struct MPT2SAS_DEVICE *sas_device_priv_data;
- struct scsi_device *sdev;
- u8 skip = 0;
-
- shost_for_each_device(sdev, ioc->shost) {
- if (skip)
- continue;
- sas_device_priv_data = sdev->hostdata;
- if (!sas_device_priv_data)
- continue;
- if (sas_device_priv_data->sas_target->handle = handle) {
- sas_device_priv_data->sas_target->tm_busy = 0;
- skip = 1;
- ioc->ignore_loginfos = 0;
+ ioc->ignore_loginfos = action;
}
}
}
@@ -2401,7 +2374,7 @@ mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint channel,
mpi_request->TaskType = type;
mpi_request->TaskMID = cpu_to_le16(smid_task);
int_to_scsilun(lun, (struct scsi_lun *)mpi_request->LUN);
- mpt2sas_scsih_set_tm_flag(ioc, handle);
+ mpt2sas_scsih_tm_flag(ioc, handle, 1);
init_completion(&ioc->tm_cmds.done);
mpt2sas_base_put_smid_hi_priority(ioc, smid);
timeleft = wait_for_completion_timeout(&ioc->tm_cmds.done, timeout*HZ);
@@ -2415,7 +2388,7 @@ mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint channel,
FORCE_BIG_HAMMER);
rc = (!rc) ? SUCCESS : FAILED;
ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
- mpt2sas_scsih_clear_tm_flag(ioc, handle);
+ mpt2sas_scsih_tm_flag(ioc, handle, 0);
goto err_out;
}
}
@@ -2465,7 +2438,7 @@ mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint channel,
break;
}
- mpt2sas_scsih_clear_tm_flag(ioc, handle);
+ mpt2sas_scsih_tm_flag(ioc, handle, 0);
ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
if (m_type = TM_MUTEX_ON)
mutex_unlock(&ioc->tm_cmds.mutex);
--
1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Quentin Lambert <lambert.quentin@gmail.com>
To: joe@perches.com
Cc: Nagalakshmi Nandigama <nagalakshmi.nandigama@avagotech.com>,
Praveen Krishnamoorthy <praveen.krishnamoorthy@avagotech.com>,
Sreekanth Reddy <sreekanth.reddy@avagotech.com>,
Abhijit Mahajan <abhijit.mahajan@avagotech.com>,
"James E.J. Bottomley" <JBottomley@parallels.com>,
MPT-FusionLinux.pdl@avagotech.com, linux-scsi@vger.kernel.org,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/3] [SCSI] mpt2sas: Merge two similar functions
Date: Fri, 19 Dec 2014 13:38:58 +0100 [thread overview]
Message-ID: <20141219123858.GA20271@sloth> (raw)
mpt2sas_scsih_set_tm_flag and mpt2sas_scsih_clear_tm_flag
shared a lot of code. Therefore, they are merged into one
function whose behaviour is given by a new parameter
named action.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
---
drivers/scsi/mpt2sas/mpt2sas_scsih.c | 43 +++++++-----------------------------
1 file changed, 8 insertions(+), 35 deletions(-)
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index 6a1c036..a6f89fd 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -2253,14 +2253,15 @@ _scsih_tm_done(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
}
/**
- * mpt2sas_scsih_set_tm_flag - set per target tm_busy
+ * mpt2sas_scsih_tm_flag - set/clear per target tm_busy
* @ioc: per adapter object
* @handle: device handle
+ * @action: 1 set per target tm_busy, 0 clear per target tm_busy
*
* During taskmangement request, we need to freeze the device queue.
*/
void
-mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle)
+mpt2sas_scsih_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 action)
{
struct MPT2SAS_DEVICE *sas_device_priv_data;
struct scsi_device *sdev;
@@ -2273,37 +2274,9 @@ mpt2sas_scsih_set_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle)
if (!sas_device_priv_data)
continue;
if (sas_device_priv_data->sas_target->handle == handle) {
- sas_device_priv_data->sas_target->tm_busy = 1;
+ sas_device_priv_data->sas_target->tm_busy = action;
skip = 1;
- ioc->ignore_loginfos = 1;
- }
- }
-}
-
-/**
- * mpt2sas_scsih_clear_tm_flag - clear per target tm_busy
- * @ioc: per adapter object
- * @handle: device handle
- *
- * During taskmangement request, we need to freeze the device queue.
- */
-void
-mpt2sas_scsih_clear_tm_flag(struct MPT2SAS_ADAPTER *ioc, u16 handle)
-{
- struct MPT2SAS_DEVICE *sas_device_priv_data;
- struct scsi_device *sdev;
- u8 skip = 0;
-
- shost_for_each_device(sdev, ioc->shost) {
- if (skip)
- continue;
- sas_device_priv_data = sdev->hostdata;
- if (!sas_device_priv_data)
- continue;
- if (sas_device_priv_data->sas_target->handle == handle) {
- sas_device_priv_data->sas_target->tm_busy = 0;
- skip = 1;
- ioc->ignore_loginfos = 0;
+ ioc->ignore_loginfos = action;
}
}
}
@@ -2401,7 +2374,7 @@ mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint channel,
mpi_request->TaskType = type;
mpi_request->TaskMID = cpu_to_le16(smid_task);
int_to_scsilun(lun, (struct scsi_lun *)mpi_request->LUN);
- mpt2sas_scsih_set_tm_flag(ioc, handle);
+ mpt2sas_scsih_tm_flag(ioc, handle, 1);
init_completion(&ioc->tm_cmds.done);
mpt2sas_base_put_smid_hi_priority(ioc, smid);
timeleft = wait_for_completion_timeout(&ioc->tm_cmds.done, timeout*HZ);
@@ -2415,7 +2388,7 @@ mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint channel,
FORCE_BIG_HAMMER);
rc = (!rc) ? SUCCESS : FAILED;
ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
- mpt2sas_scsih_clear_tm_flag(ioc, handle);
+ mpt2sas_scsih_tm_flag(ioc, handle, 0);
goto err_out;
}
}
@@ -2465,7 +2438,7 @@ mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint channel,
break;
}
- mpt2sas_scsih_clear_tm_flag(ioc, handle);
+ mpt2sas_scsih_tm_flag(ioc, handle, 0);
ioc->tm_cmds.status = MPT2_CMD_NOT_USED;
if (m_type == TM_MUTEX_ON)
mutex_unlock(&ioc->tm_cmds.mutex);
--
1.9.1
next reply other threads:[~2014-12-19 12:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-19 12:38 Quentin Lambert [this message]
2014-12-19 12:38 ` [PATCH v2 1/3] [SCSI] mpt2sas: Merge two similar functions Quentin Lambert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141219123858.GA20271@sloth \
--to=lambert.quentin@gmail.com \
--cc=JBottomley@parallels.com \
--cc=MPT-FusionLinux.pdl@avagotech.com \
--cc=abhijit.mahajan@avagotech.com \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=nagalakshmi.nandigama@avagotech.com \
--cc=praveen.krishnamoorthy@avagotech.com \
--cc=sreekanth.reddy@avagotech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.