Re: [PATCH v2] scsi: ufs-exynos: use devm_platform_ioremap_resource_byname()

From: Geert Uytterhoeven
Date: Thu Nov 12 2020 - 09:06:32 EST


Hi Bean,

On Wed, Sep 16, 2020 at 10:43 AM Bean Huo <huobean@xxxxxxxxx> wrote:
> From: Bean Huo <beanhuo@xxxxxxxxxx>
>
> Use devm_platform_ioremap_resource_byname() to simplify the code.
>
> Signed-off-by: Bean Huo <beanhuo@xxxxxxxxxx>

Thanks for your patch, which is now commit 2dd39fad92a1f25f ("scsi: ufs:
ufs-exynos: Use devm_platform_ioremap_resource_byname()") in v5.10-rc1.

> --- a/drivers/scsi/ufs/ufs-exynos.c
> +++ b/drivers/scsi/ufs/ufs-exynos.c
> @@ -940,7 +940,6 @@ static int exynos_ufs_init(struct ufs_hba *hba)
> struct device *dev = hba->dev;
> struct platform_device *pdev = to_platform_device(dev);
> struct exynos_ufs *ufs;
> - struct resource *res;
> int ret;
>
> ufs = devm_kzalloc(dev, sizeof(*ufs), GFP_KERNEL);
> @@ -948,24 +947,21 @@ static int exynos_ufs_init(struct ufs_hba *hba)
> return -ENOMEM;
>
> /* exynos-specific hci */
> - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vs_hci");
> - ufs->reg_hci = devm_ioremap_resource(dev, res);
> + ufs->reg_hci = devm_platform_ioremap_resource_byname(pdev, "vs_hci");

Are you sure this is equivalent?
Before, devm_ioremap_resource() was called on "dev" (hba->dev),
after it is called on "&pdev->dev" .

> if (IS_ERR(ufs->reg_hci)) {
> dev_err(dev, "cannot ioremap for hci vendor register\n");
> return PTR_ERR(ufs->reg_hci);
> }
>
> /* unipro */
> - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "unipro");
> - ufs->reg_unipro = devm_ioremap_resource(dev, res);
> + ufs->reg_unipro = devm_platform_ioremap_resource_byname(pdev, "unipro");
> if (IS_ERR(ufs->reg_unipro)) {
> dev_err(dev, "cannot ioremap for unipro register\n");
> return PTR_ERR(ufs->reg_unipro);
> }
>
> /* ufs protector */
> - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ufsp");
> - ufs->reg_ufsp = devm_ioremap_resource(dev, res);
> + ufs->reg_ufsp = devm_platform_ioremap_resource_byname(pdev, "ufsp");
> if (IS_ERR(ufs->reg_ufsp)) {
> dev_err(dev, "cannot ioremap for ufs protector register\n");
> return PTR_ERR(ufs->reg_ufsp);

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds