From nobody Sun Jun 14 17:34:53 2026 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46AAC28850D for ; Sat, 4 Apr 2026 01:41:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775266885; cv=none; b=ggid+ELZvpx3Sj7H4TlMzNYEGcsn5RDzW62eYhVUnTdEZpvQDEcS3EYPkTDRM7o0Iu1qKhlnpk1YI9YwCSn2aczeF9M0yUazfjJRnHMjr4/xgw8ONYK6+mFd1a0+nrvEOZUIyjfmd0DT4MlSldTRa48EStM0eC1eJNNiR7vJgO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775266885; c=relaxed/simple; bh=oalOf6m7JMtDy2yNWJiFY9lNhdyMecV2HOjYO9Uh1k0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=JvTW8eZ+cgfg17fXhq7mj9+Ekcf+Vtl05OT+sPGsh7SzHaWA6hA5jwsstLT+qYvEqSx0Wbg+PUzSPbY9cWXWa8nAS44gwVrE/TxoLG+ZGTUrsrCfcs5alLZVuyJBg41jaX+jlRev+ovz0M3qjcicKUwMBFNlCACSTzsc1tp8JYA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=L1oK5PwR; arc=none smtp.client-ip=209.85.210.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="L1oK5PwR" Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-82c28f0a4ecso1804221b3a.3 for ; Fri, 03 Apr 2026 18:41:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775266884; x=1775871684; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=MRkD5HsTDuX9PjT7ol/nE07Q6AgNl5nhM+2WKO7vrJM=; b=L1oK5PwRX2ckY7qdEbDushXIIg4cwKSMfcf0yR41tiOzI60MUl+TKgfWyyK4z9N0HS k+XQgieUuv/2Wha6XM1QBEyj0vdAPmeHEYGapKpMwnKryns8oD/OiuCPizF6idyyHKyq pKQKZEqdswjlpeS4IX2RaMZraUiUO220tQTUxmeiQfwD2CyNkcjxun9EJj6TUAcJDXmb yqf27erOLbA7TrF/PFcRWgc/PBIhcqvOcPWhLRnpexWee081xkMnobpcpJpv7XUiJdYa /6D/OfrOeNvOcscEmAtV/32PO6KbkezwtLzQLd+FZ4AErew/En6fA3do+G9tToJp4vza AXtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775266884; x=1775871684; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=MRkD5HsTDuX9PjT7ol/nE07Q6AgNl5nhM+2WKO7vrJM=; b=m88ceIiHLDmUFzUa+whgmlYw2Zt/iO1R5foDqsT6oeB+sfFCwxcwG1d8+p+WXAsjQB 38mkNz/MafVJRhhOsoAWOFIkr+NOOdB0WOUY4kJe/qKNdmDtjNScmQKfsxwRJ5aQWen6 4hV/XHbCNAX9FGkv9N0v19P0UzbDdXO4ktHNMhl3fFne9GphKKIqITSuGXTqHQSI6gBa Z2ii34bQ+TKzaMZx3Nz1ydkK530HH1f6EA6xVeGOm6VhSryCr3HCEkN/9VdPY+IJWxIL UJ47U35v7ww8bCjpS+b6nzClT0HQDPb3VRie9B9KN08dqfsDSlkQWfouLe4vVr5BTbhq qDAA== X-Forwarded-Encrypted: i=1; AJvYcCWTnn7P8nfBiYlIsUGNejwG6mmPw09ELFUknPUNg0uT2JFLywESGbU1zaDxwPspFUOzIy1sxKCbLKFoHAU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw4BhGLTfBBjvJ8qsJnuDJPaw0mQeuuujsOzVLRGXX8ZRz9asf9 ItrBNvl1JutMCDfPCqrzLS9Yqo4kTs21PLNz9cM4958bIXD8xAlWF53+ X-Gm-Gg: AeBDieu+4Yln+VplbOFdLS/+uzBykk5d/LZNMuI+XSq4msEtP6b2ChfRw52TWpZXCeO EPmnfdAol1KhABbP2Lj/nmm0oMiRJG5NZAFxTqG89ZDdvD/UirI1/LL1z3Tq1uBdTnH4ua3WHzy n2IgnJ0YnsSmf2caudtWi27qg4TCnZe4IPCcn5UsPTRm6FCnPOfIiVQyoDGJa5yAtt3iRWCqoLd fjd9EFEjiHwWtUE5VFoaKuJq8AN1IyJEKPzeWdO5K9vKe4wymeFXLHzjnGnTdAkSvkohlvbGs/G U8hUsB97jJecRsMRg3XirSjZLDXt9sRHHxmghoIxSGirKRZ2Z+9MYxoBvTbrbCv+c/QyB8juZxb 1JcSZzzEWmYGH7Fdnk/y+TUDbRcn816MDoMiqePjIpfpRTirEApUITJdKEIfsItP1CNYbdSdcG0 uSY8s782vgjIHGWepvGOcoUSnK+J7kK+i/JSw5fjoIS20EM+un7FpmU0k09wSIEJ0qcFEPPjmZE QacQQlDMutadN6dfsRpJY4= X-Received: by 2002:a05:6a00:4b56:b0:82c:9c90:54cf with SMTP id d2e1a72fcca58-82d0dba133dmr4891804b3a.43.1775266883642; Fri, 03 Apr 2026 18:41:23 -0700 (PDT) Received: from adeel-linux.ad.umanitoba.ca (nat-243-cc-130-179-243-228.umanitoba.ca. [130.179.243.228]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82cf9c6fdd7sm7025639b3a.48.2026.04.03.18.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2026 18:41:23 -0700 (PDT) From: Adeel Zahid To: Jonathan Corbet Cc: Shuah Khan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Adeel Zahid Subject: [PATCH] docs: usb: document USBDEVFS_BULK return value Date: Fri, 3 Apr 2026 20:41:18 -0500 Message-ID: <20260404014118.15678-1-adeel.m.zahid@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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-ap= i/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 we= re + 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. =20 USBDEVFS_CLEAR_HALT Clears endpoint halt (stall) and resets the endpoint toggle. This is --=20 2.43.0