[PATCH 2/2] [bcm2708] GpioLib Counter increment added to GPIO interrupt handler

Greg KH greg at kroah.com
Tue May 27 12:06:14 PDT 2014


On Tue, May 27, 2014 at 08:47:29PM +0200, Federico Fuga wrote:
> GPIO Interrupt counter implementation for bcm2708
> 
> Signed-off-by: Federico Fuga <fuga at studiofuga.com>
> ---
>  arch/arm/mach-bcm2708/bcm2708_gpio.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/arch/arm/mach-bcm2708/bcm2708_gpio.c b/arch/arm/mach-bcm2708/bcm2708_gpio.c
> index bab8a49..e10d42e 100644
> --- a/arch/arm/mach-bcm2708/bcm2708_gpio.c
> +++ b/arch/arm/mach-bcm2708/bcm2708_gpio.c
> @@ -244,6 +244,9 @@ static irqreturn_t bcm2708_gpio_interrupt(int irq, void *dev_id)
>  		edsr = readl(__io_address(GPIO_BASE) + GPIOEDS(bank));
>  		for_each_set_bit(i, &edsr, 32) {
>  			gpio = i + bank * 32;
> +#ifdef CONFIG_GPIO_COUNTER
> +			gpio_counter_inc(gpio);
> +#endif			

Always run your patches through scripts/checkpatch.pl before sending
them out...

Also, this isn't how kernel code is written, you should not have #ifdef
in .c files if at all possible.  Just provide an "empty" function for
this if CONFIG_GPIO_COUNTER is not enabled, that way you don't have to
care about this in the driver code at all, just always call the
function.

thanks,

greg k-h



More information about the linux-rpi-kernel mailing list