diff mbox

[07/25] scsi: hisi_sas: add ioremap for device HW

Message ID 1444663237-238302-8-git-send-email-john.garry@huawei.com
State New
Headers show

Commit Message

John Garry Oct. 12, 2015, 3:20 p.m. UTC
This includes registers for core SAS controllers
and also SAS control registers.

Signed-off-by: John Garry <john.garry@huawei.com>
---
 drivers/scsi/hisi_sas/hisi_sas.h      |  2 ++
 drivers/scsi/hisi_sas/hisi_sas_init.c | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

Comments

kernel test robot Oct. 12, 2015, 5:18 p.m. UTC | #1
Hi John,

[auto build test WARNING on scsi/for-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/John-Garry/HiSilicon-SAS-driver/20151012-231929
reproduce:
        # apt-get install sparse
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/scsi/hisi_sas/hisi_sas_init.c:198:5: sparse: symbol 'hisi_sas_ioremap' was not declared. Should it be static?

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index 929c513..5f72d98 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -69,6 +69,8 @@  struct hisi_hba {
 
 	struct platform_device *pdev;
 
+	void __iomem *regs;
+	void __iomem *ctrl_regs;
 
 	u8 sas_addr[SAS_ADDR_SIZE];
 
diff --git a/drivers/scsi/hisi_sas/hisi_sas_init.c b/drivers/scsi/hisi_sas/hisi_sas_init.c
index 38b9ed2..8f1e856 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_init.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_init.c
@@ -195,6 +195,28 @@  static void hisi_sas_free(struct hisi_hba *hisi_hba)
 				  hisi_hba->sata_breakpoint_dma);
 }
 
+int hisi_sas_ioremap(struct hisi_hba *hisi_hba)
+{
+	struct platform_device *pdev = hisi_hba->pdev;
+	struct device *dev = &pdev->dev;
+	struct resource *res;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	hisi_hba->regs = devm_ioremap(dev,
+				      res->start,
+				      resource_size(res));
+	if (!hisi_hba->regs)
+		return -ENOMEM;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	hisi_hba->ctrl_regs = devm_ioremap(dev,
+					   res->start,
+					   resource_size(res));
+	if (!hisi_hba->ctrl_regs)
+		return -ENOMEM;
+
+	return 0;
+}
 
 static const struct of_device_id sas_of_match[] = {
 	{ .compatible = "hisilicon,sas-controller-v1",},
@@ -241,6 +263,9 @@  static struct hisi_hba *hisi_sas_hba_alloc(
 
 	hisi_hba->shost = shost;
 
+	if (hisi_sas_ioremap(hisi_hba))
+		goto err_out;
+
 	if (hisi_sas_alloc(hisi_hba, shost)) {
 		hisi_sas_free(hisi_hba);
 		goto err_out;