linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Revert "gpio: eic-sprd: Use devm_platform_ioremap_resource()"
@ 2020-04-01  9:59 Baolin Wang
  2020-04-02  7:40 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Baolin Wang @ 2020-04-01  9:59 UTC (permalink / raw)
  To: linus.walleij, bgolaszewski
  Cc: orsonzhai, zhang.lyra, baolin.wang7, linux-gpio, linux-kernel

This reverts commit 0f5cb8cc27a266c81e6523b436479802e9aafc9e.

This commit will cause below warnings, since our EIC controller can support
differnt banks on different Spreadtrum SoCs, and each bank has its own base
address, we will get invalid resource warning if the bank number is less than
SPRD_EIC_MAX_BANK on some Spreadtrum SoCs.

So we should not use devm_platform_ioremap_resource() here to remove the
warnings.

[    1.118508] sprd-eic 40210000.gpio: invalid resource
[    1.118535] sprd-eic 40210000.gpio: invalid resource
[    1.119034] sprd-eic 40210080.gpio: invalid resource
[    1.119055] sprd-eic 40210080.gpio: invalid resource
[    1.119462] sprd-eic 402100a0.gpio: invalid resource
[    1.119482] sprd-eic 402100a0.gpio: invalid resource
[    1.119893] sprd-eic 402100c0.gpio: invalid resource
[    1.119913] sprd-eic 402100c0.gpio: invalid resource

Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>
---
 drivers/gpio/gpio-eic-sprd.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c
index bb287f3..8c97577 100644
--- a/drivers/gpio/gpio-eic-sprd.c
+++ b/drivers/gpio/gpio-eic-sprd.c
@@ -569,6 +569,7 @@ 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);
@@ -595,9 +596,13 @@ static int sprd_eic_probe(struct platform_device *pdev)
 		 * have one bank EIC, thus base[1] and base[2] can be
 		 * optional.
 		 */
-		sprd_eic->base[i] = devm_platform_ioremap_resource(pdev, i);
-		if (IS_ERR(sprd_eic->base[i]))
+		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
+		if (!res)
 			continue;
+
+		sprd_eic->base[i] = devm_ioremap_resource(&pdev->dev, res);
+		if (IS_ERR(sprd_eic->base[i]))
+			return PTR_ERR(sprd_eic->base[i]);
 	}
 
 	sprd_eic->chip.label = sprd_eic_label_name[sprd_eic->type];
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Revert "gpio: eic-sprd: Use devm_platform_ioremap_resource()"
  2020-04-01  9:59 [PATCH] Revert "gpio: eic-sprd: Use devm_platform_ioremap_resource()" Baolin Wang
@ 2020-04-02  7:40 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2020-04-02  7:40 UTC (permalink / raw)
  To: Baolin Wang
  Cc: Bartosz Golaszewski, Orson Zhai, Lyra Zhang,
	open list:GPIO SUBSYSTEM, linux-kernel

On Wed, Apr 1, 2020 at 11:59 AM Baolin Wang <baolin.wang7@gmail.com> wrote:

> This reverts commit 0f5cb8cc27a266c81e6523b436479802e9aafc9e.
>
> This commit will cause below warnings, since our EIC controller can support
> differnt banks on different Spreadtrum SoCs, and each bank has its own base
> address, we will get invalid resource warning if the bank number is less than
> SPRD_EIC_MAX_BANK on some Spreadtrum SoCs.
>
> So we should not use devm_platform_ioremap_resource() here to remove the
> warnings.
>
> [    1.118508] sprd-eic 40210000.gpio: invalid resource
> [    1.118535] sprd-eic 40210000.gpio: invalid resource
> [    1.119034] sprd-eic 40210080.gpio: invalid resource
> [    1.119055] sprd-eic 40210080.gpio: invalid resource
> [    1.119462] sprd-eic 402100a0.gpio: invalid resource
> [    1.119482] sprd-eic 402100a0.gpio: invalid resource
> [    1.119893] sprd-eic 402100c0.gpio: invalid resource
> [    1.119913] sprd-eic 402100c0.gpio: invalid resource
>
> Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-02  7:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-01  9:59 [PATCH] Revert "gpio: eic-sprd: Use devm_platform_ioremap_resource()" Baolin Wang
2020-04-02  7:40 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).