Skip to contentSkip to conversation

drivers: gpio: 74xx-mmio: use devm_platform_ioremap_resource()

PATCH In review Enrico Weigelt, metux IT consult 14 participants 117 messages Mar 11, 2019 – Apr 3, 2019

Subsystems (19)
lore
Share & tools
lore
#0 lore raw

PATCH 1/42 drivers: gpio: 74xx-mmio: use devm_platform_ioremap_resource()

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-74xx-mmio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-74xx-mmio.c +1 -3
index 49616ec..0424707 100644
@@ -106,7 +106,6 @@ static int mmio_74xx_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
 static int mmio_74xx_gpio_probe(struct platform_device *pdev)
 {
 	struct mmio_74xx_gpio_priv *priv;
-	struct resource *res;
 	void __iomem *dat;
 	int err;
 
@@ -116,8 +115,7 @@ static int mmio_74xx_gpio_probe(struct platform_device *pdev)
 
 	priv->flags = (uintptr_t)of_device_get_match_data(&pdev->dev);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dat = devm_ioremap_resource(&pdev->dev, res);
+	dat = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dat))
 		return PTR_ERR(dat);
 
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/42 drivers: gpio: amdpt: use devm_platform_ioremap_resource()

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-amdpt.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpio/gpio-amdpt.c +1 -7
index 9b78dc8..1ffd7c2 100644
@@ -78,7 +78,6 @@ static int pt_gpio_probe(struct platform_device *pdev)
 	struct acpi_device *acpi_dev;
 	acpi_handle handle = ACPI_HANDLE(dev);
 	struct pt_gpio_chip *pt_gpio;
-	struct resource *res_mem;
 	int ret = 0;
 
 	if (acpi_bus_get_device(handle, &acpi_dev)) {
@@ -90,12 +89,7 @@ static int pt_gpio_probe(struct platform_device *pdev)
 	if (!pt_gpio)
 		return -ENOMEM;
 
-	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res_mem) {
-		dev_err(&pdev->dev, "Failed to get MMIO resource for PT GPIO.\n");
-		return -EINVAL;
-	}
-	pt_gpio->reg_base = devm_ioremap_resource(dev, res_mem);
+	pt_gpio->reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pt_gpio->reg_base)) {
 		dev_err(&pdev->dev, "Failed to map MMIO resource for PT GPIO.\n");
 		return PTR_ERR(pt_gpio->reg_base);
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/42 drivers: gpio: amdpt: drop unneeded deref of &pdev->dev

In reply to Enrico Weigelt, metux IT consult

We already have the struct device* pointer in a local variable, so we can write this a bit shorter.

---
 drivers/gpio/gpio-amdpt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpio/gpio-amdpt.c +5 -5
index 1ffd7c2..3220f3c 100644
@@ -91,7 +91,7 @@ static int pt_gpio_probe(struct platform_device *pdev)
 
 	pt_gpio->reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pt_gpio->reg_base)) {
-		dev_err(&pdev->dev, "Failed to map MMIO resource for PT GPIO.\n");
+		dev_err(dev, "Failed to map MMIO resource for PT GPIO.\n");
 		return PTR_ERR(pt_gpio->reg_base);
 	}
 
@@ -101,7 +101,7 @@ static int pt_gpio_probe(struct platform_device *pdev)
 			 pt_gpio->reg_base + PT_DIRECTION_REG, NULL,
 			 BGPIOF_READ_OUTPUT_REG_SET);
 	if (ret) {
-		dev_err(&pdev->dev, "bgpio_init failed\n");
+		dev_err(dev, "bgpio_init failed\n");
 		return ret;
 	}
 
@@ -110,11 +110,11 @@ static int pt_gpio_probe(struct platform_device *pdev)
 	pt_gpio->gc.free             = pt_gpio_free;
 	pt_gpio->gc.ngpio            = PT_TOTAL_GPIO;
 #if defined(CONFIG_OF_GPIO)
-	pt_gpio->gc.of_node          = pdev->dev.of_node;
+	pt_gpio->gc.of_node          = dev.of_node;
 #endif
 	ret = gpiochip_add_data(&pt_gpio->gc, pt_gpio);
 	if (ret) {
-		dev_err(&pdev->dev, "Failed to register GPIO lib\n");
+		dev_err(dev, "Failed to register GPIO lib\n");
 		return ret;
 	}
 
@@ -124,7 +124,7 @@ static int pt_gpio_probe(struct platform_device *pdev)
 	writel(0, pt_gpio->reg_base + PT_SYNC_REG);
 	writel(0, pt_gpio->reg_base + PT_CLOCKRATE_REG);
 
-	dev_dbg(&pdev->dev, "PT GPIO driver loaded\n");
+	dev_dbg(dev, "PT GPIO driver loaded\n");
 	return ret;
 }
 
Signature · 1 line
1.9.1
#4 lore raw

Re: [PATCH 03/42] drivers: gpio: amdpt: drop unneeded deref of &pdev->dev

Quoted 31 lines · metux IT consult

We already have the struct device* pointer in a local variable, so we can write this a bit shorter.

---
 drivers/gpio/gpio-amdpt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpio/gpio-amdpt.c +2 -2
index 1ffd7c2..3220f3c 100644
@@ -91,7 +91,7 @@ static int pt_gpio_probe(struct platform_device *pdev)
 
 	pt_gpio->reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(pt_gpio->reg_base)) {
-		dev_err(&pdev->dev, "Failed to map MMIO resource for PT GPIO.\n");
+		dev_err(dev, "Failed to map MMIO resource for PT GPIO.\n");
 		return PTR_ERR(pt_gpio->reg_base);
 	}
 
@@ -101,7 +101,7 @@ static int pt_gpio_probe(struct platform_device *pdev)
 			 pt_gpio->reg_base + PT_DIRECTION_REG, NULL,
 			 BGPIOF_READ_OUTPUT_REG_SET);
 	if (ret) {
-		dev_err(&pdev->dev, "bgpio_init failed\n");
+		dev_err(dev, "bgpio_init failed\n");
 		return ret;
 	}
 

drivers/gpio/gpio-amdpt.c static int pt_gpio_probe(struct platform_device *pdev) · line 113

Quoted 5 lines
drivers/gpio/gpio-amdpt.c +1 -1
@@ -110,11 +110,11 @@ static int pt_gpio_probe(struct platform_device *pdev)
 	pt_gpio->gc.free             = pt_gpio_free;
 	pt_gpio->gc.ngpio            = PT_TOTAL_GPIO;
 #if defined(CONFIG_OF_GPIO)
-	pt_gpio->gc.of_node          = pdev->dev.of_node;
+	pt_gpio->gc.of_node          = dev.of_node;

"dev->of_node"?

Thierry

#5 lore raw

Re: [PATCH 03/42] drivers: gpio: amdpt: drop unneeded deref of &pdev->dev

In reply to Enrico Weigelt, metux IT consult
Quoted 4 lines · metux IT consult

We already have the struct device* pointer in a local variable, so we can write this a bit shorter.

Thierry seems to have spotted a bug in this patch so please resend it fixed (I will apply some others though so no need to resend all).

Yours,
Linus Walleij

#6 lore raw

PATCH 4/42 drivers: gpio: aspeed: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-aspeed.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-aspeed.c +1 -3
index 854bce4..44aa843 100644
@@ -1156,15 +1156,13 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
 {
 	const struct of_device_id *gpio_id;
 	struct aspeed_gpio *gpio;
-	struct resource *res;
 	int rc, i, banks;
 
 	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
 	if (!gpio)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	gpio->base = devm_ioremap_resource(&pdev->dev, res);
+	gpio->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(gpio->base))
 		return PTR_ERR(gpio->base);
 
Signature · 1 line
1.9.1
#8 lore raw

PATCH 5/42 drivers: gpio: bcm-kona: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-bcm-kona.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-bcm-kona.c +1 -3
index c5536a5..9fa6d3a 100644
@@ -568,7 +568,6 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	const struct of_device_id *match;
-	struct resource *res;
 	struct bcm_kona_gpio_bank *bank;
 	struct bcm_kona_gpio *kona_gpio;
 	struct gpio_chip *chip;
@@ -618,8 +617,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	kona_gpio->reg_base = devm_ioremap_resource(dev, res);
+	kona_gpio->reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(kona_gpio->reg_base)) {
 		ret = -ENXIO;
 		goto err_irq_domain;
Signature · 1 line
1.9.1
Reviewed-by on v1 5/42
#9 lore raw

Re: [PATCH 05/42] drivers: gpio: bcm-kona: use devm_platform_ioremap_resource()

Quoted 21 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-bcm-kona.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-bcm-kona.c +0 -1
index c5536a5..9fa6d3a 100644
@@ -568,7 +568,6 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	const struct of_device_id *match;
-	struct resource *res;
 	struct bcm_kona_gpio_bank *bank;
 	struct bcm_kona_gpio *kona_gpio;
 	struct gpio_chip *chip;

drivers/gpio/gpio-bcm-kona.c static int bcm_kona_gpio_probe(struct platform_device *pdev) · line 620

Quoted 6 lines
drivers/gpio/gpio-bcm-kona.c +1 -2
@@ -618,8 +617,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	kona_gpio->reg_base = devm_ioremap_resource(dev, res);
+	kona_gpio->reg_base = devm_platform_ioremap_resource(pdev, 0);
Signature · 1 line
Florian
#10 lore raw

Re: [PATCH 05/42] drivers: gpio: bcm-kona: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult
Quoted 21 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-bcm-kona.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-bcm-kona.c +0 -1
index c5536a5..9fa6d3a 100644
@@ -568,7 +568,6 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	const struct of_device_id *match;
-	struct resource *res;
 	struct bcm_kona_gpio_bank *bank;
 	struct bcm_kona_gpio *kona_gpio;
 	struct gpio_chip *chip;

drivers/gpio/gpio-bcm-kona.c static int bcm_kona_gpio_probe(struct platform_device *pdev) · line 622

Quoted 8 lines
drivers/gpio/gpio-bcm-kona.c +1 -2
@@ -618,8 +617,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	kona_gpio->reg_base = devm_ioremap_resource(dev, res);
+	kona_gpio->reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(kona_gpio->reg_base)) {
 		ret = -ENXIO;

This should be

	ret = PTR_ERR(kona_gpio->reg_base)

, shouldn't it? (If yes, this is orthogonal to this patch, but still worth fixing.)

@Julia: Is this something that coccinelle could catch?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#12 lore raw

PATCH 6/42 drivers: gpio: cadence: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-cadence.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-cadence.c +1 -3
index aec8d5d..712ae21 100644
@@ -148,7 +148,6 @@ static void cdns_gpio_irq_handler(struct irq_desc *desc)
 static int cdns_gpio_probe(struct platform_device *pdev)
 {
 	struct cdns_gpio_chip *cgpio;
-	struct resource *res;
 	int ret, irq;
 	u32 dir_prev;
 	u32 num_gpios = 32;
@@ -157,8 +156,7 @@ static int cdns_gpio_probe(struct platform_device *pdev)
 	if (!cgpio)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	cgpio->regs = devm_ioremap_resource(&pdev->dev, res);
+	cgpio->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(cgpio->regs))
 		return PTR_ERR(cgpio->regs);
 
Signature · 1 line
1.9.1
#14 lore raw

PATCH 7/42 drivers: gpio: clps711x: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-clps711x.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpio/gpio-clps711x.c +2 -5
index 52fd63f..0fbbb0e 100644
@@ -19,7 +19,6 @@ static int clps711x_gpio_probe(struct platform_device *pdev)
 	struct device_node *np = pdev->dev.of_node;
 	void __iomem *dat, *dir;
 	struct gpio_chip *gc;
-	struct resource *res;
 	int err, id;
 
 	if (!np)
@@ -33,13 +32,11 @@ static int clps711x_gpio_probe(struct platform_device *pdev)
 	if (!gc)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	dat = devm_ioremap_resource(&pdev->dev, res);
+	dat = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(dat))
 		return PTR_ERR(dat);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	dir = devm_ioremap_resource(&pdev->dev, res);
+	dir = devm_platform_ioremap_resource(pdev, 1);
 	if (IS_ERR(dir))
 		return PTR_ERR(dir);
 
Signature · 1 line
1.9.1
#16 lore raw

PATCH 8/42 drivers: gpio: dwap: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-dwapb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-dwapb.c +1 -3
index 84ae044..d3eda65 100644
@@ -655,7 +655,6 @@ static void dwapb_gpio_unregister(struct dwapb_gpio *gpio)
 static int dwapb_gpio_probe(struct platform_device *pdev)
 {
 	unsigned int i;
-	struct resource *res;
 	struct dwapb_gpio *gpio;
 	int err;
 	struct device *dev = &pdev->dev;
@@ -688,8 +687,7 @@ static int dwapb_gpio_probe(struct platform_device *pdev)
 	if (!gpio->ports)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	gpio->regs = devm_ioremap_resource(&pdev->dev, res);
+	gpio->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(gpio->regs))
 		return PTR_ERR(gpio->regs);
 
Signature · 1 line
1.9.1
#18 lore raw

PATCH 9/42 drivers: gpio: sprd: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-eic-sprd.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpio/gpio-eic-sprd.c +2 -7
index f0223ce..c12de87 100644
@@ -567,7 +567,6 @@ static int sprd_eic_probe(struct platform_device *pdev)
 	const struct sprd_eic_variant_data *pdata;
 	struct gpio_irq_chip *irq;
 	struct sprd_eic *sprd_eic;
-	struct resource *res;
 	int ret, i;
 
 	pdata = of_device_get_match_data(&pdev->dev);
@@ -596,13 +595,9 @@ static int sprd_eic_probe(struct platform_device *pdev)
 		 * have one bank EIC, thus base[1] and base[2] can be
 		 * optional.
 		 */
-		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
-		if (!res)
-			continue;
-
-		sprd_eic->base[i] = devm_ioremap_resource(&pdev->dev, res);
+		sprd_eic->base[i] = devm_platform_ioremap_resource(pdev, 0);
 		if (IS_ERR(sprd_eic->base[i]))
-			return PTR_ERR(sprd_eic->base[i]);
+			continue;
 	}
 
 	sprd_eic->chip.label = sprd_eic_label_name[sprd_eic->type];
Signature · 1 line
1.9.1
#19 lore raw

Re: [PATCH 09/42] drivers: gpio: sprd: use devm_platform_ioremap_resource()

Quoted 22 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-eic-sprd.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpio/gpio-eic-sprd.c +0 -1
index f0223ce..c12de87 100644
@@ -567,7 +567,6 @@ static int sprd_eic_probe(struct platform_device *pdev)
        const struct sprd_eic_variant_data *pdata;
        struct gpio_irq_chip *irq;
        struct sprd_eic *sprd_eic;
-       struct resource *res;
        int ret, i;
 
        pdata = of_device_get_match_data(&pdev->dev);

drivers/gpio/gpio-eic-sprd.c static int sprd_eic_probe(struct platform_device *pdev) · line 598

Quoted 9 lines
drivers/gpio/gpio-eic-sprd.c +1 -5
@@ -596,13 +595,9 @@ static int sprd_eic_probe(struct platform_device *pdev)
                 * have one bank EIC, thus base[1] and base[2] can be
                 * optional.
                 */
-               res = platform_get_resource(pdev, IORESOURCE_MEM, i);
-               if (!res)
-                       continue;
-
-               sprd_eic->base[i] = devm_ioremap_resource(&pdev->dev, res);
+               sprd_eic->base[i] = devm_platform_ioremap_resource(pdev, 0);

This is incorrect, since we can have multiple IO resources, but you only get index 0.

Quoted 9 lines
drivers/gpio/gpio-eic-sprd.c +1 -2
                if (IS_ERR(sprd_eic->base[i]))
-                       return PTR_ERR(sprd_eic->base[i]);
+                       continue;
        }
 
        sprd_eic->chip.label = sprd_eic_label_name[sprd_eic->type];
--

1.9.1

Signature · 2 lines
Baolin Wang
Best Regards
#20 lore raw

Re: [PATCH 09/42] drivers: gpio: sprd: use devm_platform_ioremap_resource()

Quoted 22 lines · Baolin Wang
Quoted 20 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-eic-sprd.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpio/gpio-eic-sprd.c +0 -1
index f0223ce..c12de87 100644
@@ -567,7 +567,6 @@ static int sprd_eic_probe(struct platform_device *pdev)
        const struct sprd_eic_variant_data *pdata;
        struct gpio_irq_chip *irq;
        struct sprd_eic *sprd_eic;
-       struct resource *res;
        int ret, i;
 
Quoted 14 lines

drivers/gpio/gpio-eic-sprd.c static int sprd_eic_probe(struct platform_device *pdev) · line 598

Quoted 11 lines
drivers/gpio/gpio-eic-sprd.c +1 -5
        pdata = of_device_get_match_data(&pdev->dev);
@@ -596,13 +595,9 @@ static int sprd_eic_probe(struct platform_device *pdev)
                 * have one bank EIC, thus base[1] and base[2] can be
                 * optional.
                 */
-               res = platform_get_resource(pdev, IORESOURCE_MEM, i);
-               if (!res)
-                       continue;
-
-               sprd_eic->base[i] = devm_ioremap_resource(&pdev->dev, res);
+               sprd_eic->base[i] = devm_platform_ioremap_resource(pdev, 0);

This is incorrect, since we can have multiple IO resources, but you only get index 0.

ah, right, it has to be i instead of 0. thanks for pointing that out.

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#21 lore raw

Re: [PATCH 09/42] drivers: gpio: sprd: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult
Quoted 6 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-eic-sprd.c | 9 ++-------

Please fix the subject of this patch to gpio: eic-sprd: because gmail goes bananas with things that have the same subject line.

Yours,
Linus Walleij

#22 lore raw

PATCH 10/42 drivers: gpio: ep93xx: devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-ep93xx.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpio/gpio-ep93xx.c +2 -5
index 71728d6..52e9a7b2 100644
@@ -393,16 +393,13 @@ static int ep93xx_gpio_add_bank(struct gpio_chip *gc, struct device *dev,
 static int ep93xx_gpio_probe(struct platform_device *pdev)
 {
 	struct ep93xx_gpio *epg;
-	struct resource *res;
 	int i;
-	struct device *dev = &pdev->dev;
 
-	epg = devm_kzalloc(dev, sizeof(*epg), GFP_KERNEL);
+	epg = devm_kzalloc(&odev->dev, sizeof(*epg), GFP_KERNEL);
 	if (!epg)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	epg->base = devm_ioremap_resource(dev, res);
+	epg->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(epg->base))
 		return PTR_ERR(epg->base);
 
Signature · 1 line
1.9.1
#23 lore raw

Re: [PATCH 10/42] drivers: gpio: ep93xx: devm_platform_ioremap_resource()

Quoted 13 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-ep93xx.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpio/gpio-ep93xx.c +0 -0
index 71728d6..52e9a7b2 100644

drivers/gpio/gpio-ep93xx.c static int ep93xx_gpio_add_bank(struct gpio_chip *gc, struct device *dev, · line 398

Quoted 9 lines
drivers/gpio/gpio-ep93xx.c +1 -3
@@ -393,16 +393,13 @@ static int ep93xx_gpio_add_bank(struct gpio_chip *gc, struct device *dev,
 static int ep93xx_gpio_probe(struct platform_device *pdev)
 {
 	struct ep93xx_gpio *epg;
-	struct resource *res;
 	int i;
-	struct device *dev = &pdev->dev;
 
-	epg = devm_kzalloc(dev, sizeof(*epg), GFP_KERNEL);
+	epg = devm_kzalloc(&odev->dev, sizeof(*epg), GFP_KERNEL);

odev -> pdev

You should write some scripts to compile-test these changes. Compilers are good at catching these silly typos. Humans not so much.

Thierry

#24 lore raw

Re: [PATCH 10/42] drivers: gpio: ep93xx: devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult
Quoted 4 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

Skipping this patch for now because of the bug pointed out by Thierry, BTW rebase on my GPIO "devel" branch after I applied the uncontroversial patches (most of them are obviously correct).

I know it is not super easy to build all of those systems so cold coding is fine with me, I will find any remaining bugs for sure. :D

Yours,
Linus Walleij

#25 lore raw

PATCH 11/42 drivers: gpio: ftgpio010: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-ftgpio010.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-ftgpio010.c +1 -3
index 45fe125..8ff8ce2 100644
@@ -225,7 +225,6 @@ static int ftgpio_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
 static int ftgpio_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct resource *res;
 	struct ftgpio_gpio *g;
 	int irq;
 	int ret;
@@ -236,8 +235,7 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
 
 	g->dev = dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	g->base = devm_ioremap_resource(dev, res);
+	g->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(g->base))
 		return PTR_ERR(g->base);
 
Signature · 1 line
1.9.1
#27 lore raw

PATCH 12/42 drivers: gpio: grgpio: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-grgpio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-grgpio.c +1 -3
index 45b8d6a..09d3dac 100644
@@ -333,7 +333,6 @@ static int grgpio_probe(struct platform_device *ofdev)
 	void  __iomem *regs;
 	struct gpio_chip *gc;
 	struct grgpio_priv *priv;
-	struct resource *res;
 	int err;
 	u32 prop;
 	s32 *irqmap;
@@ -344,8 +343,7 @@ static int grgpio_probe(struct platform_device *ofdev)
 	if (!priv)
 		return -ENOMEM;
 
-	res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
-	regs = devm_ioremap_resource(&ofdev->dev, res);
+	regs = devm_platform_ioremap_resource(&ofdev, 0);
 	if (IS_ERR(regs))
 		return PTR_ERR(regs);
 
Signature · 1 line
1.9.1
#28 lore raw

Re: [PATCH 12/42] drivers: gpio: grgpio: use devm_platform_ioremap_resource()

Quoted 21 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-grgpio.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-grgpio.c +0 -1
index 45b8d6a..09d3dac 100644
@@ -333,7 +333,6 @@ static int grgpio_probe(struct platform_device *ofdev)
 	void  __iomem *regs;
 	struct gpio_chip *gc;
 	struct grgpio_priv *priv;
-	struct resource *res;
 	int err;
 	u32 prop;
 	s32 *irqmap;

drivers/gpio/gpio-grgpio.c static int grgpio_probe(struct platform_device *ofdev) · line 346

Quoted 6 lines
drivers/gpio/gpio-grgpio.c +1 -2
@@ -344,8 +343,7 @@ static int grgpio_probe(struct platform_device *ofdev)
 	if (!priv)
 		return -ENOMEM;
 
-	res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
-	regs = devm_ioremap_resource(&ofdev->dev, res);
+	regs = devm_platform_ioremap_resource(&ofdev, 0);

Drop the &?

Thierry

#30 lore raw

PATCH 13/42 drivers: gpio: hlwd: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-hlwd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-hlwd.c +1 -3
index a7b1789..e5fa00f 100644
@@ -208,7 +208,6 @@ static int hlwd_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type)
 static int hlwd_gpio_probe(struct platform_device *pdev)
 {
 	struct hlwd_gpio *hlwd;
-	struct resource *regs_resource;
 	u32 ngpios;
 	int res;
 
@@ -216,8 +215,7 @@ static int hlwd_gpio_probe(struct platform_device *pdev)
 	if (!hlwd)
 		return -ENOMEM;
 
-	regs_resource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	hlwd->regs = devm_ioremap_resource(&pdev->dev, regs_resource);
+	hlwd->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(hlwd->regs))
 		return PTR_ERR(hlwd->regs);
 
Signature · 1 line
1.9.1
#32 lore raw

PATCH 14/42 drivers: gpio: iop: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-iop.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-iop.c +1 -3
index 8d62db4..11b77d8 100644
@@ -21,7 +21,6 @@
 
 static int iop3xx_gpio_probe(struct platform_device *pdev)
 {
-	struct resource *res;
 	struct gpio_chip *gc;
 	void __iomem *base;
 	int err;
@@ -30,8 +29,7 @@ static int iop3xx_gpio_probe(struct platform_device *pdev)
 	if (!gc)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_ioremap_resource(&pdev->dev, res);
+	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 
Signature · 1 line
1.9.1
#34 lore raw

PATCH 15/42 drivers: gpio: janz-ttl: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-janz-ttl.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-janz-ttl.c +1 -3
index 6b9bf8b..b97a911 100644
@@ -147,7 +147,6 @@ static int ttl_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct ttl_module *mod;
 	struct gpio_chip *gpio;
-	struct resource *res;
 	int ret;
 
 	pdata = dev_get_platdata(&pdev->dev);
@@ -164,8 +163,7 @@ static int ttl_probe(struct platform_device *pdev)
 	spin_lock_init(&mod->lock);
 
 	/* get access to the MODULbus registers for this module */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	mod->regs = devm_ioremap_resource(dev, res);
+	mod->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mod->regs))
 		return PTR_ERR(mod->regs);
 
Signature · 1 line
1.9.1
#36 lore raw

PATCH 16/42 drivers: gpio: janz-ttl: drop unneccessary temp variable dev

In reply to Enrico Weigelt, metux IT consult

don't need the temporary variable "dev", directly use &pdev->dev

---
 drivers/gpio/gpio-janz-ttl.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpio/gpio-janz-ttl.c +4 -5
index b97a911..91f91f6 100644
@@ -144,18 +144,17 @@ static void ttl_setup_device(struct ttl_module *mod)
 static int ttl_probe(struct platform_device *pdev)
 {
 	struct janz_platform_data *pdata;
-	struct device *dev = &pdev->dev;
 	struct ttl_module *mod;
 	struct gpio_chip *gpio;
 	int ret;
 
 	pdata = dev_get_platdata(&pdev->dev);
 	if (!pdata) {
-		dev_err(dev, "no platform data\n");
+		dev_err(&pdev->dev, "no platform data\n");
 		return -ENXIO;
 	}
 
-	mod = devm_kzalloc(dev, sizeof(*mod), GFP_KERNEL);
+	mod = devm_kzalloc(&pdev->dev, sizeof(*mod), GFP_KERNEL);
 	if (!mod)
 		return -ENOMEM;
 
@@ -181,9 +180,9 @@ static int ttl_probe(struct platform_device *pdev)
 	gpio->base = -1;
 	gpio->ngpio = 20;
 
-	ret = devm_gpiochip_add_data(dev, gpio, NULL);
+	ret = devm_gpiochip_add_data(&pdev->dev, gpio, NULL);
 	if (ret) {
-		dev_err(dev, "unable to add GPIO chip\n");
+		dev_err(&pdev->dev, "unable to add GPIO chip\n");
 		return ret;
 	}
 
Signature · 1 line
1.9.1
#37 lore raw

Re: [PATCH 16/42] drivers: gpio: janz-ttl: drop unneccessary temp variable dev

Quoted 3 lines · metux IT consult

don't need the temporary variable "dev", directly use &pdev->dev

This is quite usual to do, and I like it as it saves typing. Personally I would say don't bother with this change.

Quoted 42 lines
---
  drivers/gpio/gpio-janz-ttl.c | 9 ++++-----
  1 file changed, 4 insertions(+), 5 deletions(-)
drivers/gpio/gpio-janz-ttl.c +4 -5
index b97a911..91f91f6 100644
@@ -144,18 +144,17 @@ static void ttl_setup_device(struct ttl_module *mod)
  static int ttl_probe(struct platform_device *pdev)
  {
  	struct janz_platform_data *pdata;
-	struct device *dev = &pdev->dev;
  	struct ttl_module *mod;
  	struct gpio_chip *gpio;
  	int ret;
 
  	pdata = dev_get_platdata(&pdev->dev);
  	if (!pdata) {
-		dev_err(dev, "no platform data\n");
+		dev_err(&pdev->dev, "no platform data\n");
  		return -ENXIO;
  	}
 
-	mod = devm_kzalloc(dev, sizeof(*mod), GFP_KERNEL);
+	mod = devm_kzalloc(&pdev->dev, sizeof(*mod), GFP_KERNEL);
  	if (!mod)
  		return -ENOMEM;
 
@@ -181,9 +180,9 @@ static int ttl_probe(struct platform_device *pdev)
  	gpio->base = -1;
  	gpio->ngpio = 20;
 
-	ret = devm_gpiochip_add_data(dev, gpio, NULL);
+	ret = devm_gpiochip_add_data(&pdev->dev, gpio, NULL);
  	if (ret) {
-		dev_err(dev, "unable to add GPIO chip\n");
+		dev_err(&pdev->dev, "unable to add GPIO chip\n");
  		return ret;
  	}
 
Signature · 4 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html
#38 lore raw

Re: [PATCH 16/42] drivers: gpio: janz-ttl: drop unneccessary temp variable dev

Quoted 7 lines · Ben Dooks
Quoted 3 lines · metux IT consult

don't need the temporary variable "dev", directly use &pdev->dev

This is quite usual to do, and I like it as it saves typing. Personally I would say don't bother with this change.

hmm, both approaches have their valid arguments.

I'm not particularily biased to one or another ay, but I'd prefer having it consistent everywhere.

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#39 lore raw

Re: [PATCH 16/42] drivers: gpio: janz-ttl: drop unneccessary temp variable dev

Quoted 6 lines · metux IT consult
Quoted 5 lines · Ben Dooks
Quoted 3 lines · metux IT consult

don't need the temporary variable "dev", directly use &pdev->dev

Quoted 7 lines
Quoted 2 lines

This is quite usual to do, and I like it as it saves typing. Personally I would say don't bother with this change.

hmm, both approaches have their valid arguments.

I'm not particularily biased to one or another ay, but I'd prefer having it consistent everywhere.

You're not consistent within the series itself. In patch 3 you went the other way and dropped usage of pdev->dev in favour of the local dev variable.

Thierry

#40 lore raw

Re: [PATCH 16/42] drivers: gpio: janz-ttl: drop unneccessary temp variable dev

Quoted 3 lines · Thierry Reding

You're not consistent within the series itself. In patch 3 you went the other way and dropped usage of pdev->dev in favour of the local dev variable.

ups, you got me :O

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#42 lore raw

PATCH 17/42 drivers: gpio: loongon1: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-loongson1.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-loongson1.c +1 -3
index fca84cc..1b1ee94 100644
@@ -47,15 +47,13 @@ static int ls1x_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct gpio_chip *gc;
-	struct resource *res;
 	int ret;
 
 	gc = devm_kzalloc(dev, sizeof(*gc), GFP_KERNEL);
 	if (!gc)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	gpio_reg_base = devm_ioremap_resource(dev, res);
+	gpio_reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(gpio_reg_base))
 		return PTR_ERR(gpio_reg_base);
 
Signature · 1 line
1.9.1
#44 lore raw

PATCH 18/42 drivers: gpio: lpc18xx: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-lpc18xx.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpio/gpio-lpc18xx.c +1 -4
index d441dba..d711ae0 100644
@@ -340,10 +340,7 @@ static int lpc18xx_gpio_probe(struct platform_device *pdev)
 	index = of_property_match_string(dev->of_node, "reg-names", "gpio");
 	if (index < 0) {
 		/* To support backward compatibility take the first resource */
-		struct resource *res;
-
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		gc->base = devm_ioremap_resource(dev, res);
+		gc->base = devm_platform_ioremap_resource(pdev, 0);
 	} else {
 		struct resource res;
 
Signature · 1 line
1.9.1
maintainer Acked-by on v1 18/42
#45 lore raw

Re: [PATCH 18/42] drivers: gpio: lpc18xx: use devm_platform_ioremap_resource()

Quoted 15 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-lpc18xx.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpio/gpio-lpc18xx.c +0 -0
index d441dba..d711ae0 100644
@@ -340,10 +340,7 @@ static int lpc18xx_gpio_probe(struct platform_device *pdev)
 	index = of_property_match_string(dev->of_node, "reg-names", "gpio");

drivers/gpio/gpio-lpc18xx.c static int lpc18xx_gpio_probe(struct platform_device *pdev) · line 346

Quoted 10 lines
drivers/gpio/gpio-lpc18xx.c +1 -4
 	if (index < 0) {
 		/* To support backward compatibility take the first resource */
-		struct resource *res;
-
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-		gc->base = devm_ioremap_resource(dev, res);
+		gc->base = devm_platform_ioremap_resource(pdev, 0);
 	} else {
 		struct resource res;
 

--
Best wishes,
Vladimir

#47 lore raw

PATCH 19/42 drivers: gpio: mb86s7x: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-mb86s7x.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-mb86s7x.c +1 -3
index 3134c0d..9308081 100644
@@ -146,7 +146,6 @@ static void mb86s70_gpio_set(struct gpio_chip *gc, unsigned gpio, int value)
 static int mb86s70_gpio_probe(struct platform_device *pdev)
 {
 	struct mb86s70_gpio_chip *gchip;
-	struct resource *res;
 	int ret;
 
 	gchip = devm_kzalloc(&pdev->dev, sizeof(*gchip), GFP_KERNEL);
@@ -155,8 +154,7 @@ static int mb86s70_gpio_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, gchip);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	gchip->base = devm_ioremap_resource(&pdev->dev, res);
+	gchip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(gchip->base))
 		return PTR_ERR(gchip->base);
 
Signature · 1 line
1.9.1
#49 lore raw

PATCH 20/42 drivers: gpio: mt7621: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-mt7621.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpio/gpio-mt7621.c +1 -2
index 74401e0..79654fb 100644
@@ -293,7 +293,6 @@ struct mtk {
 static int
 mediatek_gpio_probe(struct platform_device *pdev)
 {
-	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct mtk *mtk;
@@ -304,7 +303,7 @@ struct mtk {
 	if (!mtk)
 		return -ENOMEM;
 
-	mtk->base = devm_ioremap_resource(dev, res);
+	mtk->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mtk->base))
 		return PTR_ERR(mtk->base);
 
Signature · 1 line
1.9.1
maintainer Reviewed-by on v1 20/42
#50 lore raw

Re: [PATCH 20/42] drivers: gpio: mt7621: use devm_platform_ioremap_resource()

Quoted 7 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-mt7621.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 23 lines
drivers/gpio/gpio-mt7621.c +1 -2
index 74401e0..79654fb 100644
@@ -293,7 +293,6 @@ struct mtk {
 static int
 mediatek_gpio_probe(struct platform_device *pdev)
 {
-	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct mtk *mtk;
@@ -304,7 +303,7 @@ struct mtk {
 	if (!mtk)
 		return -ENOMEM;
 
-	mtk->base = devm_ioremap_resource(dev, res);
+	mtk->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(mtk->base))
 		return PTR_ERR(mtk->base);
 
#52 lore raw

PATCH 21/42 drivers: gpio: mvebu: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-mvebu.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpio/gpio-mvebu.c +2 -5
index f97ed32..059094a 100644
@@ -1038,11 +1038,9 @@ static int mvebu_gpio_resume(struct platform_device *pdev)
 static int mvebu_gpio_probe_raw(struct platform_device *pdev,
 				struct mvebu_gpio_chip *mvchip)
 {
-	struct resource *res;
 	void __iomem *base;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base = devm_ioremap_resource(&pdev->dev, res);
+	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 
@@ -1062,8 +1060,7 @@ static int mvebu_gpio_probe_raw(struct platform_device *pdev,
 	 * per-CPU registers
 	 */
 	if (mvchip->soc_variant == MVEBU_GPIO_SOC_VARIANT_ARMADAXP) {
-		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-		base = devm_ioremap_resource(&pdev->dev, res);
+		base = devm_platform_ioremap_resource(pdev, 1);
 		if (IS_ERR(base))
 			return PTR_ERR(base);
 
Signature · 1 line
1.9.1
#54 lore raw

PATCH 22/42 drivers: gpio: mxc: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-mxc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-mxc.c +1 -3
index e86e61d..b281358 100644
@@ -411,7 +411,6 @@ static int mxc_gpio_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct mxc_gpio_port *port;
-	struct resource *iores;
 	int irq_base;
 	int err;
 
@@ -423,8 +422,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)
 
 	port->dev = &pdev->dev;
 
-	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	port->base = devm_ioremap_resource(&pdev->dev, iores);
+	port->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(port->base))
 		return PTR_ERR(port->base);
 
Signature · 1 line
1.9.1
#56 lore raw

PATCH 23/42 drivers: gpio: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-octeon.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-octeon.c +1 -3
index 1b19c88..afb0e8a 100644
@@ -82,7 +82,6 @@ static int octeon_gpio_probe(struct platform_device *pdev)
 {
 	struct octeon_gpio *gpio;
 	struct gpio_chip *chip;
-	struct resource *res_mem;
 	void __iomem *reg_base;
 	int err = 0;
 
@@ -91,8 +90,7 @@ static int octeon_gpio_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	chip = &gpio->chip;
 
-	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	reg_base = devm_ioremap_resource(&pdev->dev, res_mem);
+	reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(reg_base))
 		return PTR_ERR(reg_base);
 
Signature · 1 line
1.9.1
#57 lore raw

Re: [PATCH 23/42] drivers: gpio: use devm_platform_ioremap_resource()

Quoted 4 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

The subject is missing an "octeon: " part here to indicate which driver this applies to.

Maybe you should convert all drivers in one go though?

Signature · 1 line
Florian
#58 lore raw

PATCH 1/1 drivers: gpio: octeon: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-octeon.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-octeon.c +1 -3
index 1b19c88..afb0e8a 100644
@@ -82,7 +82,6 @@ static int octeon_gpio_probe(struct platform_device *pdev)
 {
 	struct octeon_gpio *gpio;
 	struct gpio_chip *chip;
-	struct resource *res_mem;
 	void __iomem *reg_base;
 	int err = 0;
 
@@ -91,8 +90,7 @@ static int octeon_gpio_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	chip = &gpio->chip;
 
-	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	reg_base = devm_ioremap_resource(&pdev->dev, res_mem);
+	reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(reg_base))
 		return PTR_ERR(reg_base);
 
Signature · 1 line
1.9.1
#59 lore raw

Re: [PATCH] drivers: gpio: octeon: use devm_platform_ioremap_resource()

pon., 11 mar 2019 o 20:48 Enrico Weigelt, metux IT consult <[email protected]> napisał(a):

Quoted 32 lines

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-octeon.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-octeon.c +1 -4
index 1b19c88..afb0e8a 100644
@@ -82,7 +82,6 @@ static int octeon_gpio_probe(struct platform_device *pdev)
 {
        struct octeon_gpio *gpio;
        struct gpio_chip *chip;
-       struct resource *res_mem;
        void __iomem *reg_base;
        int err = 0;
 
@@ -91,8 +90,7 @@ static int octeon_gpio_probe(struct platform_device *pdev)
                return -ENOMEM;
        chip = &gpio->chip;
 
-       res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       reg_base = devm_ioremap_resource(&pdev->dev, res_mem);
+       reg_base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(reg_base))
                return PTR_ERR(reg_base);
 
--
Quoted 2 lines

1.9.1

Can you make this a part of the bigger series and resend together with subject line fixes?

Also: maybe consider adding a coccinelle script for that. When I added that function I noticed there are 1200+ instances in the kernel that need fixing. I think we'll be better off automating it.

Bart

#60 lore raw

Re: [PATCH] drivers: gpio: octeon: use devm_platform_ioremap_resource()

Quoted 2 lines · Bartosz Golaszewski

Can you make this a part of the bigger series and resend together with subject line fixes?

tried to resend it as reply on the prev version. but somehow this didn't seem to work as intented.

Quoted 3 lines

Also: maybe consider adding a coccinelle script for that. When I added that function I noticed there are 1200+ instances in the kernel that need fixing. I think we'll be better off automating it.

haven't coped w/ this yet ... I'll first need to have a deeper look at it. advices welcomed.

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#62 lore raw

PATCH 24/42 drivers: gpio: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-omap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-omap.c +1 -3
index 7f33024..ce6e67a 100644
@@ -1289,7 +1289,6 @@ static int omap_gpio_probe(struct platform_device *pdev)
 	struct device_node *node = dev->of_node;
 	const struct of_device_id *match;
 	const struct omap_gpio_platform_data *pdata;
-	struct resource *res;
 	struct gpio_bank *bank;
 	struct irq_chip *irqc;
 	int ret;
@@ -1375,8 +1374,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
 	raw_spin_lock_init(&bank->wa_lock);
 
 	/* Static mapping, never released */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	bank->base = devm_ioremap_resource(dev, res);
+	bank->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(bank->base)) {
 		return PTR_ERR(bank->base);
 	}
Signature · 1 line
1.9.1
#63 lore raw

Re: [PATCH 24/42] drivers: gpio: use devm_platform_ioremap_resource()

Quoted 4 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

Same here, missing an "omap: " qualifier in the subject. --
Florian

#64 lore raw

PATCH 1/1 drivers: gpio: omap: use devm_platform_ioremap_resource()

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-omap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-omap.c +1 -3
index 7f33024..ce6e67a 100644
@@ -1289,7 +1289,6 @@ static int omap_gpio_probe(struct platform_device *pdev)
 	struct device_node *node = dev->of_node;
 	const struct of_device_id *match;
 	const struct omap_gpio_platform_data *pdata;
-	struct resource *res;
 	struct gpio_bank *bank;
 	struct irq_chip *irqc;
 	int ret;
@@ -1375,8 +1374,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
 	raw_spin_lock_init(&bank->wa_lock);
 
 	/* Static mapping, never released */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	bank->base = devm_ioremap_resource(dev, res);
+	bank->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(bank->base)) {
 		return PTR_ERR(bank->base);
 	}
Signature · 1 line
1.9.1
maintainer Acked-by on v1 1/1
#65 lore raw

Re: [PATCH] drivers: gpio: omap: use devm_platform_ioremap_resource()

Quoted 22 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-omap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-omap.c +0 -1
index 7f33024..ce6e67a 100644
@@ -1289,7 +1289,6 @@ static int omap_gpio_probe(struct platform_device *pdev)
 	struct device_node *node = dev->of_node;
 	const struct of_device_id *match;
 	const struct omap_gpio_platform_data *pdata;
-	struct resource *res;
 	struct gpio_bank *bank;
 	struct irq_chip *irqc;
 	int ret;

drivers/gpio/gpio-omap.c static int omap_gpio_probe(struct platform_device *pdev) · line 1380

Quoted 9 lines
drivers/gpio/gpio-omap.c +1 -2
@@ -1375,8 +1374,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
 	raw_spin_lock_init(&bank->wa_lock);
 
 	/* Static mapping, never released */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	bank->base = devm_ioremap_resource(dev, res);
+	bank->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(bank->base)) {
 		return PTR_ERR(bank->base);
 	}
Signature · 2 lines
Best regards,
grygorii
#67 lore raw

PATCH 25/42 drivers: gpio: pxa: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-pxa.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpio/gpio-pxa.c +2 -6
index bcc6be4..dd47960 100644
@@ -622,7 +622,6 @@ static int pxa_gpio_probe(struct platform_device *pdev)
 {
 	struct pxa_gpio_chip *pchip;
 	struct pxa_gpio_bank *c;
-	struct resource *res;
 	struct clk *clk;
 	struct pxa_gpio_platform_data *info;
 	void __iomem *gpio_reg_base;
@@ -665,11 +664,8 @@ static int pxa_gpio_probe(struct platform_device *pdev)
 
 	pchip->irq0 = irq0;
 	pchip->irq1 = irq1;
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -EINVAL;
-	gpio_reg_base = devm_ioremap(&pdev->dev, res->start,
-				     resource_size(res));
+
+	gpio_reg_base = devm_platform_ioremap_resource(pdev, 0);
 	if (!gpio_reg_base)
 		return -EINVAL;
 
Signature · 1 line
1.9.1
#69 lore raw

PATCH 26/42 drivers: gpio: rcar: pendantic formatting

In reply to Enrico Weigelt, metux IT consult

a tab sneaked in, where it shouldn't be.

---
 drivers/gpio/gpio-rcar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-rcar.c +1 -1
index 500a359..df4419e 100644
@@ -490,7 +490,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 	irq_chip->irq_unmask = gpio_rcar_irq_enable;
 	irq_chip->irq_set_type = gpio_rcar_irq_set_type;
 	irq_chip->irq_set_wake = gpio_rcar_irq_set_wake;
-	irq_chip->flags	= IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;
+	irq_chip->flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;
 
 	ret = gpiochip_add_data(gpio_chip, p);
 	if (ret) {
Signature · 1 line
1.9.1
#70 lore raw

Re: [PATCH 26/42] drivers: gpio: rcar: pendantic formatting

Quoted 1 line · metux IT consult

a tab sneaked in, where it shouldn't be.

Pedantic nitpick: "pendantic" -> "pedantic" in the subject, and start the commit message with a capital letter: "A tab sneaked in [...]".

Thierry

Reviewed-by on v1 26/42
#71 lore raw

Re: [PATCH 26/42] drivers: gpio: rcar: pendantic formatting

In reply to Enrico Weigelt, metux IT consult

CC linux-renesas-soc

Quoted 3 lines · metux IT consult

a tab sneaked in, where it shouldn't be.

With Thierry's comments addressed:

drivers/gpio/gpio-rcar.c static int gpio_rcar_probe(struct platform_device *pdev) · line 496

Quoted 11 lines
drivers/gpio/gpio-rcar.c +1 -1
@@ -490,7 +490,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
        irq_chip->irq_unmask = gpio_rcar_irq_enable;
        irq_chip->irq_set_type = gpio_rcar_irq_set_type;
        irq_chip->irq_set_wake = gpio_rcar_irq_set_wake;
-       irq_chip->flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;
+       irq_chip->flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;
 
        ret = gpiochip_add_data(gpio_chip, p);
        if (ret) {

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

PATCH 27/42 drivers: gpio: rcar: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-rcar.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpio/gpio-rcar.c +2 -3
index df4419e..187984d 100644
@@ -430,7 +430,7 @@ static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
 static int gpio_rcar_probe(struct platform_device *pdev)
 {
 	struct gpio_rcar_priv *p;
-	struct resource *io, *irq;
+	struct resource *irq;
 	struct gpio_chip *gpio_chip;
 	struct irq_chip *irq_chip;
 	struct device *dev = &pdev->dev;
@@ -461,8 +461,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 		goto err0;
 	}
 
-	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	p->base = devm_ioremap_resource(dev, io);
+	p->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(p->base)) {
 		ret = PTR_ERR(p->base);
 		goto err0;
Signature · 1 line
1.9.1
Reviewed-by on v1 27/42
#74 lore raw

Re: [PATCH 27/42] drivers: gpio: rcar: use devm_platform_ioremap_resource()

CC linux-renesas-soc

Quoted 4 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

Quoted 12 lines
drivers/gpio/gpio-rcar.c +1 -1
@@ -430,7 +430,7 @@ static int gpio_rcar_parse_dt(struct gpio_rcar_priv *p, unsigned int *npins)
 static int gpio_rcar_probe(struct platform_device *pdev)
 {
        struct gpio_rcar_priv *p;
-       struct resource *io, *irq;
+       struct resource *irq;
        struct gpio_chip *gpio_chip;
        struct irq_chip *irq_chip;
        struct device *dev = &pdev->dev;

drivers/gpio/gpio-rcar.c static int gpio_rcar_probe(struct platform_device *pdev) · line 467

Quoted 9 lines
drivers/gpio/gpio-rcar.c +1 -2
@@ -461,8 +461,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
                goto err0;
        }
 
-       io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       p->base = devm_ioremap_resource(dev, io);
+       p->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(p->base)) {
                ret = PTR_ERR(p->base);
                goto err0;

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

PATCH 28/42 drivers: gpio: spear-spics: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-spear-spics.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-spear-spics.c +1 -3
index ee3039f..6eca531 100644
@@ -122,15 +122,13 @@ static int spics_gpio_probe(struct platform_device *pdev)
 {
 	struct device_node *np = pdev->dev.of_node;
 	struct spear_spics *spics;
-	struct resource *res;
 	int ret;
 
 	spics = devm_kzalloc(&pdev->dev, sizeof(*spics), GFP_KERNEL);
 	if (!spics)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	spics->base = devm_ioremap_resource(&pdev->dev, res);
+	spics->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(spics->base))
 		return PTR_ERR(spics->base);
 
Signature · 1 line
1.9.1
#78 lore raw

PATCH 29/42 drivers: gpio: sprd: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-sprd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-sprd.c +1 -3
index 55072d2..f5c8b3a 100644
@@ -219,7 +219,6 @@ static int sprd_gpio_probe(struct platform_device *pdev)
 {
 	struct gpio_irq_chip *irq;
 	struct sprd_gpio *sprd_gpio;
-	struct resource *res;
 	int ret;
 
 	sprd_gpio = devm_kzalloc(&pdev->dev, sizeof(*sprd_gpio), GFP_KERNEL);
@@ -232,8 +231,7 @@ static int sprd_gpio_probe(struct platform_device *pdev)
 		return sprd_gpio->irq;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	sprd_gpio->base = devm_ioremap_resource(&pdev->dev, res);
+	sprd_gpio->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(sprd_gpio->base))
 		return PTR_ERR(sprd_gpio->base);
 
Signature · 1 line
1.9.1
Reviewed-by on v1 29/42
#79 lore raw

Re: [PATCH 29/42] drivers: gpio: sprd: use devm_platform_ioremap_resource()

Hi,

Quoted 22 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-sprd.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-sprd.c +0 -1
index 55072d2..f5c8b3a 100644
@@ -219,7 +219,6 @@ static int sprd_gpio_probe(struct platform_device *pdev)
 {
        struct gpio_irq_chip *irq;
        struct sprd_gpio *sprd_gpio;
-       struct resource *res;
        int ret;
 
        sprd_gpio = devm_kzalloc(&pdev->dev, sizeof(*sprd_gpio), GFP_KERNEL);

drivers/gpio/gpio-sprd.c static int sprd_gpio_probe(struct platform_device *pdev) · line 237

Quoted 9 lines
drivers/gpio/gpio-sprd.c +1 -2
@@ -232,8 +231,7 @@ static int sprd_gpio_probe(struct platform_device *pdev)
                return sprd_gpio->irq;
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       sprd_gpio->base = devm_ioremap_resource(&pdev->dev, res);
+       sprd_gpio->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(sprd_gpio->base))
                return PTR_ERR(sprd_gpio->base);
 

Thanks for your patch.

Signature · 2 lines
Baolin Wang
Best Regards
#81 lore raw

Re: [PATCH 29/42] drivers: gpio: sprd: use devm_platform_ioremap_resource()

Hi Linus,

Quoted 10 lines · Linus Walleij
Quoted 4 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

Patch applied with Baolin's ACK.

This patch had some problems which I've pointed out and I did not ack this patch. Please do not apply it now until fixing the problem.

Signature · 2 lines
Baolin Wang
Best Regards
Reviewed-by Baolin Wang
#82 lore raw

Re: [PATCH 29/42] drivers: gpio: sprd: use devm_platform_ioremap_resource()

Quoted 8 lines · Baolin Wang
Quoted 7 lines · Linus Walleij
Quoted 3 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Patch applied with Baolin's ACK.

This patch had some problems which I've pointed out and I did not ack this patch. Please do not apply it now until fixing the problem.

Sorry, it's the gmail threading that confuse the different patches.

The patch I actually applied is for gpio-sprd.c and looks like this:

commit 851f66daeab961328507dcce0980cd7e4ff5f9ae (HEAD -> devel)

Author: Enrico Weigelt, metux IT consult <[email protected]>
Date:   Mon Mar 11 19:55:08 2019 +0100

drivers: gpio: sprd: use devm_platform_ioremap_resource()

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

drivers/gpio/gpio-sprd.c +1 -3
index 55072d2b367f..f5c8b3a351d5 100644
@@ -219,7 +219,6 @@ static int sprd_gpio_probe(struct platform_device *pdev)
 {
        struct gpio_irq_chip *irq;
        struct sprd_gpio *sprd_gpio;
-       struct resource *res;
        int ret;
 
        sprd_gpio = devm_kzalloc(&pdev->dev, sizeof(*sprd_gpio), GFP_KERNEL);
@@ -232,8 +231,7 @@ static int sprd_gpio_probe(struct platform_device *pdev)
                return sprd_gpio->irq;
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       sprd_gpio->base = devm_ioremap_resource(&pdev->dev, res);
+       sprd_gpio->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(sprd_gpio->base))
                return PTR_ERR(sprd_gpio->base);
 

Yours,
Linus Walleij

#83 lore raw

Re: [PATCH 29/42] drivers: gpio: sprd: use devm_platform_ioremap_resource()

Quoted 12 lines · Linus Walleij
Quoted 10 lines · Baolin Wang
Quoted 9 lines · Linus Walleij
Quoted 4 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Patch applied with Baolin's ACK.

This patch had some problems which I've pointed out and I did not ack this patch. Please do not apply it now until fixing the problem.

Sorry, it's the gmail threading that confuse the different patches.

The patch I actually applied is for gpio-sprd.c and looks like this:

Yes, this one is correct. Thanks :)

Quoted 38 lines

commit 851f66daeab961328507dcce0980cd7e4ff5f9ae (HEAD -> devel)

Author: Enrico Weigelt, metux IT consult <[email protected]>
Date:   Mon Mar 11 19:55:08 2019 +0100

drivers: gpio: sprd: use devm_platform_ioremap_resource()

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

drivers/gpio/gpio-sprd.c +1 -3
index 55072d2b367f..f5c8b3a351d5 100644
@@ -219,7 +219,6 @@ static int sprd_gpio_probe(struct platform_device *pdev)
 {
        struct gpio_irq_chip *irq;
        struct sprd_gpio *sprd_gpio;
-       struct resource *res;
        int ret;
 
        sprd_gpio = devm_kzalloc(&pdev->dev, sizeof(*sprd_gpio), GFP_KERNEL);
@@ -232,8 +231,7 @@ static int sprd_gpio_probe(struct platform_device *pdev)
                return sprd_gpio->irq;
        }
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       sprd_gpio->base = devm_ioremap_resource(&pdev->dev, res);
+       sprd_gpio->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(sprd_gpio->base))
                return PTR_ERR(sprd_gpio->base);
 

Yours,
Linus Walleij

Signature · 2 lines
Baolin Wang
Best Regards
#84 lore raw

PATCH 30/42 drivers: gpio: sta2x11: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-sta2x11.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpio/gpio-sta2x11.c +1 -4
index 2283c86..a51c310 100644
@@ -360,7 +360,6 @@ static int gsta_probe(struct platform_device *dev)
 	struct pci_dev *pdev;
 	struct sta2x11_gpio_pdata *gpio_pdata;
 	struct gsta_gpio *chip;
-	struct resource *res;
 
 	pdev = *(struct pci_dev **)dev_get_platdata(&dev->dev);
 	gpio_pdata = dev_get_platdata(&pdev->dev);
@@ -369,13 +368,11 @@ static int gsta_probe(struct platform_device *dev)
 		dev_err(&dev->dev, "no gpio config\n");
 	pr_debug("gpio config: %p\n", gpio_pdata);
 
-	res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-
 	chip = devm_kzalloc(&dev->dev, sizeof(*chip), GFP_KERNEL);
 	if (!chip)
 		return -ENOMEM;
 	chip->dev = &dev->dev;
-	chip->reg_base = devm_ioremap_resource(&dev->dev, res);
+	chip->reg_base = devm_platform_ioremap_resource(dev, 0);
 	if (IS_ERR(chip->reg_base))
 		return PTR_ERR(chip->reg_base);
 
Signature · 1 line
1.9.1
#86 lore raw

PATCH 31/42 drivers: gpio: stp-xway: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-stp-xway.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-stp-xway.c +1 -3
index 1997208..8a319d5 100644
@@ -210,7 +210,6 @@ static int xway_stp_hw_init(struct xway_stp *chip)
 
 static int xway_stp_probe(struct platform_device *pdev)
 {
-	struct resource *res;
 	u32 shadow, groups, dsl, phy;
 	struct xway_stp *chip;
 	struct clk *clk;
@@ -220,8 +219,7 @@ static int xway_stp_probe(struct platform_device *pdev)
 	if (!chip)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	chip->virt = devm_ioremap_resource(&pdev->dev, res);
+	chip->virt = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(chip->virt))
 		return PTR_ERR(chip->virt);
 
Signature · 1 line
1.9.1
#88 lore raw

PATCH 32/42 drivers: gpio: tb10x: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-tb10x.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-tb10x.c +1 -3
index d5e5d19..6bbac6c 100644
@@ -120,7 +120,6 @@ static irqreturn_t tb10x_gpio_irq_cascade(int irq, void *data)
 static int tb10x_gpio_probe(struct platform_device *pdev)
 {
 	struct tb10x_gpio *tb10x_gpio;
-	struct resource *mem;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	int ret = -EBUSY;
@@ -136,8 +135,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
 	if (tb10x_gpio == NULL)
 		return -ENOMEM;
 
-	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	tb10x_gpio->base = devm_ioremap_resource(dev, mem);
+	tb10x_gpio->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(tb10x_gpio->base))
 		return PTR_ERR(tb10x_gpio->base);
 
Signature · 1 line
1.9.1
#90 lore raw

PATCH 33/42 drivers: gpio: tegra: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-tegra.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-tegra.c +1 -3
index 1ececf2..6d9b690 100644
@@ -569,7 +569,6 @@ static inline void tegra_gpio_debuginit(struct tegra_gpio_info *tgi)
 static int tegra_gpio_probe(struct platform_device *pdev)
 {
 	struct tegra_gpio_info *tgi;
-	struct resource *res;
 	struct tegra_gpio_bank *bank;
 	unsigned int gpio, i, j;
 	int ret;
@@ -645,8 +644,7 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 		bank->tgi = tgi;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	tgi->regs = devm_ioremap_resource(&pdev->dev, res);
+	tgi->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(tgi->regs))
 		return PTR_ERR(tgi->regs);
 
Signature · 1 line
1.9.1
#93 lore raw

PATCH 34/42 drivers: gpio: timberdale: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-timberdale.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-timberdale.c +1 -3
index 314e300..1c70e83 100644
@@ -229,7 +229,6 @@ static int timbgpio_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct gpio_chip *gc;
 	struct timbgpio *tgpio;
-	struct resource *iomem;
 	struct timbgpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	int irq = platform_get_irq(pdev, 0);
 
@@ -246,8 +245,7 @@ static int timbgpio_probe(struct platform_device *pdev)
 
 	spin_lock_init(&tgpio->lock);
 
-	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	tgpio->membase = devm_ioremap_resource(dev, iomem);
+	tgpio->membase = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(tgpio->membase))
 		return PTR_ERR(tgpio->membase);
 
Signature · 1 line
1.9.1
#95 lore raw

PATCH 35/42 drivers: gpio: ts4800: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-ts4800.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-ts4800.c +1 -3
index c2a80b4..8c0d82d 100644
@@ -23,7 +23,6 @@ static int ts4800_gpio_probe(struct platform_device *pdev)
 {
 	struct device_node *node;
 	struct gpio_chip *chip;
-	struct resource *res;
 	void __iomem *base_addr;
 	int retval;
 	u32 ngpios;
@@ -32,8 +31,7 @@ static int ts4800_gpio_probe(struct platform_device *pdev)
 	if (!chip)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	base_addr = devm_ioremap_resource(&pdev->dev, res);
+	base_addr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base_addr))
 		return PTR_ERR(base_addr);
 
Signature · 1 line
1.9.1
#97 lore raw

PATCH 36/42 drivers: gpio: uniphier: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-uniphier.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-uniphier.c +1 -3
index 0f662b2..93cdcc4 100644
@@ -346,7 +346,6 @@ static int uniphier_gpio_probe(struct platform_device *pdev)
 	struct uniphier_gpio_priv *priv;
 	struct gpio_chip *chip;
 	struct irq_chip *irq_chip;
-	struct resource *regs;
 	unsigned int nregs;
 	u32 ngpios;
 	int ret;
@@ -370,8 +369,7 @@ static int uniphier_gpio_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
-	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	priv->regs = devm_ioremap_resource(dev, regs);
+	priv->regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(priv->regs))
 		return PTR_ERR(priv->regs);
 
Signature · 1 line
1.9.1
Acked-by on v1 36/42
#98 lore raw

Re: [PATCH 36/42] drivers: gpio: uniphier: use devm_platform_ioremap_resource()

Quoted 6 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---

Quoted 28 lines
 drivers/gpio/gpio-uniphier.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-uniphier.c +1 -4
index 0f662b2..93cdcc4 100644
@@ -346,7 +346,6 @@ static int uniphier_gpio_probe(struct platform_device *pdev)
        struct uniphier_gpio_priv *priv;
        struct gpio_chip *chip;
        struct irq_chip *irq_chip;
-       struct resource *regs;
        unsigned int nregs;
        u32 ngpios;
        int ret;
@@ -370,8 +369,7 @@ static int uniphier_gpio_probe(struct platform_device *pdev)
        if (!priv)
                return -ENOMEM;
 
-       regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       priv->regs = devm_ioremap_resource(dev, regs);
+       priv->regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(priv->regs))
                return PTR_ERR(priv->regs);
 
--

1.9.1

Signature · 2 lines
Best Regards
Masahiro Yamada
#100 lore raw

PATCH 37/42 drivers: gpio: vf610: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-vf610.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/gpio/gpio-vf610.c +2 -5
index 541fa6a..4b86a2d 100644
@@ -251,7 +251,6 @@ static int vf610_gpio_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
 	struct vf610_gpio_port *port;
-	struct resource *iores;
 	struct gpio_chip *gc;
 	int i;
 	int ret;
@@ -261,13 +260,11 @@ static int vf610_gpio_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	port->sdata = of_device_get_match_data(dev);
-	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	port->base = devm_ioremap_resource(dev, iores);
+	port->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(port->base))
 		return PTR_ERR(port->base);
 
-	iores = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	port->gpio_base = devm_ioremap_resource(dev, iores);
+	port->gpio_base = devm_platform_ioremap_resource(pdev, 1);
 	if (IS_ERR(port->gpio_base))
 		return PTR_ERR(port->gpio_base);
 
Signature · 1 line
1.9.1
#102 lore raw

PATCH 38/42 drivers: gpio: vr41xx: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

this driver deserves a bit more cleanup, to get rid of the global variable giu_base, which makes it single-instance-only.

---
 drivers/gpio/gpio-vr41xx.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/gpio/gpio-vr41xx.c +5 -14
index b13a49c..98cd715 100644
@@ -467,10 +467,9 @@ static int vr41xx_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 
 static int giu_probe(struct platform_device *pdev)
 {
-	struct resource *res;
 	unsigned int trigger, i, pin;
 	struct irq_chip *chip;
-	int irq, ret;
+	int irq;
 
 	switch (pdev->id) {
 	case GPIO_50PINS_PULLUPDOWN:
@@ -489,21 +488,14 @@ static int giu_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -EBUSY;
-
-	giu_base = ioremap(res->start, resource_size(res));
-	if (!giu_base)
-		return -ENOMEM;
+	giu_base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(giu_base))
+		return PTR_ERR(giu_base);
 
 	vr41xx_gpio_chip.parent = &pdev->dev;
 
-	ret = gpiochip_add_data(&vr41xx_gpio_chip, NULL);
-	if (!ret) {
-		iounmap(giu_base);
+	if (gpiochip_add_data(&vr41xx_gpio_chip, NULL))
 		return -ENODEV;
-	}
 
 	giu_write(GIUINTENL, 0);
 	giu_write(GIUINTENH, 0);
@@ -534,7 +526,6 @@ static int giu_probe(struct platform_device *pdev)
 static int giu_remove(struct platform_device *pdev)
 {
 	if (giu_base) {
-		iounmap(giu_base);
 		giu_base = NULL;
 	}
 
Signature · 1 line
1.9.1
#103 lore raw

Re: [PATCH 38/42] drivers: gpio: vr41xx: use devm_platform_ioremap_resource()

Quoted 31 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

this driver deserves a bit more cleanup, to get rid of the global variable giu_base, which makes it single-instance-only.

---
 drivers/gpio/gpio-vr41xx.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)
drivers/gpio/gpio-vr41xx.c +1 -2
index b13a49c..98cd715 100644
@@ -467,10 +467,9 @@ static int vr41xx_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 
 static int giu_probe(struct platform_device *pdev)
 {
-	struct resource *res;
 	unsigned int trigger, i, pin;
 	struct irq_chip *chip;
-	int irq, ret;
+	int irq;
 
 	switch (pdev->id) {
 	case GPIO_50PINS_PULLUPDOWN:
@@ -489,21 +488,14 @@ static int giu_probe(struct platform_device *pdev)
 		return -ENODEV;
 	}
 

drivers/gpio/gpio-vr41xx.c static int giu_probe(struct platform_device *pdev) · line 493

Quoted 10 lines
drivers/gpio/gpio-vr41xx.c +3 -7
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -EBUSY;
-
-	giu_base = ioremap(res->start, resource_size(res));
-	if (!giu_base)
-		return -ENOMEM;
+	giu_base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(giu_base))
+		return PTR_ERR(giu_base);

The driver currently doesn't request the memory described in the resource, so technically you're changing behaviour here and with your change the driver could now fail if somebody else has already claimed the memory.

Looking at arch/mips/vr41xx there doesn't seem to be an overlap between the memory region used by the GIU device and any others, so this should be safe. Not sure anyone still has hardware for this around to give it a spin.

Thierry

Quoted 23 lines
drivers/gpio/gpio-vr41xx.c +1 -5
 	vr41xx_gpio_chip.parent = &pdev->dev;
 
-	ret = gpiochip_add_data(&vr41xx_gpio_chip, NULL);
-	if (!ret) {
-		iounmap(giu_base);
+	if (gpiochip_add_data(&vr41xx_gpio_chip, NULL))
 		return -ENODEV;
-	}
 
 	giu_write(GIUINTENL, 0);
 	giu_write(GIUINTENH, 0);
@@ -534,7 +526,6 @@ static int giu_probe(struct platform_device *pdev)
 static int giu_remove(struct platform_device *pdev)
 {
 	if (giu_base) {
-		iounmap(giu_base);
 		giu_base = NULL;
 	}
 
Signature · 1 line
1.9.1
#104 lore raw

Re: [PATCH 38/42] drivers: gpio: vr41xx: use devm_platform_ioremap_resource()

Quoted 4 lines · Thierry Reding

The driver currently doesn't request the memory described in the resource, so technically you're changing behaviour here and with your change the driver could now fail if somebody else has already claimed the memory.

hmm, using w/o requesting/claiming - isn't that a bug ?

--mtx

Signature · 3 lines
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
[email protected] -- +49-151-27565287
#105 lore raw

Re: [PATCH 38/42] drivers: gpio: vr41xx: use devm_platform_ioremap_resource()

Quoted 8 lines · metux IT consult
Quoted 4 lines · Thierry Reding

The driver currently doesn't request the memory described in the resource, so technically you're changing behaviour here and with your change the driver could now fail if somebody else has already claimed the memory.

hmm, using w/o requesting/claiming - isn't that a bug ?

Not necessarily, before regmap existed, you could have very well delegated a subset of a larger resource to a specific driver while a driver requesting that larger resource would be responsible for doing the request_mem_region(). As long as both drivers don't stomp on each other, this is a perfectly valid way to delegate, yet keep things modular/separate.

Signature · 1 line
Florian
#106 lore raw

Re: [PATCH 38/42] drivers: gpio: vr41xx: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult
Quoted 7 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

this driver deserves a bit more cleanup, to get rid of the global variable giu_base, which makes it single-instance-only.

Holding this back until we have more consensus and some ACKs.

Yours,
Linus Walleij

#107 lore raw

PATCH 39/42 drivers: gpio: xgene-sb: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-xgene-sb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-xgene-sb.c +1 -3
index 2eb76f3..641a051 100644
@@ -229,7 +229,6 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)
 {
 	struct xgene_gpio_sb *priv;
 	int ret;
-	struct resource *res;
 	void __iomem *regs;
 	struct irq_domain *parent_domain = NULL;
 	u32 val32;
@@ -238,8 +237,7 @@ static int xgene_gpio_sb_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	regs = devm_ioremap_resource(&pdev->dev, res);
+	regs = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(regs))
 		return PTR_ERR(regs);
 
Signature · 1 line
1.9.1
#109 lore raw

PATCH 40/42 drivers: gpio: zx: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-zx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-zx.c +1 -3
index 5eacad9..fb92755 100644
@@ -218,15 +218,13 @@ static int zx_gpio_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct zx_gpio *chip;
-	struct resource *res;
 	int irq, id, ret;
 
 	chip = devm_kzalloc(dev, sizeof(*chip), GFP_KERNEL);
 	if (!chip)
 		return -ENOMEM;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	chip->base = devm_ioremap_resource(dev, res);
+	chip->base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(chip->base))
 		return PTR_ERR(chip->base);
 
Signature · 1 line
1.9.1
#111 lore raw

PATCH 41/42 drivers: gpio: xlp: devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-xlp.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpio/gpio-xlp.c +1 -6
index 0a3607f..54d3359 100644
@@ -290,22 +290,17 @@ static void xlp_gpio_set(struct gpio_chip *gc, unsigned gpio, int state)
 static int xlp_gpio_probe(struct platform_device *pdev)
 {
 	struct gpio_chip *gc;
-	struct resource *iores;
 	struct xlp_gpio_priv *priv;
 	void __iomem *gpio_base;
 	int irq_base, irq, err;
 	int ngpio;
 	u32 soc_type;
 
-	iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!iores)
-		return -ENODEV;
-
 	priv = devm_kzalloc(&pdev->dev,	sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
 
-	gpio_base = devm_ioremap_resource(&pdev->dev, iores);
+	gpio_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(gpio_base))
 		return PTR_ERR(gpio_base);
 
Signature · 1 line
1.9.1
#113 lore raw

PATCH 42/42 drivers: gpio: use devm_platform_ioremap_resource()

In reply to Enrico Weigelt, metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-zynq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-zynq.c +1 -3
index 00ff7b1..9392eda 100644
@@ -834,7 +834,6 @@ static int zynq_gpio_probe(struct platform_device *pdev)
 	int ret, bank_num;
 	struct zynq_gpio *gpio;
 	struct gpio_chip *chip;
-	struct resource *res;
 	const struct of_device_id *match;
 
 	gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
@@ -849,8 +848,7 @@ static int zynq_gpio_probe(struct platform_device *pdev)
 	gpio->p_data = match->data;
 	platform_set_drvdata(pdev, gpio);
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	gpio->base_addr = devm_ioremap_resource(&pdev->dev, res);
+	gpio->base_addr = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(gpio->base_addr))
 		return PTR_ERR(gpio->base_addr);
 
Signature · 1 line
1.9.1
#114 lore raw

Re: [PATCH 42/42] drivers: gpio: use devm_platform_ioremap_resource()

Quoted 7 lines · metux IT consult

Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together.

---
 drivers/gpio/gpio-zynq.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Subject prefix doesn't seem to match for this driver.

Thierry