[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkda+UufHGEekzRxG7U3CG-_nvx1d0ophqwUUWmjkvaBTmg@mail.gmail.com>
Date: Tue, 16 Oct 2012 12:00:13 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Lars Poeschel <poeschel@...onage.de>
Cc: Lars Poeschel <larsi@....tu-dresden.de>, sameo@...ux.intel.com,
linux-kernel@...r.kernel.org, jic23@....ac.uk, khali@...ux-fr.org,
ben-linux@...ff.org, w.sang@...gutronix.de,
grant.likely@...retlab.ca
Subject: Re: [PATCH v2 2/4] gpio: add viperboard gpio driver
On Tue, Oct 16, 2012 at 8:51 AM, Lars Poeschel <poeschel@...onage.de> wrote:
> On Monday 15 October 2012 at 15:00:12, Linus Walleij wrote:
>> > + /* if io is set to output, just return the saved value */
>> > + if (gpio->gpioa_out & (1 << offset))
>> > + return gpio->gpioa_val & (1 << offset);
>>
>> That's not going to work if the hardware changes state
>> behind the back of the driver right? Oh well, maybe
>> it doesn't matter.
>
> I thought about that and then did this "cache" only in case the gpio is a
> output to save to usb ping-pong that is needed otherwise. I thought that
> nothing can change to state of the output but the driver itself.
On a second note there is already a standard mechanism for caching
registers in the kernel, and that is regmap. Sadly it's a bit
undocumented but there are several examples and the code
lives in drivers/base/regmap and include/linux/regmap.h
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists