lkml.org 
[lkml]   [2014]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/9] eeepc-laptop: clean up coding style
From
Date
On 19 September 2014 18:46:03 CEST, Darren Hart <dvhart@infradead.org> wrote:
>On Thu, Sep 18, 2014 at 07:01:25AM +0200, Frans Klaver wrote:
>> On 18 September 2014 00:06:52 CEST, Joe Perches <joe@perches.com>
>wrote:
>> >On Wed, 2014-09-17 at 23:47 +0200, Frans Klaver wrote:
>> >> Correct indentation and brace usage to comply with
>> >> Documentation/CodingStyle.
>> >>
>> >> Signed-off-by: Frans Klaver <fransklaver@gmail.com>
>> >> ---
>> >> drivers/platform/x86/eeepc-laptop.c | 8 +++++---
>> >> 1 file changed, 5 insertions(+), 3 deletions(-)
>> >>
>> >> diff --git a/drivers/platform/x86/eeepc-laptop.c
>> >b/drivers/platform/x86/eeepc-laptop.c
>> >> index 3095d38..653999e 100644
>> >> --- a/drivers/platform/x86/eeepc-laptop.c
>> >> +++ b/drivers/platform/x86/eeepc-laptop.c
>> >> @@ -544,7 +544,7 @@ static int eeepc_led_init(struct eeepc_laptop
>> >*eeepc)
>> >> eeepc->tpd_led.name = "eeepc::touchpad";
>> >> eeepc->tpd_led.brightness_set = tpd_led_set;
>> >> if (get_acpi(eeepc, CM_ASL_TPD) >= 0) /* if method is available
>*/
>> >> - eeepc->tpd_led.brightness_get = tpd_led_get;
>> >> + eeepc->tpd_led.brightness_get = tpd_led_get;
>> >> eeepc->tpd_led.max_brightness = 1;
>> >>
>> >> rv = led_classdev_register(&eeepc->platform_device->dev,
>> >> @@ -692,8 +692,9 @@ static int
>eeepc_register_rfkill_notifier(struct
>> >eeepc_laptop *eeepc,
>> >> * changed during setup.
>> >> */
>> >> eeepc_rfkill_hotplug(eeepc, handle);
>> >> - } else
>> >> + } else {
>> >> return -ENODEV;
>> >> + }
>> >>
>> >> return 0;
>> >> }
>> >
>> >This sort of code:
>> >
>> > if (foo) {
>> > [ do_something ]
>> > } else
>> > return -ERRVAL;
>> >
>> >is generally better rewritten as:
>> >
>> > if (!foo)
>> > return -ERRVAL;
>> >
>> > [ do_something ]
>> >
>> >This gives immediacy to the error handler and
>> >as well reduces unnecessary indentation.
>>
>> I fully agree.
>>
>> Darren, do you still take this in one patch?
>
>I'll take the cleanup patch as is. I'm happy to take a separate patch
>to improve
>the code flow.

Alright. Thanks.

Frans




\
 
 \ /
  Last update: 2014-09-19 20:01    [W:0.058 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site