linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] staging: fieldbus: arcx-anybus:use devm_platform_ioremap_resource() to simplify code
@ 2019-10-16  8:50 YueHaibing
  2019-10-16 20:57 ` Sven Van Asbroeck
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2019-10-16  8:50 UTC (permalink / raw)
  To: TheSven73, gregkh; +Cc: devel, linux-kernel, YueHaibing

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/staging/fieldbus/anybuss/arcx-anybus.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/fieldbus/anybuss/arcx-anybus.c b/drivers/staging/fieldbus/anybuss/arcx-anybus.c
index 2ecffa4..5b8d0ba 100644
--- a/drivers/staging/fieldbus/anybuss/arcx-anybus.c
+++ b/drivers/staging/fieldbus/anybuss/arcx-anybus.c
@@ -127,12 +127,10 @@ static const struct regmap_config arcx_regmap_cfg = {
 static struct regmap *create_parallel_regmap(struct platform_device *pdev,
 					     int idx)
 {
-	struct resource *res;
 	void __iomem *base;
 	struct device *dev = &pdev->dev;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, idx + 1);
-	base = devm_ioremap_resource(dev, res);
+	base = devm_platform_ioremap_resource(pdev, idx + 1);
 	if (IS_ERR(base))
 		return ERR_CAST(base);
 	return devm_regmap_init_mmio(dev, base, &arcx_regmap_cfg);
@@ -230,7 +228,6 @@ static int controller_probe(struct platform_device *pdev)
 	struct regulator_config config = { };
 	struct regulator_dev *regulator;
 	int err, id;
-	struct resource *res;
 	struct anybuss_host *host;
 	u8 status1, cap;
 
@@ -244,8 +241,7 @@ static int controller_probe(struct platform_device *pdev)
 		return PTR_ERR(cd->reset_gpiod);
 
 	/* CPLD control memory, sits at index 0 */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	cd->cpld_base = devm_ioremap_resource(dev, res);
+	cd->cpld_base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(cd->cpld_base)) {
 		dev_err(dev,
 			"failed to map cpld base address\n");
-- 
2.7.4



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

* Re: [PATCH -next] staging: fieldbus: arcx-anybus:use devm_platform_ioremap_resource() to simplify code
  2019-10-16  8:50 [PATCH -next] staging: fieldbus: arcx-anybus:use devm_platform_ioremap_resource() to simplify code YueHaibing
@ 2019-10-16 20:57 ` Sven Van Asbroeck
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Van Asbroeck @ 2019-10-16 20:57 UTC (permalink / raw)
  To: YueHaibing; +Cc: Greg KH, devel, Linux Kernel Mailing List

On Wed, Oct 16, 2019 at 4:50 AM YueHaibing <yuehaibing@huawei.com> wrote:
>
> Use devm_platform_ioremap_resource() to simplify the code a bit.
> This is detected by coccinelle.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
>  drivers/staging/fieldbus/anybuss/arcx-anybus.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)

This is a duplicate of hariprasad's patch:
https://lkml.org/lkml/2019/10/8/525

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

end of thread, other threads:[~2019-10-16 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16  8:50 [PATCH -next] staging: fieldbus: arcx-anybus:use devm_platform_ioremap_resource() to simplify code YueHaibing
2019-10-16 20:57 ` Sven Van Asbroeck

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