linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jianqun Xu <jay.xu@rock-chips.com>
To: heiko@sntech.de
Cc: linus.walleij@linaro.org, huangtao@rock-chips.com,
	kever.yang@rock-chips.com, linux-rockchip@lists.infradead.org,
	linux-gpio@vger.kernel.org, Jianqun Xu <jay.xu@rock-chips.com>
Subject: [PATCH 1/4] gpio: rockchip: get regmap by devm_platform_ioremap_resource
Date: Tue,  8 Mar 2022 14:19:32 +0800	[thread overview]
Message-ID: <20220308061935.2441447-2-jay.xu@rock-chips.com> (raw)
In-Reply-To: <20220308061935.2441447-1-jay.xu@rock-chips.com>

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 --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)
-- 
2.25.1


  reply	other threads:[~2022-03-08  6:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08  6:19 [PATCH RESEND 0/4] gpio-before-pinctrl Jianqun Xu
2022-03-08  6:19 ` Jianqun Xu [this message]
2022-03-08  6:19 ` [PATCH 2/4] gpio: rockchip: get irq support for both dt and acpi Jianqun Xu
2022-03-10 11:44   ` Andy Shevchenko
2022-03-08  6:19 ` [PATCH 3/4] gpio: rockchip: support driver to work independs on pinctrl Jianqun Xu
2022-03-08  6:19 ` [PATCH 4/4] pinctrl: rockchip: register gpio driver before pinctrl driver Jianqun Xu
  -- strict thread matches above, loose matches on Subject: below --
2022-03-08  3:25 [PATCH 0/4] gpio-before-pinctrl Jianqun Xu
2022-03-08  3:25 ` [PATCH 1/4] gpio: rockchip: get regmap by devm_platform_ioremap_resource Jianqun Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220308061935.2441447-2-jay.xu@rock-chips.com \
    --to=jay.xu@rock-chips.com \
    --cc=heiko@sntech.de \
    --cc=huangtao@rock-chips.com \
    --cc=kever.yang@rock-chips.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).