Skip to contentSkip to conversation

scsi: ufs-exynos: use devm_platform_ioremap_resource_byname()

PATCH Applied Bean Huo 4 participants 6 messages Sep 16, 2020 – Nov 12, 2020

Subsystems (2)
lore
Share & tools
lore

Bean Huo

author
#0 lore raw

PATCH v2 1/1 scsi: ufs-exynos: use devm_platform_ioremap_resource_byname()

From: Bean Huo <[email protected]>

Use devm_platform_ioremap_resource_byname() to simplify the code.

---

v1-v2: change the patch commit subject

---
 drivers/scsi/ufs/ufs-exynos.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/scsi/ufs/ufs-exynos.c +3 -7
index 8f1b6f61a776..1eecbe550536 100644
@@ -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");
 	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);
Signature · 1 line
2.17.1
reviewer Acked-by on v2 1/1
#1 lore raw

Hi Bean,

Quoted 12 lines

-----Original Message-----
From: Bean Huo <[email protected]>
Sent: 16 September 2020 14:10
To: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]
Subject: [PATCH v2] scsi: ufs-exynos: use devm_platform_ioremap_resource_byname()

Quoted 6 lines

From: Bean Huo <[email protected]>

Use devm_platform_ioremap_resource_byname() to simplify the code.

---

Thanks!

Quoted 3 lines

v1-v2: change the patch commit subject

#2 lore raw
In reply to Bean Huo

Bean,

Quoted 1 line

Use devm_platform_ioremap_resource_byname() to simplify the code.

Applied to 5.10/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#4 lore raw
In reply to Bean Huo

Hi Bean,

Quoted 5 lines · Bean Huo

From: Bean Huo <[email protected]>

Use devm_platform_ioremap_resource_byname() to simplify the code.

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

Quoted 11 lines
drivers/scsi/ufs/ufs-exynos.c +0 -1
@@ -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);

drivers/scsi/ufs/ufs-exynos.c static int exynos_ufs_init(struct ufs_hba *hba) · line 950

Quoted 6 lines
drivers/scsi/ufs/ufs-exynos.c +1 -2
@@ -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" .

Quoted 11 lines
drivers/scsi/ufs/ufs-exynos.c +1 -2
        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");

drivers/scsi/ufs/ufs-exynos.c static int exynos_ufs_init(struct ufs_hba *hba) · line 967

Quoted 10 lines
drivers/scsi/ufs/ufs-exynos.c +1 -2
                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

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
#5 lore raw

Hi Bean,

Quoted 23 lines · Geert Uytterhoeven
Quoted 5 lines · Bean Huo

From: Bean Huo <[email protected]>

Use devm_platform_ioremap_resource_byname() to simplify the code.

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

Quoted 13 lines
drivers/scsi/ufs/ufs-exynos.c +0 -1
@@ -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;
 
Quoted 8 lines

drivers/scsi/ufs/ufs-exynos.c static int exynos_ufs_init(struct ufs_hba *hba) · line 950

Quoted 4 lines
drivers/scsi/ufs/ufs-exynos.c +1 -2
        /* 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" .

Yes it is, due to:

    struct platform_device *pdev = to_platform_device(dev);

Sorry for the noise.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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