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

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

 





On 10/12/2015 11:21 PM, Arnd Bergmann wrote:
On Monday 12 October 2015 23:20:19 John Garry wrote:
+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[] = {


Better use devm_ioremap_resource() here, which registers the resource so they
are checked for conflicts and listed in /proc/iomem.


Yes, hisi_hba->regs can use devm_ioremap_resource.

However ctrl_regs have to use devm_ioremap, since the address are sharing among different nodes, unfortunately, and devm_ioremap_resource will fail.

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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