Re: [PATCH 5/8] minnowboard-gpio: Export MinnowBoard expansion GPIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2013-06-26 at 10:55 +0300, Andy Shevchenko wrote:
> On Tue, 2013-06-25 at 18:53 -0700, Darren Hart wrote: 
> > Request and export the user-configurable GPIO lines to sysfs. This provides a
> > label readable in /debugfs/gpio and a simple interface for experimenting with
> > GPIO on the MinnowBoard.
> > 
> > This is separate from the minnowboard driver to provide users with the
> > flexibility to write kernel drivers for their own devices using these GPIO
> > lines.
> 
> Few comments below.
> 
> > --- a/drivers/platform/x86/Kconfig
> > +++ b/drivers/platform/x86/Kconfig
> > @@ -35,6 +35,24 @@ config MINNOWBOARD
> >  
> >  	  If you have a MinnowBoard, say Y or M here.
> >  
> > +if MINNOWBOARD
> > +config MINNOWBOARD_GPIO
> > +	tristate "MinnowBoard Expansion GPIO"
> > +	depends on MINNOWBOARD
> > +	default n
> 
> Like you already had been told you don't need to have default n.
> 
> > --- /dev/null
> > +++ b/drivers/platform/x86/minnowboard-gpio.c
> 
> > +#include <linux/platform_device.h>
> > +#include <linux/module.h>
> > +#include <linux/gpio.h>
> > +#include <linux/gpio_keys.h>
> > +#include <linux/input.h>
> > +#include <linux/minnowboard.h>
> 
> + empty line here?
> 
> > +#include "minnowboard-gpio.h"
> 
> > +static int __init minnow_gpio_module_init(void)
> > +{
> > +	int err;
> > +
> > +	err = -ENODEV;
> > +	if (!minnow_detect())
> > +		goto out;
> > +
> > +#ifdef MODULE
> > +#ifdef CONFIG_MINNOWBOARD_MODULE
> 
> And less ifdefs with IS_MODULE().
> 

All good to here and consistent with Olof's comments. Thanks, I will
include in V2.

> > +	if (request_module("minnowboard"))
> > +		goto out;
> > +#endif
> > +#endif
> > +
> > +	/* Auxillary Expansion GPIOs */
> > +	if (!minnow_lvds_detect()) {
> > +		pr_debug("LVDS_DETECT not asserted, configuring Aux GPIO lines\n");
> > +		err = gpio_request_array(expansion_aux_gpios,
> > +					 ARRAY_SIZE(expansion_aux_gpios));
> > +		if (err) {
> > +			pr_err("Failed to request expansion aux GPIO lines\n");
> > +			goto out;
> > +		}
> > +	} else {
> > +		pr_debug("LVDS_DETECT asserted, ignoring aux GPIO lines\n");
> > +	}
> > +
> > +	/* Expansion GPIOs */
> > +	err = gpio_request_array(expansion_gpios, ARRAY_SIZE(expansion_gpios));
> > +	if (err) {
> > +		pr_err("Failed to request expansion GPIO lines\n");
> > +		if (minnow_lvds_detect())
> > +			gpio_free_array(expansion_aux_gpios,
> > +					ARRAY_SIZE(expansion_aux_gpios));
> > +		goto out;
> > +	}
> > +
> > + out:
> > +	return err;
> 
> Are you planning to add something else to 'out' path?
> Otherwise I think it will look better if you do return instead of
> [useless] gotos.

I suppose this is a matter of preference. I am allergic to multiple
return points. However, your argument is consistent with CodingStyle
Chapter 7 in that it states "and some common work such as cleanup has to
be done." If that "and" is a required sort of &&, then I should change
it. Do others have a strong opinion here?

-- 
Darren Hart
Intel Open Source Technology Center
Yocto Project - Technical Lead - Linux Kernel

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux