Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1244819

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

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH 07/25] scsi: hisi_sas: add ioremap for device HW
Date 2015-10-12 17:30 +0200
Message-ID <qiNd1-2Xu-35@gated-at.bofh.it> (permalink)
References <qiN3k-2LY-27@gated-at.bofh.it> <qiNd1-2Xu-37@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 07/25] scsi: hisi_sas: add ioremap for device HW Arnd Bergmann <arnd@arndb.de> - 2015-10-12 17:30 +0200
  Re: [PATCH 07/25] scsi: hisi_sas: add ioremap for device HW zhangfei <zhangfei.gao@linaro.org> - 2015-10-13 11:50 +0200
    Re: [PATCH 07/25] scsi: hisi_sas: add ioremap for device HW Arnd Bergmann <arnd@arndb.de> - 2015-10-13 14:30 +0200
      Re: [PATCH 07/25] scsi: hisi_sas: add ioremap for device HW zhangfei <zhangfei.gao@linaro.org> - 2015-10-13 17:10 +0200

csiph-web