lkml.org 
[lkml]   [2011]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] gpio/gpio-generic: read set register for caching if available
On Mon, Jun 27, 2011 at 09:26:22AM +0200, Sebastian Andrzej Siewior wrote:
> The ->data is a shadow copy which is used during the ->set callback in
> order to avoid a read of the register before write.
> If ->reg_set is set then we write to this location therefore we should
> cache that value.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> drivers/gpio/gpio-generic.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
> index 231714d..9f8b5c6 100644
> --- a/drivers/gpio/gpio-generic.c
> +++ b/drivers/gpio/gpio-generic.c
> @@ -398,7 +398,10 @@ int __devinit bgpio_init(struct bgpio_chip *bgc,
> if (ret)
> return ret;
>
> - bgc->data = bgc->read_reg(bgc->reg_dat);
> + if (bgc->reg_set)
> + bgc->data = bgc->read_reg(bgc->reg_set);

On most of the gpio controllers that I've seen, the 'set' register
isn't something that you can actually read. I don't think this is
something that can be done for all gpio controllers.

g.

> + else
> + bgc->data = bgc->read_reg(bgc->reg_dat);
>
> return ret;
> }
> --
> 1.7.4.4
>


\
 
 \ /
  Last update: 2011-07-04 17:47    [W:0.552 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site