[OpenWrt-Devel] [PATCH] kernel: gpio: pca953x: backport gpio input fix

Hartmut Knaack knaack.h at gmx.de
Fri Oct 10 18:10:23 EDT 2014


Pushpal Sidhu schrieb am 09.10.2014 02:51:
> This fix is for anyone on 3.10 using the pca953x driver. A regression
> was introduced when this driver was converted to using 8-bit
> reads/writes the bitmask in pca953x_gpio_get_value wasn't adjusted with
> the modulus BANK_SZ and consequently looks at the wrong bits in the
> input register.
> 
> This backports the following commit from the mainline linux kernel:
> 40a625daa88653d7942dc85483f6f289cd687cb7
I totally support getting this fix in, but I think the format you attempt to use is in conflict to what target/linux/generic/PATCHES states. First, I would recommend to number it according to "0xx - upstream backports", 004 seems to be free. Second, I would actually put the content of [1] into that patch file, as it contains all the useful information of when it was created originally and who was involved.

[1] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/patch/drivers/gpio/gpio-pca953x.c?id=40a625daa88653d7942dc85483f6f289cd687cb7
> 
> Signed-off-by: Pushpal Sidhu <psidhu at gateworks.com>
> ---
>  .../350-gpio-pca953x-fix_gpio_input_on_gpio_offsets.patch   | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>  create mode 100644 target/linux/generic/patches-3.10/350-gpio-pca953x-fix_gpio_input_on_gpio_offsets.patch
> 
> diff --git a/target/linux/generic/patches-3.10/350-gpio-pca953x-fix_gpio_input_on_gpio_offsets.patch b/target/linux/generic/patches-3.10/350-gpio-pca953x-fix_gpio_input_on_gpio_offsets.patch
> new file mode 100644
> index 0000000..654fccf
> --- /dev/null
> +++ b/target/linux/generic/patches-3.10/350-gpio-pca953x-fix_gpio_input_on_gpio_offsets.patch
> @@ -0,0 +1,13 @@
> +Index: linux-3.10.49/drivers/gpio/gpio-pca953x.c
> +===================================================================
> +--- linux-3.10.49.orig/drivers/gpio/gpio-pca953x.c	2014-07-17 15:58:15.000000000 -0700
> ++++ linux-3.10.49/drivers/gpio/gpio-pca953x.c	2014-10-08 14:49:46.974913692 -0700
> +@@ -308,7 +308,7 @@
> + 		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)
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list