linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vaishali Thakkar <vthakkar1994@gmail.com>
To: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: linux-leds@vger.kernel.org, Bryan Wu <cooloney@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] leds: leds-fsg: Use devm_led_classdev_register
Date: Tue, 18 Aug 2015 11:16:31 +0530	[thread overview]
Message-ID: <CAK-LDbJ+6VnKcsuhRUP13gweetP2p-ioY+ittxDcLqZ5ECxctA@mail.gmail.com> (raw)
In-Reply-To: <CAK-LDbKBwtq9i3Xozew-axZfPOrgTBKrVHEft4ucLEoohnG_xw@mail.gmail.com>

On Mon, Aug 17, 2015 at 2:02 PM, Vaishali Thakkar
<vthakkar1994@gmail.com> wrote:
>
> On 17 Aug 2015 13:57, "Jacek Anaszewski" <j.anaszewski@samsung.com> wrote:
>>
>> Hi Vaishali,
>>
>> Thanks for the patch. Unfortunately it causes build break.
>> Please fix the issues and resubmit.
>
> Oops! I am really very sorry. By mistake I sent a basic version of patch
> instead of final one. Thanks for the review.
>
> I'll send v2 with the fix of that build error.

Hi Jacek,

Can you please tell me what are those build errors?
After looking at my patch, I can expect that as I forgot to
remove '.remove         = fsg_led_remove' from structure,
it can cause an error. Also, there is one typing mistake in
function name. So, both of these can be a reason for
breaking a build.

Also to be on safe side, I tried to cross compile it for arm
architecture. But to my surprise, it is not compiling properly.
So, it would be good if you can point me to the script you
used for compilation so that I can check it before sending a new
version.

Thank You.

>>
>> On 08/15/2015 12:21 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, various gotos are replced with
>>> direct returns and unneeded labels are dropped. Also, remove
>>> fsg_led_remove as it is now redundant.
>>>
>>> Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
>>> ---
>>>   drivers/leds/leds-fsg.c | 51
>>> ++++++++++++-------------------------------------
>>>   1 file changed, 12 insertions(+), 39 deletions(-)
>>>
>>> diff --git a/drivers/leds/leds-fsg.c b/drivers/leds/leds-fsg.c
>>> index 2b4dc73..df0e5da 100644
>>> --- a/drivers/leds/leds-fsg.c
>>> +++ b/drivers/leds/leds-fsg.c
>>> @@ -156,60 +156,33 @@ 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_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;
>>>
>>>         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 0;
>>> -}
>>> -
>>> -
>>>   static struct platform_driver fsg_led_driver = {
>>>         .probe          = fsg_led_probe,
>>>         .remove         = fsg_led_remove,
>>>
>>
>>
>> --
>> Best Regards,
>> Jacek Anaszewski



-- 
Vaishali

  parent reply	other threads:[~2015-08-18  5:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-15 10:21 [PATCH] leds: leds-fsg: Use devm_led_classdev_register Vaishali Thakkar
2015-08-17  8:27 ` Jacek Anaszewski
     [not found]   ` <CAK-LDbKBwtq9i3Xozew-axZfPOrgTBKrVHEft4ucLEoohnG_xw@mail.gmail.com>
2015-08-18  5:46     ` Vaishali Thakkar [this message]
2015-08-18  7:27       ` Jacek Anaszewski
2015-08-18 12:14         ` Vaishali Thakkar
2015-08-18 12:36           ` Jacek Anaszewski
2015-08-18 13:41             ` 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=CAK-LDbJ+6VnKcsuhRUP13gweetP2p-ioY+ittxDcLqZ5ECxctA@mail.gmail.com \
    --to=vthakkar1994@gmail.com \
    --cc=cooloney@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).