Re: [PATCH v3 11/13] gpio/omap: fix dataout register overwrite in _set_gpio_dataout_*

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 13, 2012 at 11:33 AM, DebBarma, Tarun Kanti
<tarun.kanti@xxxxxx> wrote:
> On Tue, Mar 13, 2012 at 3:24 AM, Kevin Hilman <khilman@xxxxxx> wrote:
>> Tarun Kanti DebBarma <tarun.kanti@xxxxxx> writes:
>>
>>> In the existing _set_gpio_dataout_*() implementation, the dataout
>>> register is overwritten every time the function is called. This is
>>> not intended behavior because that would end up one user of a GPIO
>>> line overwriting what is written by another. Fix this so that previous
>>> value is always preserved until explicitly changed by respective
>>> user/driver of the GPIO line.
>>>
>>> Signed-off-by: Tarun Kanti DebBarma <tarun.kanti@xxxxxx>
>>> ---
>>>  drivers/gpio/gpio-omap.c |    3 +++
>>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
>>> index 04c2677..2e8e476 100644
>>> --- a/drivers/gpio/gpio-omap.c
>>> +++ b/drivers/gpio/gpio-omap.c
>>> @@ -114,6 +114,7 @@ static void _set_gpio_dataout_reg(struct gpio_bank *bank, int gpio, int enable)
>>>       else
>>>               reg += bank->regs->clr_dataout;
>>>
>>> +     l |= __raw_readl(bank->base + bank->regs->set_dataout);
>>
>> minor: IMO, it's more reader-friendly if this looks like
>>
>>       l = __raw_read(...)
>>       l |= GPIO_BIT(...)
>>       __raw_write(...)
> Agreed. I will make the change.
Also, the read should be: __raw_readl(bank->base + bank->regs->dataout);
instead of bank->regs->set_dataout.
--
Tarun
>
>>
>>>       __raw_writel(l, reg);
>>>       bank->context.dataout = l;
>>>  }
>>> @@ -130,6 +131,8 @@ static void _set_gpio_dataout_mask(struct gpio_bank *bank, int gpio, int enable)
>>>               l |= gpio_bit;
>>>       else
>>>               l &= ~gpio_bit;
>>> +
>>> +     l |= __raw_readl(bank->base + bank->regs->set_dataout);
>>
>> There's already a __raw_read() in this function just above.
> Right. Thanks.
> --
> Tarun
>>
>>>       __raw_writel(l, reg);
>>>       bank->context.dataout = l;
>>>  }
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux