mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Garry <john.garry@huawei.com>
To: <jejb@linux.vnet.ibm.com>, <martin.petersen@oracle.com>
Cc: <linuxarm@huawei.com>, <john.garry2@mail.dcu.ie>,
	<linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<zhangfei.gao@linaro.org>, John Garry <john.garry@huawei.com>,
	Xiang Chen <chenxiang66@hisilicon.com>
Subject: [PATCH 01/23] scsi: hisi_sas: add to_hisi_sas_port()
Date: Thu, 23 Mar 2017 01:25:17 +0800	[thread overview]
Message-ID: <1490203539-228029-2-git-send-email-john.garry@huawei.com> (raw)
In-Reply-To: <1490203539-228029-1-git-send-email-john.garry@huawei.com>

Introduce function to get hisi_sas_port from
asd_sas_port.

Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
 drivers/scsi/hisi_sas/hisi_sas.h       |  2 ++
 drivers/scsi/hisi_sas/hisi_sas_main.c  | 17 +++++++++++++----
 drivers/scsi/hisi_sas/hisi_sas_v1_hw.c |  4 +++-
 drivers/scsi/hisi_sas/hisi_sas_v2_hw.c |  6 ++++--
 4 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index 9216dea..a018a8a 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -346,6 +346,8 @@ struct hisi_sas_command_table_ssp {
 	struct hisi_sas_command_table_smp smp;
 	struct hisi_sas_command_table_stp stp;
 };
+
+extern struct hisi_sas_port *to_hisi_sas_port(struct asd_sas_port *sas_port);
 extern int hisi_sas_probe(struct platform_device *pdev,
 			  const struct hisi_sas_hw *ops);
 extern int hisi_sas_remove(struct platform_device *pdev);
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 53637a9..11f32d2 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -27,6 +27,12 @@ static struct hisi_hba *dev_to_hisi_hba(struct domain_device *device)
 	return device->port->ha->lldd_ha;
 }
 
+struct hisi_sas_port *to_hisi_sas_port(struct asd_sas_port *sas_port)
+{
+	return container_of(sas_port, struct hisi_sas_port, sas_port);
+}
+EXPORT_SYMBOL_GPL(to_hisi_sas_port);
+
 static void hisi_sas_slot_index_clear(struct hisi_hba *hisi_hba, int slot_idx)
 {
 	void *bitmap = hisi_hba->slot_index_tags;
@@ -178,10 +184,11 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba,
 	struct hisi_sas_port *port;
 	struct hisi_sas_slot *slot;
 	struct hisi_sas_cmd_hdr	*cmd_hdr_base;
+	struct asd_sas_port *sas_port = device->port;
 	struct device *dev = &hisi_hba->pdev->dev;
 	int dlvry_queue_slot, dlvry_queue, n_elem = 0, rc, slot_idx;
 
-	if (!device->port) {
+	if (!sas_port) {
 		struct task_status_struct *ts = &task->task_status;
 
 		ts->resp = SAS_TASK_UNDELIVERED;
@@ -206,7 +213,8 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba,
 		rc = SAS_PHY_DOWN;
 		return rc;
 	}
-	port = device->port->lldd_port;
+
+	port = to_hisi_sas_port(sas_port);
 	if (port && !port->port_attached) {
 		dev_info(dev, "task prep: %s port%d not attach device\n",
 			 (sas_protocol_ata(task->task_proto)) ?
@@ -545,7 +553,7 @@ static void hisi_sas_port_notify_formed(struct asd_sas_phy *sas_phy)
 	struct hisi_hba *hisi_hba = sas_ha->lldd_ha;
 	struct hisi_sas_phy *phy = sas_phy->lldd_phy;
 	struct asd_sas_port *sas_port = sas_phy->port;
-	struct hisi_sas_port *port = &hisi_hba->port[phy->port_id];
+	struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
 	unsigned long flags;
 
 	if (!sas_port)
@@ -990,13 +998,14 @@ static int hisi_sas_query_task(struct sas_task *task)
 	struct device *dev = &hisi_hba->pdev->dev;
 	struct hisi_sas_port *port;
 	struct hisi_sas_slot *slot;
+	struct asd_sas_port *sas_port = device->port;
 	struct hisi_sas_cmd_hdr *cmd_hdr_base;
 	int dlvry_queue_slot, dlvry_queue, n_elem = 0, rc, slot_idx;
 
 	if (!device->port)
 		return -1;
 
-	port = device->port->lldd_port;
+	port = to_hisi_sas_port(sas_port);
 
 	/* simply get a slot and send abort command */
 	rc = hisi_sas_slot_index_alloc(hisi_hba, &slot_idx);
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
index 854fbea..022ad10 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c
@@ -508,6 +508,8 @@ static void setup_itct_v1_hw(struct hisi_hba *hisi_hba,
 	struct device *dev = &hisi_hba->pdev->dev;
 	u64 qw0, device_id = sas_dev->device_id;
 	struct hisi_sas_itct *itct = &hisi_hba->itct[device_id];
+	struct asd_sas_port *sas_port = device->port;
+	struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
 
 	memset(itct, 0, sizeof(*itct));
 
@@ -528,7 +530,7 @@ static void setup_itct_v1_hw(struct hisi_hba *hisi_hba,
 		(1 << ITCT_HDR_AWT_CONTROL_OFF) |
 		(device->max_linkrate << ITCT_HDR_MAX_CONN_RATE_OFF) |
 		(1 << ITCT_HDR_VALID_LINK_NUM_OFF) |
-		(device->port->id << ITCT_HDR_PORT_ID_OFF));
+		(port->id << ITCT_HDR_PORT_ID_OFF));
 	itct->qw0 = cpu_to_le64(qw0);
 
 	/* qw1 */
diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
index 1b21445..1590e2f 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c
@@ -676,7 +676,8 @@ static void setup_itct_v2_hw(struct hisi_hba *hisi_hba,
 	u64 qw0, device_id = sas_dev->device_id;
 	struct hisi_sas_itct *itct = &hisi_hba->itct[device_id];
 	struct domain_device *parent_dev = device->parent;
-	struct hisi_sas_port *port = device->port->lldd_port;
+	struct asd_sas_port *sas_port = device->port;
+	struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
 
 	memset(itct, 0, sizeof(*itct));
 
@@ -1920,7 +1921,8 @@ static int prep_ata_v2_hw(struct hisi_hba *hisi_hba,
 	struct domain_device *parent_dev = device->parent;
 	struct hisi_sas_device *sas_dev = device->lldd_dev;
 	struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr;
-	struct hisi_sas_port *port = device->port->lldd_port;
+	struct asd_sas_port *sas_port = device->port;
+	struct hisi_sas_port *port = to_hisi_sas_port(sas_port);
 	u8 *buf_cmd;
 	int has_data = 0, rc = 0, hdr_tag = 0;
 	u32 dw1 = 0, dw2 = 0;
-- 
1.9.1

  reply	other threads:[~2017-03-22 16:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-22 17:25 [PATCH 00/23] hisi_sas: error handling and other misc fixes and improvements John Garry
2017-03-22 17:25 ` John Garry [this message]
2017-03-22 17:25 ` [PATCH 02/23] scsi: hisi_sas: add controller reset John Garry
2017-03-22 17:25 ` [PATCH 03/23] scsi: hisi_sas: move PHY init to hisi_sas_scan_start() John Garry
2017-03-22 17:25 ` [PATCH 04/23] scsi: hisi_sas: add softreset function for SATA disk John Garry
2017-03-22 17:25 ` [PATCH 05/23] scsi: hisi_sas: remove hisi_sas_port_deformed() John Garry
2017-03-22 17:25 ` [PATCH 06/23] scsi: hisi_sas: error hisi_sas_task_prep() when port down John Garry
2017-03-22 17:25 ` [PATCH 07/23] scsi: hisi_sas: only reset link for PHY_FUNC_LINK_RESET John Garry
2017-03-22 17:25 ` [PATCH 08/23] scsi: hisi_sas: modify error handling for v2 hw John Garry
2017-03-22 17:25 ` [PATCH 09/23] scsi: hisi_sas: modify hisi_sas_abort_task() for SSP John Garry
2017-03-22 17:25 ` [PATCH 10/23] scsi: hisi_sas: hardreset for SATA disk in LU reset John Garry
2017-03-22 17:25 ` [PATCH 11/23] scsi: hisi_sas: check for SAS_TASK_STATE_ABORTED in slot complete John Garry
2017-03-22 17:25 ` [PATCH 12/23] scsi: hisi_sas: free slots after hardreset John Garry
2017-03-22 17:25 ` [PATCH 13/23] scsi: hisi_sas: fix some sas_task.task_state_lock locking John Garry
2017-03-22 17:25 ` [PATCH 14/23] scsi: hisi_sas: remove task free'ing for timeouts John Garry
2017-03-22 17:25 ` [PATCH 15/23] scsi: hisi_sas: process error codes according to their priority John Garry
2017-03-22 17:25 ` [PATCH 16/23] scsi: hisi_sas: some modifications to v2 hw reg init values John Garry
2017-03-22 17:25 ` [PATCH 17/23] scsi: hisi_sas: handle PHY UP+DOWN simultaneous irq John Garry
2017-03-22 17:25 ` [PATCH 18/23] scsi: hisi_sas: rename hisi_sas_link_timeout_{enable, disable}_link John Garry
2017-03-22 17:25 ` [PATCH 19/23] scsi: hisi_sas: add hisi_sas_clear_nexus_ha() John Garry
2017-03-22 17:25 ` [PATCH 20/23] scsi: hisi_sas: release SMP slot in lldd_abort_task John Garry
2017-03-22 17:25 ` [PATCH 21/23] scsi: hisi_sas: check hisi_sas_lu_reset() error message John Garry
2017-03-22 17:25 ` [PATCH 22/23] scsi: hisi_sas: use dev_is_sata to identify SATA or SAS disk John Garry
2017-03-22 17:25 ` [PATCH 23/23] scsi: hisi_sas: add is_sata_phy_v2_hw() John Garry
2017-03-23 15:12 ` [PATCH 00/23] hisi_sas: error handling and other misc fixes and improvements Martin K. Petersen

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=1490203539-228029-2-git-send-email-john.garry@huawei.com \
    --to=john.garry@huawei.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=john.garry2@mail.dcu.ie \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=martin.petersen@oracle.com \
    --cc=zhangfei.gao@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®