linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] gpio: pca953x: fix gpio input on gpio offsets >= 8
       [not found] <20130807215240.GA31924@gmail.com>
@ 2013-08-12 10:27 ` Gregory CLEMENT
  2013-08-14 13:44   ` Andrew Ruder
  2013-08-16 15:19 ` Linus Walleij
  1 sibling, 1 reply; 3+ messages in thread
From: Gregory CLEMENT @ 2013-08-12 10:27 UTC (permalink / raw)
  To: Andrew Ruder; +Cc: linux-gpio, Linus Walleij

On 07/08/2013 23:52, Andrew Ruder wrote:
> This change fixes a regression introduced by commit
> f5f0b7aa8 (gpio: pca953x: make the register access by GPIO bank)
> 
> When the pca953x driver was converted to using 8-bit reads/writes
> the bitmask in pca953x_gpio_get_value wasn't adjusted with a
> modulus BANK_SZ and consequently looks at the wrong bits in the
> input register.

Good catch. I forgot this one and as on my board I wasn't able to
test the input I didn't noticed it.
Thanks

Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>


> 
> Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>
> ---
> 
>  drivers/gpio/gpio-pca953x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> index 426c51d..1a7ab13 100644
> --- a/drivers/gpio/gpio-pca953x.c
> +++ b/drivers/gpio/gpio-pca953x.c
> @@ -308,7 +308,7 @@ static int pca953x_gpio_get_value(struct gpio_chip *gc, unsigned off)
>  		return 0;
>  	}
>  
> -	return (reg_val & (1u << off)) ? 1 : 0;
> +	return (reg_val & (1u << (off % BANK_SZ))) ? 1 : 0;
>  }
>  
>  static void pca953x_gpio_set_value(struct gpio_chip *gc, unsigned off, int val)
> 


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: pca953x: fix gpio input on gpio offsets >= 8
  2013-08-12 10:27 ` [PATCH] gpio: pca953x: fix gpio input on gpio offsets >= 8 Gregory CLEMENT
@ 2013-08-14 13:44   ` Andrew Ruder
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Ruder @ 2013-08-14 13:44 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, Gregory CLEMENT

On Mon, Aug 12, 2013 at 12:27:49PM +0200, Gregory CLEMENT wrote:
> Good catch. I forgot this one and as on my board I wasn't able to
> test the input I didn't noticed it.
> Thanks
> 
> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com>

Linus,

Any chance you can take this one into your tree?

Thanks,
Andy

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: pca953x: fix gpio input on gpio offsets >= 8
       [not found] <20130807215240.GA31924@gmail.com>
  2013-08-12 10:27 ` [PATCH] gpio: pca953x: fix gpio input on gpio offsets >= 8 Gregory CLEMENT
@ 2013-08-16 15:19 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2013-08-16 15:19 UTC (permalink / raw)
  To: Andrew Ruder; +Cc: linux-gpio@vger.kernel.org, Gregory CLEMENT

On Wed, Aug 7, 2013 at 11:52 PM, Andrew Ruder <andy@aeruder.net> wrote:

> This change fixes a regression introduced by commit
> f5f0b7aa8 (gpio: pca953x: make the register access by GPIO bank)
>
> When the pca953x driver was converted to using 8-bit reads/writes
> the bitmask in pca953x_gpio_get_value wasn't adjusted with a
> modulus BANK_SZ and consequently looks at the wrong bits in the
> input register.
>
> Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com>

Patch applied with Gregory's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-16 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20130807215240.GA31924@gmail.com>
2013-08-12 10:27 ` [PATCH] gpio: pca953x: fix gpio input on gpio offsets >= 8 Gregory CLEMENT
2013-08-14 13:44   ` Andrew Ruder
2013-08-16 15:19 ` Linus Walleij

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).