[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-id: <5624A04A.6060209@samsung.com>
Date: Mon, 19 Oct 2015 09:48:26 +0200
From: Jacek Anaszewski <j.anaszewski@...sung.com>
To: Muhammad Falak R Wani <falakreyaz@...il.com>
Cc: Anreas Werner <andreas.werner@....de>,
Bryan Wu <cooloney@...il.com>,
Richard Purdie <rpurdie@...ys.net>, linux-leds@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] leds: leds-fsg: Use devm_led_class_register
Hi Muhammad,
On 10/17/2015 01:13 AM, Muhammad Falak R Wani wrote:
> Use resource-managed function devm_led_classdev_register, remove
> redundant function fsg_led_remove.
> Drop unneeded gotos to make the _init code flow clean.
>
> Signed-off-by: Muhammad Falak R Wani <falakreyaz@...il.com>
> ---
> drivers/leds/leds-fsg.c | 52 ++++++++++++-------------------------------------
> 1 file changed, 12 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/leds/leds-fsg.c b/drivers/leds/leds-fsg.c
> index 2b4dc73..cb01f5e 100644
> --- a/drivers/leds/leds-fsg.c
> +++ b/drivers/leds/leds-fsg.c
> @@ -156,63 +156,35 @@ static int fsg_led_probe(struct platform_device *pdev)
> latch_value = 0xffff;
> *latch_address = latch_value;
>
> - ret = led_classdev_register(&pdev->dev, &fsg_wlan_led);
> + ret = devm_led_classdev_register(&pdev->dev, &fsg_wlan_led);
> if (ret < 0)
> - goto failwlan;
> + return ret;
>
> - ret = led_classdev_register(&pdev->dev, &fsg_wan_led);
> + ret = devm_led_classdev_register(&pdev->dev, &fsg_wan_led);
> if (ret < 0)
> - goto failwan;
> + return ret;
>
> - ret = led_classdev_register(&pdev->dev, &fsg_sata_led);
> + ret = devm_led_classdev_register(&pdev->dev, &fsg_sata_led);
> if (ret < 0)
> - goto failsata;
> + return ret;
>
> - ret = led_classdev_register(&pdev->dev, &fsg_usb_led);
> + ret = devm_led_classdev_register(&pdev->dev, &fsg_usb_led);
> if (ret < 0)
> - goto failusb;
> + return ret;
>
> - ret = led_classdev_register(&pdev->dev, &fsg_sync_led);
> + ret = devm_led_classdev_register(&pdev->dev, &fsg_sync_led);
> if (ret < 0)
> - goto failsync;
> + return ret;
>
> - ret = led_classdev_register(&pdev->dev, &fsg_ring_led);
> + ret = devm_led_classdev_register(&pdev->dev, &fsg_ring_led);
> if (ret < 0)
> - goto failring;
> -
> - return ret;
> -
> - failring:
> - led_classdev_unregister(&fsg_sync_led);
> - failsync:
> - led_classdev_unregister(&fsg_usb_led);
> - failusb:
> - led_classdev_unregister(&fsg_sata_led);
> - failsata:
> - led_classdev_unregister(&fsg_wan_led);
> - failwan:
> - led_classdev_unregister(&fsg_wlan_led);
> - failwlan:
> -
> - return ret;
> -}
> -
> -static int fsg_led_remove(struct platform_device *pdev)
> -{
> - led_classdev_unregister(&fsg_wlan_led);
> - led_classdev_unregister(&fsg_wan_led);
> - led_classdev_unregister(&fsg_sata_led);
> - led_classdev_unregister(&fsg_usb_led);
> - led_classdev_unregister(&fsg_sync_led);
> - led_classdev_unregister(&fsg_ring_led);
> + return ret;
>
> return 0;
> }
>
> -
> static struct platform_driver fsg_led_driver = {
> .probe = fsg_led_probe,
> - .remove = fsg_led_remove,
> .driver = {
> .name = "fsg-led",
> },
>
We've had a similar patch for this driver already. Please refer to
linux-next or LED tree:
git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds.git
--
Best Regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists