linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	Johan Hovold <johan@kernel.org>
Subject: [PATCH 3/8] serdev: document driver callbacks
Date: Fri,  3 Nov 2017 15:30:54 +0100	[thread overview]
Message-ID: <20171103143059.20749-4-johan@kernel.org> (raw)
In-Reply-To: <20171103143059.20749-1-johan@kernel.org>

Amend the driver-callback kerneldoc with calling context and expected
return values.

Note that this is based on the requirements and characteristics of the
tty-port controller implementation which receives data in workqueue
context and whose write_wakeup callback must not sleep.

Also note that while the receive_buf callback returns an integer, the
returned value is still expected to be non-negative (and no greater than
the buffer-size argument).

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 include/linux/serdev.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/serdev.h b/include/linux/serdev.h
index d609e6dc5bad..98b5f7978dac 100644
--- a/include/linux/serdev.h
+++ b/include/linux/serdev.h
@@ -27,8 +27,10 @@ struct serdev_device;
 
 /**
  * struct serdev_device_ops - Callback operations for a serdev device
- * @receive_buf:	Function called with data received from device.
- * @write_wakeup:	Function called when ready to transmit more data.
+ * @receive_buf:	Function called with data received from device;
+ *			returns number of bytes accepted; may sleep.
+ * @write_wakeup:	Function called when ready to transmit more data; must
+ *			not sleep.
  */
 struct serdev_device_ops {
 	int (*receive_buf)(struct serdev_device *, const unsigned char *, size_t);
-- 
2.15.0

  parent reply	other threads:[~2017-11-03 14:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 14:30 [PATCH 0/8] serdev: receive_buf and locking fixes Johan Hovold
2017-11-03 14:30 ` [PATCH 1/8] serdev: ttyport: add missing receive_buf sanity checks Johan Hovold
2017-11-03 14:30 ` [PATCH 2/8] serdev: fix receive_buf return value when no callback Johan Hovold
2017-11-03 14:30 ` Johan Hovold [this message]
2017-11-03 14:30 ` [PATCH 4/8] serdev: ttyport: fix NULL-deref on hangup Johan Hovold
2017-11-03 14:30 ` [PATCH 5/8] serdev: ttyport: fix tty locking in close Johan Hovold
2017-11-03 14:30 ` [PATCH 6/8] serdev: ttyport: release tty lock sooner on open Johan Hovold
2017-11-03 14:30 ` [PATCH 7/8] serdev: ttyport: ignore carrier detect to avoid hangups Johan Hovold
2017-11-03 14:30 ` [PATCH 8/8] serdev: ttyport: do not used keyed wakeup in write_wakeup Johan Hovold
2017-11-28 15:04   ` Greg Kroah-Hartman
2017-11-28 15:16     ` Johan Hovold
2017-11-28 19:39       ` Greg Kroah-Hartman
2017-11-29  9:48         ` Johan Hovold
2017-12-15 19:26           ` Greg Kroah-Hartman
2017-12-18 11:03             ` Johan Hovold

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=20171103143059.20749-4-johan@kernel.org \
    --to=johan@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=robh@kernel.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;
as well as URLs for NNTP newsgroup(s).