Re: [PATCH v2 RESEND] gpiolib: Add pin change notification

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ben Nizette
Date: Monday, October 27, 2008 - 3:18 pm

On Mon, 2008-10-27 at 12:46 -0700, David Brownell wrote:

Cool, I'll check it out.


Yeah since akpm's review a few days back, a few things have been
rearranged resulting in this figure blowing out to 13k on AVR32.
Obviously not acceptable so I'm looking for a nicer way around this.
I've been looking at such an IDR, I think it's the way to go yeah.


So long as I allow the interrupt to be shared that should work fine
(assuming gpio_to_irq returns the irq of the chip-wide pin change signal
for all pins on the chip).  akpm pointed out that sysfs_notify() cannot
be called from interrupt context so now all irqs are really taken as
"poll now" advice.


Right.  Should this be a sysfs attribute of the gpio class?  That seems
a sane place to stick it IMO.


Right, changed.


And have this attribute appear and disappear?  This would break the
symmetry between irq and poll driven notification which I quite like.
IMO how the change is sensed and whether the change is reported are
fairly separate.  Though I do agree with your point that we should
probably cater for chips which don't support both edge notification, see
below.


Yeah I was wondering about that case.  Maybe writing an edge to "notify"
would set the filter mode to that edge and the notify mode to "irq",
taking care to do the right thing with respect to interrupt requests?
Much the same way as writing "high" to "direction" sets the direction to
"out" and the value to "1" taking care to do the right things in the
middle.


Badly worded.  I was trying to say that the interrupt should uniquely
identify the gpio which generated it but in fact that's not true - an
early version of this patch used irq_to_gpio() but that's now gone and,
as mentioned above, the irq is currently used as "poll now" advice.

Changed :-)


Yeah trufax.  Changed.


Agreed.


It's more that if irq-driven notification is used then the new value
will be read from interrupt context and therefore can't sleep.

This has actually now changed too - irqs just trigger the poll work
which in turn gets the gpio value from a context which can sleep.  Will
change.


Yup.


Right.


Maybe not even that - depending on how fastpath this is you can just
check whether the IDR content is NULL or not.


Yup, that'll have to stay so .bss will grow at least 1k on AVR32.


Right.


:-)


Indeed, changed.


Yup, sounds good.


Indeed I can't immediately think of a way to make it happen, but I'll
have a think.

I'll mention wakeups and battery drainage etc in the above help text -
hopefully with that people will just turn the notification on when they
need it (wishful thinking I'm sure).


Yeah note that this doesn't actually kick off the poll timer or
anything, it just provides a default timeout.  Actually that's a
leftover from v1 which had a slightly different user interface.
Removed.


Right.


Thanks for this, I've got uni exams the next week or 2 but I'll try and
get a respun patch out shortly.

	--Ben.



--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v2 RESEND] gpiolib: Add pin change notification, Ben Nizette, (Mon Oct 20, 3:50 pm)
Re: [PATCH v2 RESEND] gpiolib: Add pin change notification, David Brownell, (Mon Oct 27, 12:46 pm)
Re: [PATCH v2 RESEND] gpiolib: Add pin change notification, Ben Nizette, (Mon Oct 27, 3:18 pm)