Welcome! Log In Create A New Profile

Advanced

[PATCH 1/2] gpio/generic: initialize basic_mmio_gpio shadow variables properly

Posted by Shawn Guo 
It fixes the issue in gpio-generic that commit fb14921 (gpio/mxc: add
missing initialization of basic_mmio_gpio shadow variables) manged to
fix in gpio-mxc driver, so that other platform specific drivers do not
suffer from the same problem over and over again.

Signed-off-by: Shawn Guo <[email protected]>
---
drivers/gpio/gpio-generic.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index e38dd0c..cfc9439 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -394,6 +394,10 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
return ret;

bgc->data = bgc->read_reg(bgc->reg_dat);
+ if (bgc->gc.set == bgpio_set_set)
+ bgc->data = bgc->read_reg(bgc->reg_set);
+ if (bgc->reg_dir)
+ bgc->dir = bgc->read_reg(bgc->reg_dir);

return ret;
}
--
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On Thursday, May 17, 2012 12:35 AM, Shawn Guo wrote:
> It fixes the issue in gpio-generic that commit fb14921 (gpio/mxc: add
> missing initialization of basic_mmio_gpio shadow variables) manged to
> fix in gpio-mxc driver, so that other platform specific drivers do not
> suffer from the same problem over and over again.
>
> Signed-off-by: Shawn Guo <[email protected]>
> ---
> drivers/gpio/gpio-generic.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
> index e38dd0c..cfc9439 100644
> --- a/drivers/gpio/gpio-generic.c
> +++ b/drivers/gpio/gpio-generic.c
> @@ -394,6 +394,10 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
> return ret;
>
> bgc->data = bgc->read_reg(bgc->reg_dat);
> + if (bgc->gc.set == bgpio_set_set)
> + bgc->data = bgc->read_reg(bgc->reg_set);
> + if (bgc->reg_dir)
> + bgc->dir = bgc->read_reg(bgc->reg_dir);
>
> return ret;
> }

This change is fine for ep93xx.

Acked-by: H Hartley Sweeten <[email protected]>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Hi Grant, Linus,

Can we manage to get it in with the upcoming merge window, as it fixes
a bug that we may not want to live with for another cycle?

Regards,
Shawn

On Thu, May 17, 2012 at 03:35:02PM +0800, Shawn Guo wrote:
> It fixes the issue in gpio-generic that commit fb14921 (gpio/mxc: add
> missing initialization of basic_mmio_gpio shadow variables) manged to
> fix in gpio-mxc driver, so that other platform specific drivers do not
> suffer from the same problem over and over again.
>
> Signed-off-by: Shawn Guo <[email protected]>
> ---
> drivers/gpio/gpio-generic.c | 4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
> index e38dd0c..cfc9439 100644
> --- a/drivers/gpio/gpio-generic.c
> +++ b/drivers/gpio/gpio-generic.c
> @@ -394,6 +394,10 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
> return ret;
>
> bgc->data = bgc->read_reg(bgc->reg_dat);
> + if (bgc->gc.set == bgpio_set_set)
> + bgc->data = bgc->read_reg(bgc->reg_set);
> + if (bgc->reg_dir)
> + bgc->dir = bgc->read_reg(bgc->reg_dir);
>
> return ret;
> }
> --
> 1.7.5.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
On Fri, May 18, 2012 at 11:44 PM, Grant Likely
<[email protected]> wrote:
> On Thu, 17 May 2012 15:35:02 +0800, Shawn Guo <[email protected]> wrote:
>> It fixes the issue in gpio-generic that commit fb14921 (gpio/mxc: add
>> missing initialization of basic_mmio_gpio shadow variables) manged to
>> fix in gpio-mxc driver, so that other platform specific drivers do not
>> suffer from the same problem over and over again.
>>
>> Signed-off-by: Shawn Guo <[email protected]>
>> ---
>>  drivers/gpio/gpio-generic.c |    4 ++++
>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
>> index e38dd0c..cfc9439 100644
>> --- a/drivers/gpio/gpio-generic.c
>> +++ b/drivers/gpio/gpio-generic.c
>> @@ -394,6 +394,10 @@ int bgpio_init(struct bgpio_chip *bgc, struct device *dev,
>>               return ret;
>>
>>       bgc->data = bgc->read_reg(bgc->reg_dat);
>> +     if (bgc->gc.set == bgpio_set_set)
>> +             bgc->data = bgc->read_reg(bgc->reg_set);
>> +     if (bgc->reg_dir)
>> +             bgc->dir = bgc->read_reg(bgc->reg_dir);
>
> This assumes that the set and dir registers are actually readable
> which isn't the case on some hardware.  There needs to be a mechanism
> for drivers using bgpio_init to control how data & dir are initialized
> (possibly with some flags; maybe replace the big_endian arg with a
> flags arg).

If you can turn it around quickly, I'll still try to get it in for v3.5

g.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Sorry, only registered users may post in this forum.

Click here to login