All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Vaishali Thakkar <vthakkar1994@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: leds-cobalt-qube: Use devm_led_classdev_register
Date: Thu, 27 Aug 2015 09:26:53 +0200	[thread overview]
Message-ID: <55DEBBBD.9010802@samsung.com> (raw)
In-Reply-To: <20150827051302.GA10275@localhost>

Hi Vaishali,

Thanks for the patch.

On 08/27/2015 07:13 AM, Vaishali Thakkar wrote:
> Use resource-managed function devm_led_classdev_register instead
> of led_classdev_register to make the error-path simpler.
>
> To be compatible with the change, goto is replaced with direct
> return and unneeded label is dropped. Also, remove redundant
> cobalt_qube_led_remove.
>
> Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
> ---
>   drivers/leds/leds-cobalt-qube.c | 20 ++------------------
>   1 file changed, 2 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/leds/leds-cobalt-qube.c b/drivers/leds/leds-cobalt-qube.c
> index d975220..59818df 100644
> --- a/drivers/leds/leds-cobalt-qube.c
> +++ b/drivers/leds/leds-cobalt-qube.c
> @@ -49,31 +49,15 @@ static int cobalt_qube_led_probe(struct platform_device *pdev)
>   	led_value = LED_FRONT_LEFT | LED_FRONT_RIGHT;
>   	writeb(led_value, led_port);
>
> -	retval = led_classdev_register(&pdev->dev, &qube_front_led);
> +	retval = devm_led_classdev_register(&pdev->dev, &qube_front_led);
>   	if (retval)
> -		goto err_null;

We can spare more lines by changing this to:

return devm_led_classdev_register(&pdev->dev, &qube_front_led);

You could get rid of retval then, too.

> -
> -	return 0;
> -
> -err_null:
> -	led_port = NULL;
> -
> -	return retval;
> -}
> -
> -static int cobalt_qube_led_remove(struct platform_device *pdev)
> -{
> -	led_classdev_unregister(&qube_front_led);
> -
> -	if (led_port)
> -		led_port = NULL;
> +		return retval;
>
>   	return 0;
>   }
>
>   static struct platform_driver cobalt_qube_led_driver = {
>   	.probe	= cobalt_qube_led_probe,
> -	.remove	= cobalt_qube_led_remove,
>   	.driver	= {
>   		.name	= "cobalt-qube-leds",
>   	},
>


-- 
Best Regards,
Jacek Anaszewski

  reply	other threads:[~2015-08-27  7:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-27  5:13 [PATCH] leds: leds-cobalt-qube: Use devm_led_classdev_register Vaishali Thakkar
2015-08-27  7:26 ` Jacek Anaszewski [this message]
2015-08-28  8:19   ` Vaishali Thakkar

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=55DEBBBD.9010802@samsung.com \
    --to=j.anaszewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=vthakkar1994@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.