public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@xenotime.net>
To: linux-kernel@vger.kernel.org
Cc: torvalds@linux-foundation.org
Cc: Bernhard Walle <walle@corscience.de>
Subject: [PATCH 3/7] Documentation/gpio.txt: explain poll/select usage
Date: Thu, 18 Nov 2010 12:27:34 -0800	[thread overview]
Message-ID: <12901120543034@xenotime.net> (raw)
In-Reply-To: <12901120542939@xenotime.net>

From: Bernhard Walle <walle@corscience.de>

Add a bit more information how to use poll(2) on GPIO value files
correctly. For me it was not clear that I need to poll(2) for
POLLPRI|POLLERR or select(2) for exceptfds.

Signed-off-by: Bernhard Walle <walle@corscience.de>
Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
---
 Documentation/gpio.txt |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- linux-2.6.37-rc2-git4.orig/Documentation/gpio.txt
+++ linux-2.6.37-rc2-git4/Documentation/gpio.txt
@@ -617,6 +617,16 @@ and have the following read/write attrib
 		is configured as an output, this value may be written;
 		any nonzero value is treated as high.
 
+		If the pin can be configured as interrupt-generating interrupt
+		and if it has been configured to generate interrupts (see the
+		description of "edge"), you can poll(2) on that file and
+		poll(2) will return whenever the interrupt was triggered. If
+		you use poll(2), set the events POLLPRI and POLLERR. If you
+		use select(2), set the file descriptor in exceptfds. After
+		poll(2) returns, either lseek(2) to the beginning of the sysfs
+		file and read the new value or close the file and re-open it
+		to read the value.
+
 	"edge" ... reads as either "none", "rising", "falling", or
 		"both". Write these strings to select the signal edge(s)
 		that will make poll(2) on the "value" file return.


-- 


  parent reply	other threads:[~2010-11-18 20:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18 20:27 [PATCH 1/7] kernel-doc: escape xml for structs Randy Dunlap
2010-11-18 20:27 ` [PATCH 4/7] Documentation: change email address for Hans Koch Randy Dunlap
2010-11-18 20:27 ` Randy Dunlap [this message]
2010-11-18 20:27 ` [PATCH 7/7] MAINTAINERS: update documentation entries Randy Dunlap
2010-11-18 20:27 ` [PATCH 5/7] Documentation/development-process: use -next trees instead of staging Randy Dunlap
2010-11-18 20:27 ` [PATCH 6/7] Documentation/development-process: more staging info Randy Dunlap
2010-11-18 20:27 ` [PATCH 2/7] Documentation: make configfs example code simpler, clearer Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12901120543034@xenotime.net \
    --to=rdunlap@xenotime.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox