linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl:Convert the composition of devm_request_mem_region and devm_ioremap to a single call
@ 2015-10-30  7:51 Sanjeev Sharma
  2015-10-30 19:53 ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Sanjeev Sharma @ 2015-10-30  7:51 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, Sanjeev Sharma

Use devm_ioremap_resource() in order to make the code simpler,
and remove redundant return value check of platform_get_resource()
because this value is alreadytaken care by devm_ioremap_resource()

Signed-off-by: Sanjeev Sharma <sanjeev_sharma@mentor.com>
---
 drivers/pinctrl/pinctrl-single.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index ef04b96..905cc0a 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1865,24 +1865,9 @@ static int pcs_probe(struct platform_device *pdev)
 						  "pinctrl-single,bit-per-mux");
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(pcs->dev, "could not get resource\n");
-		return -ENODEV;
-	}
-
-	pcs->res = devm_request_mem_region(pcs->dev, res->start,
-			resource_size(res), DRIVER_NAME);
-	if (!pcs->res) {
-		dev_err(pcs->dev, "could not get mem_region\n");
-		return -EBUSY;
-	}
-
-	pcs->size = resource_size(pcs->res);
-	pcs->base = devm_ioremap(pcs->dev, pcs->res->start, pcs->size);
-	if (!pcs->base) {
-		dev_err(pcs->dev, "could not ioremap\n");
-		return -ENODEV;
-	}
+	pcs->base = devm_ioremap_resource(pcs->dev, res);
+	if (IS_ERR(pcs->base))
+		return PTR_ERR(pcs->base);
 
 	INIT_RADIX_TREE(&pcs->pgtree, GFP_KERNEL);
 	INIT_RADIX_TREE(&pcs->ftree, GFP_KERNEL);
-- 
1.7.11.7


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

* Re: [PATCH] pinctrl:Convert the composition of devm_request_mem_region and devm_ioremap to a single call
  2015-10-30  7:51 [PATCH] pinctrl:Convert the composition of devm_request_mem_region and devm_ioremap to a single call Sanjeev Sharma
@ 2015-10-30 19:53 ` Linus Walleij
  2015-12-03 21:44   ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2015-10-30 19:53 UTC (permalink / raw)
  To: Sanjeev Sharma, Tony Lindgren, Haojian Zhuang
  Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org

Please run posts like this by the maintainers. Tony Lindgren is one
user, Haojian is another.

Your top-poster,
Linus Walleij

On Fri, Oct 30, 2015 at 8:51 AM, Sanjeev Sharma
<sanjeev_sharma@mentor.com> wrote:
> Use devm_ioremap_resource() in order to make the code simpler,
> and remove redundant return value check of platform_get_resource()
> because this value is alreadytaken care by devm_ioremap_resource()
>
> Signed-off-by: Sanjeev Sharma <sanjeev_sharma@mentor.com>
> ---
>  drivers/pinctrl/pinctrl-single.c | 21 +++------------------
>  1 file changed, 3 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> index ef04b96..905cc0a 100644
> --- a/drivers/pinctrl/pinctrl-single.c
> +++ b/drivers/pinctrl/pinctrl-single.c
> @@ -1865,24 +1865,9 @@ static int pcs_probe(struct platform_device *pdev)
>                                                   "pinctrl-single,bit-per-mux");
>
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -       if (!res) {
> -               dev_err(pcs->dev, "could not get resource\n");
> -               return -ENODEV;
> -       }
> -
> -       pcs->res = devm_request_mem_region(pcs->dev, res->start,
> -                       resource_size(res), DRIVER_NAME);
> -       if (!pcs->res) {
> -               dev_err(pcs->dev, "could not get mem_region\n");
> -               return -EBUSY;
> -       }
> -
> -       pcs->size = resource_size(pcs->res);
> -       pcs->base = devm_ioremap(pcs->dev, pcs->res->start, pcs->size);
> -       if (!pcs->base) {
> -               dev_err(pcs->dev, "could not ioremap\n");
> -               return -ENODEV;
> -       }
> +       pcs->base = devm_ioremap_resource(pcs->dev, res);
> +       if (IS_ERR(pcs->base))
> +               return PTR_ERR(pcs->base);
>
>         INIT_RADIX_TREE(&pcs->pgtree, GFP_KERNEL);
>         INIT_RADIX_TREE(&pcs->ftree, GFP_KERNEL);
> --
> 1.7.11.7
>

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

* Re: [PATCH] pinctrl:Convert the composition of devm_request_mem_region and devm_ioremap to a single call
  2015-10-30 19:53 ` Linus Walleij
@ 2015-12-03 21:44   ` Tony Lindgren
  2015-12-10 18:17     ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2015-12-03 21:44 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Sanjeev Sharma, Haojian Zhuang, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org

* Linus Walleij <linus.walleij@linaro.org> [151030 12:54]:
> Please run posts like this by the maintainers. Tony Lindgren is one
> user, Haojian is another.

I think we need to add ourselves to MAINTAINERS for this driver,
otherwise we'll keep on missing emails.

> On Fri, Oct 30, 2015 at 8:51 AM, Sanjeev Sharma
> <sanjeev_sharma@mentor.com> wrote:
> > Use devm_ioremap_resource() in order to make the code simpler,
> > and remove redundant return value check of platform_get_resource()
> > because this value is alreadytaken care by devm_ioremap_resource()
> >
> > Signed-off-by: Sanjeev Sharma <sanjeev_sharma@mentor.com>
> > ---
> >  drivers/pinctrl/pinctrl-single.c | 21 +++------------------
> >  1 file changed, 3 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
> > index ef04b96..905cc0a 100644
> > --- a/drivers/pinctrl/pinctrl-single.c
> > +++ b/drivers/pinctrl/pinctrl-single.c
> > @@ -1865,24 +1865,9 @@ static int pcs_probe(struct platform_device *pdev)
> >                                                   "pinctrl-single,bit-per-mux");
> >
> >         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > -       if (!res) {
> > -               dev_err(pcs->dev, "could not get resource\n");
> > -               return -ENODEV;
> > -       }
> > -
> > -       pcs->res = devm_request_mem_region(pcs->dev, res->start,
> > -                       resource_size(res), DRIVER_NAME);
> > -       if (!pcs->res) {
> > -               dev_err(pcs->dev, "could not get mem_region\n");
> > -               return -EBUSY;
> > -       }
> > -
> > -       pcs->size = resource_size(pcs->res);
> > -       pcs->base = devm_ioremap(pcs->dev, pcs->res->start, pcs->size);
> > -       if (!pcs->base) {
> > -               dev_err(pcs->dev, "could not ioremap\n");
> > -               return -ENODEV;
> > -       }
> > +       pcs->base = devm_ioremap_resource(pcs->dev, res);
> > +       if (IS_ERR(pcs->base))
> > +               return PTR_ERR(pcs->base);
> >
> >         INIT_RADIX_TREE(&pcs->pgtree, GFP_KERNEL);
> >         INIT_RADIX_TREE(&pcs->ftree, GFP_KERNEL);

This won't work, we're using the physical address from pcs->res in the
code at least in pcs_add_pin.

Regards,

Tony

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

* Re: [PATCH] pinctrl:Convert the composition of devm_request_mem_region and devm_ioremap to a single call
  2015-12-03 21:44   ` Tony Lindgren
@ 2015-12-10 18:17     ` Linus Walleij
  2015-12-10 22:31       ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2015-12-10 18:17 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Sanjeev Sharma, Haojian Zhuang, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org

On Thu, Dec 3, 2015 at 10:44 PM, Tony Lindgren <tony@atomide.com> wrote:
> * Linus Walleij <linus.walleij@linaro.org> [151030 12:54]:
>> Please run posts like this by the maintainers. Tony Lindgren is one
>> user, Haojian is another.
>
> I think we need to add ourselves to MAINTAINERS for this driver,
> otherwise we'll keep on missing emails.

Good idea! Patches accepted.

> This won't work, we're using the physical address from pcs->res in the
> code at least in pcs_add_pin.

Dropping this patch for now.

Yours,
Linus Walleij

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

* Re: [PATCH] pinctrl:Convert the composition of devm_request_mem_region and devm_ioremap to a single call
  2015-12-10 18:17     ` Linus Walleij
@ 2015-12-10 22:31       ` Tony Lindgren
  2015-12-14 14:03         ` Linus Walleij
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2015-12-10 22:31 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Sanjeev Sharma, Haojian Zhuang, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-omap

* Linus Walleij <linus.walleij@linaro.org> [151210 10:18]:
> On Thu, Dec 3, 2015 at 10:44 PM, Tony Lindgren <tony@atomide.com> wrote:
> > * Linus Walleij <linus.walleij@linaro.org> [151030 12:54]:
> >> Please run posts like this by the maintainers. Tony Lindgren is one
> >> user, Haojian is another.
> >
> > I think we need to add ourselves to MAINTAINERS for this driver,
> > otherwise we'll keep on missing emails.
> 
> Good idea! Patches accepted.

How about this one below?

Regards,

Tony

8< -----------------------
From: Tony Lindgren <tony@atomide.com>
Date: Thu, 10 Dec 2015 14:27:32 -0800
Subject: [PATCH] MAINTAINERS: pinctrl: Add maintainers for pinctrl-single

Otherwise we keep missing patches related to this driver.

Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>

--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8379,6 +8379,14 @@ L:	linux-samsung-soc@vger.kernel.org (moderated for non-subscribers)
 S:	Maintained
 F:	drivers/pinctrl/samsung/
 
+PIN CONTROLLER - SINGLE
+M:	Tony Lindgren <tony@atomide.com>
+M:	Haojian Zhuang <haojian.zhuang@linaro.org>
+L:	linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+L:	linux-omap@vger.kernel.org
+S:	Maintained
+F:	drivers/pinctrl/pinctrl-single.c
+
 PIN CONTROLLER - ST SPEAR
 M:	Viresh Kumar <vireshk@kernel.org>
 L:	spear-devel@list.st.com

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

* Re: [PATCH] pinctrl:Convert the composition of devm_request_mem_region and devm_ioremap to a single call
  2015-12-10 22:31       ` Tony Lindgren
@ 2015-12-14 14:03         ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2015-12-14 14:03 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Sanjeev Sharma, Haojian Zhuang, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, Linux-OMAP

On Thu, Dec 10, 2015 at 11:31 PM, Tony Lindgren <tony@atomide.com> wrote:

>> >
>> > I think we need to add ourselves to MAINTAINERS for this driver,
>> > otherwise we'll keep on missing emails.
>>
>> Good idea! Patches accepted.
>
> How about this one below?

Patch applied for fixes!

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-12-14 14:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-30  7:51 [PATCH] pinctrl:Convert the composition of devm_request_mem_region and devm_ioremap to a single call Sanjeev Sharma
2015-10-30 19:53 ` Linus Walleij
2015-12-03 21:44   ` Tony Lindgren
2015-12-10 18:17     ` Linus Walleij
2015-12-10 22:31       ` Tony Lindgren
2015-12-14 14:03         ` Linus Walleij

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