public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhart@infradead.org>
To: Frans Klaver <fransklaver@gmail.com>
Cc: Joe Perches <joe@perches.com>,
	Corentin Chary <corentin.chary@gmail.com>,
	Rafael Wysocki <rafael.j.wysocki@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	acpi4asus-user@lists.sourceforge.net,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/9] eeepc-laptop: clean up coding style
Date: Fri, 19 Sep 2014 09:46:03 -0700	[thread overview]
Message-ID: <20140919164603.GB34042@vmdeb7> (raw)
In-Reply-To: <642509cf-05f2-47f4-be2e-a3cfb9a93a04@email.android.com>

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.

-- 
Darren Hart
Intel Open Source Technology Center

  reply	other threads:[~2014-09-19 16:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-17 21:47 [PATCH v2 0/9] eeepc cleanup Frans Klaver
2014-09-17 21:47 ` [PATCH 1/9] eeepc-laptop: clean up coding style Frans Klaver
2014-09-17 22:06   ` Joe Perches
2014-09-18  5:01     ` Frans Klaver
2014-09-19 16:46       ` Darren Hart [this message]
2014-09-19 17:17         ` Frans Klaver
2014-09-19 16:43   ` Darren Hart
2014-09-17 21:47 ` [PATCH 2/9] eeepc-laptop: change sysfs function names to API expectations Frans Klaver
2014-09-17 21:47 ` [PATCH 3/9] eeepc-laptop: use DEVICE_ATTR* to instantiate device_attributes Frans Klaver
2014-09-17 22:06   ` Greg Kroah-Hartman
2014-09-17 21:47 ` [PATCH 4/9] eeepc-laptop: pull out ACPI_STORE_FUNC and ACPI_SHOW_FUNC macros Frans Klaver
2014-09-17 21:47 ` [PATCH 5/9] eeepc-laptop: tell sysfs that the disp attribute is write-only Frans Klaver
2014-09-17 22:07   ` Greg Kroah-Hartman
2014-09-18  5:04     ` Frans Klaver
2014-09-17 21:47 ` [PATCH 6/9] eeepc-laptop: pull out SENSOR_STORE_FUNC and SENSOR_SHOW_FUNC macros Frans Klaver
2014-09-17 21:47 ` [PATCH 7/9] eeepc-laptop: make fan1_input really read-only Frans Klaver
2014-09-17 21:47 ` [PATCH 8/9] eeepc-laptop: check proper return values in get_cpufv Frans Klaver
2014-09-17 21:47 ` [PATCH 9/9] eeepc-laptop: store_cpufv: return error if set_acpi fails Frans Klaver
2014-09-19 17:25 ` [PATCH v2 0/9] eeepc cleanup Darren Hart
2014-09-19 17:33   ` Frans Klaver

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=20140919164603.GB34042@vmdeb7 \
    --to=dvhart@infradead.org \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=corentin.chary@gmail.com \
    --cc=fransklaver@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    /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