[openwrt/openwrt] ramips: gpio: use devm_platform_ioremap_resource()

LEDE Commits lede-commits at lists.infradead.org
Thu Jul 4 13:25:02 PDT 2024


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/7be6323d3fe6d6f13e60f2156ab4d9aaea0143de

commit 7be6323d3fe6d6f13e60f2156ab4d9aaea0143de
Author: Shiji Yang <yangshiji66 at qq.com>
AuthorDate: Fri Jun 28 15:36:13 2024 +0800

    ramips: gpio: use devm_platform_ioremap_resource()
    
    Simplify the code.
    
    Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 ...-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/target/linux/ramips/patches-6.6/802-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch b/target/linux/ramips/patches-6.6/802-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch
index a79bb7e5bf..3bebbc13ac 100644
--- a/target/linux/ramips/patches-6.6/802-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch
+++ b/target/linux/ramips/patches-6.6/802-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch
@@ -9,8 +9,8 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
 ---
  drivers/gpio/Kconfig       |   6 +
  drivers/gpio/Makefile      |   1 +
- drivers/gpio/gpio-ralink.c | 336 +++++++++++++++++++++++++++++++++++++
- 3 files changed, 343 insertions(+)
+ drivers/gpio/gpio-ralink.c | 328 +++++++++++++++++++++++++++++++++++++
+ 3 files changed, 335 insertions(+)
  create mode 100644 drivers/gpio/gpio-ralink.c
 
 --- a/drivers/gpio/Kconfig
@@ -40,7 +40,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
  obj-$(CONFIG_GPIO_RCAR)			+= gpio-rcar.o
 --- /dev/null
 +++ b/drivers/gpio/gpio-ralink.c
-@@ -0,0 +1,336 @@
+@@ -0,0 +1,328 @@
 +/*
 + * This program is free software; you can redistribute it and/or modify it
 + * under the terms of the GNU General Public License version 2 as published
@@ -299,25 +299,17 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
 +static int ralink_gpio_probe(struct platform_device *pdev)
 +{
 +	struct device_node *np = pdev->dev.of_node;
-+	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 +	struct ralink_gpio_chip *rg;
 +	const __be32 *ngpio;
 +
-+	if (!res) {
-+		dev_err(&pdev->dev, "failed to find resource\n");
-+		return -ENOMEM;
-+	}
-+
 +	rg = devm_kzalloc(&pdev->dev,
 +			sizeof(struct ralink_gpio_chip), GFP_KERNEL);
 +	if (!rg)
 +		return -ENOMEM;
 +
-+	rg->membase = devm_ioremap_resource(&pdev->dev, res);
-+	if (!rg->membase) {
-+		dev_err(&pdev->dev, "cannot remap I/O memory region\n");
-+		return -ENOMEM;
-+	}
++	rg->membase = devm_platform_ioremap_resource(pdev, 0);
++	if (IS_ERR(rg->membase))
++		return PTR_ERR(rg->membase);
 +
 +	if (of_property_read_u8_array(np, "ralink,register-map",
 +			rg->regs, GPIO_REG_MAX)) {




More information about the lede-commits mailing list