public inbox for linux-leds@vger.kernel.org
 help / color / mirror / Atom feed
From: chenqiwu <qiwuchen55@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: jacek.anaszewski@gmail.com, dmurphy@ti.com,
	linux-leds@vger.kernel.org, chenqiwu <chenqiwu@xiaomi.com>
Subject: Re: [PATCH] leds: use devm_platform_ioremap_resource_byname()
Date: Wed, 26 Feb 2020 23:17:54 +0800	[thread overview]
Message-ID: <20200226151753.GA17825@cqw-OptiPlex-7050> (raw)
In-Reply-To: <20200226135343.GG4080@duo.ucw.cz>

Hi, Pavel,
> 
> > 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>
> 
> Was this tested? Can you cc driver authors to get it tested?

I will resend this patch cc driver authors to get it tested.
 
> > index ef22e1e..76af9d8 100644
> > --- a/drivers/leds/leds-cobalt-qube.c
> > +++ b/drivers/leds/leds-cobalt-qube.c
> > @@ -36,15 +36,9 @@ static void qube_front_led_set(struct led_classdev *led_cdev,
> >  
> >  static int cobalt_qube_led_probe(struct platform_device *pdev)
> >  {
> > -	struct resource *res;
> > -
> > -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > -	if (!res)
> > -		return -EBUSY;
> > -
> > -	led_port = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> > -	if (!led_port)
> > -		return -ENOMEM;
> > +	led_port = devm_platform_ioremap_resource(pdev, 0);
> > +	if (IS_ERR(led_port))
> > +		return PTR_ERR(led_port);
> >  
> >  	led_value = LED_FRONT_LEFT | LED_FRONT_RIGHT;
> >  	writeb(led_value, led_port);
> > diff --git a/drivers/leds/leds-cobalt-raq.c b/drivers/leds/leds-cobalt-raq.c
> > index 045c239..8b1317d 100644
> > --- a/drivers/leds/leds-cobalt-raq.c
> > +++ b/drivers/leds/leds-cobalt-raq.c
> > @@ -65,16 +65,11 @@ static void raq_power_off_led_set(struct led_classdev *led_cdev,
> >  
> >  static int cobalt_raq_led_probe(struct platform_device *pdev)
> >  {
> > -	struct resource *res;
> >  	int retval;
> >  
> > -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > -	if (!res)
> > -		return -EBUSY;
> > -
> > -	led_port = devm_ioremap(&pdev->dev, res->start, resource_size(res));
> > -	if (!led_port)
> > -		return -ENOMEM;
> > +	led_port = devm_platform_ioremap_resource(pdev, 0);
> > +	if (IS_ERR(led_port))
> > +		return PTR_ERR(led_port);
> >  
> >  	retval = led_classdev_register(&pdev->dev, &raq_power_off_led);
> >  	if (retval)
> > @@ -90,6 +85,7 @@ static int cobalt_raq_led_probe(struct platform_device *pdev)
> >  	led_classdev_unregister(&raq_power_off_led);
> >  
> >  err_null:
> > +	devm_ioremap_release(&pdev->dev, led_port);
> >  	led_port = NULL;
> >  
> >  	return retval;
> 
> How is it that manual devm_ioremap_release() is neccessary here but
> not in the other driver?

Thanks for your remind! This is neccessary for leds-cobalt-qube driver
to apply, too.

BRs,
Qiwu

      reply	other threads:[~2020-02-26 15:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-14 15:48 [PATCH] leds: use devm_platform_ioremap_resource_byname() qiwuchen55
2020-02-26 13:53 ` Pavel Machek
2020-02-26 15:17   ` chenqiwu [this message]

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=20200226151753.GA17825@cqw-OptiPlex-7050 \
    --to=qiwuchen55@gmail.com \
    --cc=chenqiwu@xiaomi.com \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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