diff for duplicates of <1469997882.3998.136.camel@perches.com> diff --git a/a/1.txt b/N1/1.txt index 09f62fa..08a1686 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -2,17 +2,17 @@ On Sun, 2016-07-31 at 14:17 +0200, Robert Jarzmik wrote: > The commit 9bf448c66d4b ("ARM: pxa: use generic gpio operation instead of > gpio register") from Oct 17, 2011, leads to the following static checker > warning: -> ? arch/arm/mach-pxa/spitz_pm.c:172 spitz_charger_wakeup() -> ? warn: double left shift '!gpio_get_value(SPITZ_GPIO_KEY_INT) -> ????????<< (1 << ((SPITZ_GPIO_KEY_INT) & 31))' +> arch/arm/mach-pxa/spitz_pm.c:172 spitz_charger_wakeup() +> warn: double left shift '!gpio_get_value(SPITZ_GPIO_KEY_INT) +> << (1 << ((SPITZ_GPIO_KEY_INT) & 31))' > > As Dan reported, the value is shifted three times : -> ?- once by gpio_get_value(), which returns either 0 or BIT(gpio) -> ?- once by the shift operation '<<' -> ?- a last time by GPIO_bit(gpio) which is BIT(gpio) +> - once by gpio_get_value(), which returns either 0 or BIT(gpio) +> - once by the shift operation '<<' +> - a last time by GPIO_bit(gpio) which is BIT(gpio) > > Therefore the calculation lead to a chained or operator of : -> ?- (1 << gpio) << (1 << gpio) = (2^gpio)^gpio = 2 ^ (gpio * gpio) +> - (1 << gpio) << (1 << gpio) = (2^gpio)^gpio = 2 ^ (gpio * gpio) > > It is be sheer luck the former statement works, only because each gpio > used is strictly smaller than 6, and therefore 2^(gpio^2) never @@ -38,15 +38,15 @@ trivially: > diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c [] > @@ -131,15 +131,13 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm) -> ? return is_resume; -> ?} -> ? +> return is_resume; +> } +> > -static unsigned long corgi_charger_wakeup(void) > +static bool corgi_charger_wakeup(void) -> ?{ +> { > - unsigned long ret; > + bool ret; -> ? +> > - ret = (!gpio_get_value(CORGI_GPIO_AC_IN) << GPIO_bit(CORGI_GPIO_AC_IN)) > - | (!gpio_get_value(CORGI_GPIO_KEY_INT) > - << GPIO_bit(CORGI_GPIO_KEY_INT)) @@ -59,20 +59,20 @@ trivially: These might be better without the automatic use of ret return !gpio_get_value(CORGI_GPIO_AC_IN) || - ? ? ? ?!gpio_get_value(CORGI_GPIO_KEY_INT) || - ? ? ? ?!gpio_get_value(CORGI_GPIO_WAKEUP); + !gpio_get_value(CORGI_GPIO_KEY_INT) || + !gpio_get_value(CORGI_GPIO_WAKEUP); and > diff --git a/arch/arm/mach-pxa /spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c [] > @@ -165,12 +165,12 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm) -> ? return is_resume; -> ?} -> ? +> return is_resume; +> } +> > -static unsigned long spitz_charger_wakeup(void) > +static bool spitz_charger_wakeup(void) -> ?{ +> { > - unsigned long ret; > - ret = ((!gpio_get_value(SPITZ_GPIO_KEY_INT) > - << GPIO_bit(SPITZ_GPIO_KEY_INT)) @@ -81,8 +81,8 @@ and > + > + ret = !gpio_get_value(SPITZ_GPIO_KEY_INT) > + || gpio_get_value(SPITZ_GPIO_SYNC); -> ? return ret; -> ?} +> return ret; +> } return !gpio_get_value(SPITZ_GPIO_KEY_INT) || gpio_get_value(SPITZ_GPIO_SYNC); diff --git a/a/content_digest b/N1/content_digest index 056cc81..800c310 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,25 +1,30 @@ "ref\01469967435-23436-1-git-send-email-robert.jarzmik@free.fr\0" - "From\0joe@perches.com (Joe Perches)\0" - "Subject\0[PATCH v3] ARM: pxa: fix GPIO double shifts\0" + "From\0Joe Perches <joe@perches.com>\0" + "Subject\0Re: [PATCH v3] ARM: pxa: fix GPIO double shifts\0" "Date\0Sun, 31 Jul 2016 13:44:42 -0700\0" - "To\0linux-arm-kernel@lists.infradead.org\0" + "To\0Robert Jarzmik <robert.jarzmik@free.fr>" + Daniel Mack <daniel@zonque.org> + Haojian Zhuang <haojian.zhuang@gmail.com> + " Russell King <linux@armlinux.org.uk>\0" + "Cc\0linux-arm-kernel@lists.infradead.org" + " linux-kernel@vger.kernel.org\0" "\00:1\0" "b\0" "On Sun, 2016-07-31 at 14:17 +0200, Robert Jarzmik wrote:\n" "> The commit 9bf448c66d4b (\"ARM: pxa: use generic gpio operation instead of\n" "> gpio register\") from Oct 17, 2011, leads to the following static checker\n" "> warning:\n" - "> ? arch/arm/mach-pxa/spitz_pm.c:172 spitz_charger_wakeup()\n" - "> ? warn: double left shift '!gpio_get_value(SPITZ_GPIO_KEY_INT)\n" - "> ????????<< (1 << ((SPITZ_GPIO_KEY_INT) & 31))'\n" + "> \302\240 arch/arm/mach-pxa/spitz_pm.c:172 spitz_charger_wakeup()\n" + "> \302\240 warn: double left shift '!gpio_get_value(SPITZ_GPIO_KEY_INT)\n" + "> \302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240<< (1 << ((SPITZ_GPIO_KEY_INT) & 31))'\n" "> \n" "> As Dan reported, the value is shifted three times :\n" - "> ?- once by gpio_get_value(), which returns either 0 or BIT(gpio)\n" - "> ?- once by the shift operation '<<'\n" - "> ?- a last time by GPIO_bit(gpio) which is BIT(gpio)\n" + "> \302\240- once by gpio_get_value(), which returns either 0 or BIT(gpio)\n" + "> \302\240- once by the shift operation '<<'\n" + "> \302\240- a last time by GPIO_bit(gpio) which is BIT(gpio)\n" "> \n" "> Therefore the calculation lead to a chained or operator of :\n" - "> ?- (1 << gpio) << (1 << gpio) = (2^gpio)^gpio = 2 ^ (gpio * gpio)\n" + "> \302\240- (1 << gpio) << (1 << gpio) = (2^gpio)^gpio = 2 ^ (gpio * gpio)\n" "> \n" "> It is be sheer luck the former statement works, only because each gpio\n" "> used is strictly smaller than 6, and therefore 2^(gpio^2) never\n" @@ -45,15 +50,15 @@ "> diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c\n" "[]\n" "> @@ -131,15 +131,13 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)\n" - "> ?\treturn is_resume;\n" - "> ?}\n" - "> ?\n" + "> \302\240\treturn is_resume;\n" + "> \302\240}\n" + "> \302\240\n" "> -static unsigned long corgi_charger_wakeup(void)\n" "> +static bool corgi_charger_wakeup(void)\n" - "> ?{\n" + "> \302\240{\n" "> -\tunsigned long ret;\n" "> +\tbool ret;\n" - "> ?\n" + "> \302\240\n" "> -\tret = (!gpio_get_value(CORGI_GPIO_AC_IN) << GPIO_bit(CORGI_GPIO_AC_IN))\n" "> -\t\t| (!gpio_get_value(CORGI_GPIO_KEY_INT)\n" "> -\t\t<< GPIO_bit(CORGI_GPIO_KEY_INT))\n" @@ -66,20 +71,20 @@ "These might be better without the automatic use of ret\n" "\n" "\treturn !gpio_get_value(CORGI_GPIO_AC_IN) ||\n" - "\t? ? ? ?!gpio_get_value(CORGI_GPIO_KEY_INT) ||\n" - "\t? ? ? ?!gpio_get_value(CORGI_GPIO_WAKEUP);\n" + "\t\302\240 \302\240 \302\240 \302\240!gpio_get_value(CORGI_GPIO_KEY_INT) ||\n" + "\t\302\240 \302\240 \302\240 \302\240!gpio_get_value(CORGI_GPIO_WAKEUP);\n" "\n" "and\n" "\n" "> diff --git a/arch/arm/mach-pxa /spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c\n" "[]\n" "> @@ -165,12 +165,12 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)\n" - "> ?\treturn is_resume;\n" - "> ?}\n" - "> ?\n" + "> \302\240\treturn is_resume;\n" + "> \302\240}\n" + "> \302\240\n" "> -static unsigned long spitz_charger_wakeup(void)\n" "> +static bool spitz_charger_wakeup(void)\n" - "> ?{\n" + "> \302\240{\n" "> -\tunsigned long ret;\n" "> -\tret = ((!gpio_get_value(SPITZ_GPIO_KEY_INT)\n" "> -\t\t<< GPIO_bit(SPITZ_GPIO_KEY_INT))\n" @@ -88,10 +93,10 @@ "> +\n" "> +\tret = !gpio_get_value(SPITZ_GPIO_KEY_INT)\n" "> +\t\t|| gpio_get_value(SPITZ_GPIO_SYNC);\n" - "> ?\treturn ret;\n" - "> ?}\n" + "> \302\240\treturn ret;\n" + "> \302\240}\n" "\n" "\treturn !gpio_get_value(SPITZ_GPIO_KEY_INT) ||\n" "\t gpio_get_value(SPITZ_GPIO_SYNC);" -e80cd472f56ecfc9faf01c83460ca73b78c190edfc04ee8372b52e3b238ec492 +f5ca7d87d57f3aae2685d7000251a162551c6c94659bb843f8df7ca0a1797869
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.