public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: Adeel Zahid <adeel.m.zahid@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Shuah Khan <skhan@linuxfoundation.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Adeel Zahid <adeel.m.zahid@gmail.com>
Subject: [PATCH] docs: usb: document USBDEVFS_BULK return value
Date: Fri,  3 Apr 2026 20:41:18 -0500	[thread overview]
Message-ID: <20260404014118.15678-1-adeel.m.zahid@gmail.com> (raw)

Replace the FIXME in the usbfs bulk I/O documentation with the
current behavior.

Document that USBDEVFS_BULK returns the completed URB actual_length
on success, which may be smaller than the requested len. Also clarify
that for IN endpoints only the returned number of bytes is copied into
the userspace buffer, so a smaller return value indicates a short
read.

Signed-off-by: Adeel Zahid <adeel.m.zahid@gmail.com>
---
 Documentation/driver-api/usb/usb.rst | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/Documentation/driver-api/usb/usb.rst b/Documentation/driver-api/usb/usb.rst
index 7f2f41e80c1c..6b6a759c1f62 100644
--- a/Documentation/driver-api/usb/usb.rst
+++ b/Documentation/driver-api/usb/usb.rst
@@ -535,9 +535,19 @@ USBDEVFS_BULK
     The ``ep`` value identifies a bulk endpoint number (1 to 15, as
     identified in an endpoint descriptor), masked with USB_DIR_IN when
     referring to an endpoint which sends data to the host from the
-    device. The length of the data buffer is identified by ``len``; Recent
-    kernels support requests up to about 128KBytes. *FIXME say how read
-    length is returned, and how short reads are handled.*.
+    device. The length of the data buffer is identified by ``len``. Recent
+    kernels support requests up to about 128 KBytes.
+
+    On success, the ioctl returns the completed URB's ``actual_length``
+    value, that is, the number of bytes actually transferred for the
+    request. This may be less than the value requested in ``len``.
+
+    For an IN endpoint, the return value tells userspace how many bytes were
+    read and copied into ``data``. If the return value is smaller than
+    ``len``, the read completed as a short read, and only the returned
+    number of bytes is valid in the buffer.
+
+    Failures return a negative errno value.
 
 USBDEVFS_CLEAR_HALT
     Clears endpoint halt (stall) and resets the endpoint toggle. This is
-- 
2.43.0


                 reply	other threads:[~2026-04-04  1:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260404014118.15678-1-adeel.m.zahid@gmail.com \
    --to=adeel.m.zahid@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=skhan@linuxfoundation.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