[lkml]   [2011]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v5 2/4] gpiolib: Add ability to get GPIO direction
On Wed, Mar 09, 2011 at 04:53:56PM -0600, Peter Tyser wrote:
> On Tue, 2011-03-08 at 12:13 +0000, Alan Cox wrote:
> > > I don't object to a callback hook. My objection is how it is bodged
> > > on to work around limitations to the direction being cached in the
> > > flags variable. I want to see a solution that either depends entirely
> > > on the callback, or completely fixes the problems with the cached
> > > value by allowing the driver to update it.
> >
> > Doing it all by callback might actually fix a lot of the problems because
> > it can handle all kinds of 'unknowns'. If the callbacks for set/get
> > optionally pass a char buffer as well even the /proc interface just comes
> > out in the wash as the device can return a string to populate the status
> > or to be parsed (obviously with most h/w using the default method which
> > is in/out)
> I like the callback-only implementation also.
> > However who then does the enforcement of gpio_foo calls if the flag is
> > not cached, does that end up in each driver or is there still a cache of
> > some form ?
> What enforcement are you referring to? I was envisioning no cached
> directions at the gpiolib level, eg replace all the current references
> that check desc->flag for direction with calls to chip->get_direction().
> If a GPIO chip's hardware didn't support reading the direction of a pin
> (eg the pcf857x chip), it would have to use its own caching to maintain
> an accurate representation of its pins directions. Is this concept in
> line with what you were picturing?

I agree. Trash the cache in gpiolib. Make drivers do it (or use a
stock library function if they don't have the facility).


 \ /
  Last update: 2011-03-12 10:23    [W:0.067 / U:46.808 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site