Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1218846
| From | Vaishali Thakkar <vthakkar1994@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v2] leds: leds-cobalt-qube: Use devm_led_classdev_register |
| Date | 2015-09-04 13:40 +0200 |
| Message-ID | <q4XvA-Oj-9@gated-at.bofh.it> (permalink) |
| References | <q3T11-6Dv-25@gated-at.bofh.it> <q4XlU-D8-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Sep 4, 2015 at 4:54 PM, Jacek Anaszewski
<j.anaszewski@samsung.com> wrote:
> Hi Vaishali,
>
>
> On 09/01/2015 02:35 PM, 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, unneeded label err_null is dropped and unnecessary variable
>> retval is removed. Also, remove redundant cobalt_qube_led_remove.
>>
>> Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
>> ---
>> Changes since v1:
>> - Remove use of variable retval
>> - Change commit log
>> ---
>> drivers/leds/leds-cobalt-qube.c | 21 +--------------------
>> 1 file changed, 1 insertion(+), 20 deletions(-)
>>
>> diff --git a/drivers/leds/leds-cobalt-qube.c
>> b/drivers/leds/leds-cobalt-qube.c
>> index d975220..f1374d2 100644
>> --- a/drivers/leds/leds-cobalt-qube.c
>> +++ b/drivers/leds/leds-cobalt-qube.c
>> @@ -36,7 +36,6 @@ static struct led_classdev qube_front_led = {
>> static int cobalt_qube_led_probe(struct platform_device *pdev)
>> {
>> struct resource *res;
>> - int retval;
>>
>> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> if (!res)
>> @@ -49,31 +48,13 @@ 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);
>> - 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 devm_led_classdev_register(&pdev->dev, &qube_front_led);
>>
>> return 0;
>
>
> Merged, after removing stray "return 0", thanks.
Oops! my bad. Thanks.
>> }
>>
>> 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/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH v2] leds: leds-cobalt-qube: Use devm_led_classdev_register Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-09-01 14:40 +0200
Re: [PATCH v2] leds: leds-cobalt-qube: Use devm_led_classdev_register Jacek Anaszewski <j.anaszewski@samsung.com> - 2015-09-04 13:30 +0200
Re: [PATCH v2] leds: leds-cobalt-qube: Use devm_led_classdev_register Vaishali Thakkar <vthakkar1994@gmail.com> - 2015-09-04 13:40 +0200
csiph-web