Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1214329 > unrolled thread
| Started by | Vaishali Thakkar <vthakkar1994@gmail.com> |
|---|---|
| First post | 2015-08-27 07:20 +0200 |
| Last post | 2015-08-28 10:20 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] leds: leds-cobalt-qube: Use devm_led_classdev_register Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-08-27 07:20 +0200
Re: [PATCH] leds: leds-cobalt-qube: Use devm_led_classdev_register Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-08-27 09:30 +0200
Re: [PATCH] leds: leds-cobalt-qube: Use devm_led_classdev_register Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-08-28 10:20 +0200
| From | Vaishali Thakkar <vthakkar1994@gmail.com> |
|---|---|
| Date | 2015-08-27 07:20 +0200 |
| Subject | [PATCH] leds: leds-cobalt-qube: Use devm_led_classdev_register |
| Message-ID | <q1XLr-3ac-1@gated-at.bofh.it> |
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;
-
- 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",
},
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jacek Anaszewski <j.anaszewski@samsung.com> |
|---|---|
| Date | 2015-08-27 09:30 +0200 |
| Message-ID | <q1ZNg-60L-13@gated-at.bofh.it> |
| In reply to | #1214329 |
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Vaishali Thakkar <vthakkar1994@gmail.com> |
|---|---|
| Date | 2015-08-28 10:20 +0200 |
| Message-ID | <q2n3c-5ZO-7@gated-at.bofh.it> |
| In reply to | #1214364 |
On Thu, Aug 27, 2015 at 12:56 PM, Jacek Anaszewski
<j.anaszewski@samsung.com> wrote:
> 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.
Sure. This makes sense. I will send v2 with the change.
Thanks.
>> -
>> - 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
--
Vaishali
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web