From: qiwuchen55@gmail.com
To: linus.walleij@linaro.org, bgolaszewski@baylibre.com
Cc: linux-gpio@vger.kernel.org, chenqiwu <chenqiwu@xiaomi.com>
Subject: [PATCH] gpio: mmio: use devm_platform_ioremap_resource_byname()
Date: Fri, 14 Feb 2020 22:30:02 +0800 [thread overview]
Message-ID: <1581690602-345-1-git-send-email-qiwuchen55@gmail.com> (raw)
From: chenqiwu <chenqiwu@xiaomi.com>
Use devm_platform_ioremap_resource_byname() instead of calling
platform_get_resource_byname() and devm_ioremap_resource() separately.
Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
---
drivers/gpio/gpio-mmio.c | 26 +++++++-------------------
1 file changed, 7 insertions(+), 19 deletions(-)
diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
index f729e3e..5cfef3c 100644
--- a/drivers/gpio/gpio-mmio.c
+++ b/drivers/gpio/gpio-mmio.c
@@ -655,21 +655,9 @@ int bgpio_init(struct gpio_chip *gc, struct device *dev,
#if IS_ENABLED(CONFIG_GPIO_GENERIC_PLATFORM)
static void __iomem *bgpio_map(struct platform_device *pdev,
- const char *name,
- resource_size_t sane_sz)
+ const char *name)
{
- struct resource *r;
- resource_size_t sz;
-
- r = platform_get_resource_byname(pdev, IORESOURCE_MEM, name);
- if (!r)
- return NULL;
-
- sz = resource_size(r);
- if (sz != sane_sz)
- return IOMEM_ERR_PTR(-EINVAL);
-
- return devm_ioremap_resource(&pdev->dev, r);
+ return devm_platform_ioremap_resource_byname(pdev, name);
}
#ifdef CONFIG_OF
@@ -742,23 +730,23 @@ static int bgpio_pdev_probe(struct platform_device *pdev)
sz = resource_size(r);
- dat = bgpio_map(pdev, "dat", sz);
+ dat = bgpio_map(pdev, "dat");
if (IS_ERR(dat))
return PTR_ERR(dat);
- set = bgpio_map(pdev, "set", sz);
+ set = bgpio_map(pdev, "set");
if (IS_ERR(set))
return PTR_ERR(set);
- clr = bgpio_map(pdev, "clr", sz);
+ clr = bgpio_map(pdev, "clr");
if (IS_ERR(clr))
return PTR_ERR(clr);
- dirout = bgpio_map(pdev, "dirout", sz);
+ dirout = bgpio_map(pdev, "dirout");
if (IS_ERR(dirout))
return PTR_ERR(dirout);
- dirin = bgpio_map(pdev, "dirin", sz);
+ dirin = bgpio_map(pdev, "dirin");
if (IS_ERR(dirin))
return PTR_ERR(dirin);
--
1.9.1
next reply other threads:[~2020-02-14 14:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-14 14:30 qiwuchen55 [this message]
2020-02-17 10:02 ` [PATCH] gpio: mmio: use devm_platform_ioremap_resource_byname() Bartosz Golaszewski
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=1581690602-345-1-git-send-email-qiwuchen55@gmail.com \
--to=qiwuchen55@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=chenqiwu@xiaomi.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.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).