diff mbox series

[1/4] gpio: rockchip: get regmap by devm_platform_ioremap_resource

Message ID 20220308061935.2441447-2-jay.xu@rock-chips.com (mailing list archive)
State New, archived
Headers show
Series gpio-before-pinctrl | expand

Commit Message

Jianqun Xu March 8, 2022, 6:19 a.m. UTC
Use devm_platform_ioremap_resource to get the reg from device.

Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
 drivers/gpio/gpio-rockchip.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-rockchip.c b/drivers/gpio/gpio-rockchip.c
index a4c4e4584f5b..b67038572285 100644
--- a/drivers/gpio/gpio-rockchip.c
+++ b/drivers/gpio/gpio-rockchip.c
@@ -637,18 +637,8 @@  static int rockchip_gpiolib_register(struct rockchip_pin_bank *bank)
 
 static int rockchip_get_bank_data(struct rockchip_pin_bank *bank)
 {
-	struct resource res;
 	int id = 0;
 
-	if (of_address_to_resource(bank->of_node, 0, &res)) {
-		dev_err(bank->dev, "cannot find IO resource for bank\n");
-		return -ENOENT;
-	}
-
-	bank->reg_base = devm_ioremap_resource(bank->dev, &res);
-	if (IS_ERR(bank->reg_base))
-		return PTR_ERR(bank->reg_base);
-
 	bank->irq = irq_of_parse_and_map(bank->of_node, 0);
 	if (!bank->irq)
 		return -EINVAL;
@@ -727,6 +717,9 @@  static int rockchip_gpio_probe(struct platform_device *pdev)
 	bank->of_node = np;
 
 	raw_spin_lock_init(&bank->slock);
+	bank->reg_base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(bank->reg_base))
+		return PTR_ERR(bank->reg_base);
 
 	ret = rockchip_get_bank_data(bank);
 	if (ret)