mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Junzhong Pan <panjunzhong@linux.spacemit.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Frank Li <Frank.Li@nxp.com>, Xu Yang <xu.yang_2@nxp.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	 stable@vger.kernel.org,
	Junzhong Pan <panjunzhong@linux.spacemit.com>
Subject: [PATCH] usb: gadget: uvc: fix interval_duration calculation
Date: Fri, 06 Mar 2026 11:30:09 +0800	[thread overview]
Message-ID: <20260306-fix-uvc-interval-v1-1-9a2df6859859@linux.spacemit.com> (raw)

To correctly convert bInterval as interval_duration:
  interval_duration = 2^(bInterval-1) * frame_interval

Current code uses a wrong left shift operand, computing 2^bInterval
instead of 2^(bInterval-1).

Fixes: 010dc57cb516 ("usb: gadget: uvc: fix interval_duration calculation")
Cc: stable@vger.kernel.org
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
 drivers/usb/gadget/function/uvc_video.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c
index 7cea641b06b4..2f9700b3f1b6 100644
--- a/drivers/usb/gadget/function/uvc_video.c
+++ b/drivers/usb/gadget/function/uvc_video.c
@@ -513,7 +513,7 @@ uvc_video_prep_requests(struct uvc_video *video)
 		return;
 	}
 
-	interval_duration = 2 << (video->ep->desc->bInterval - 1);
+	interval_duration = 1 << (video->ep->desc->bInterval - 1);
 	if (cdev->gadget->speed < USB_SPEED_HIGH)
 		interval_duration *= 10000;
 	else

---
base-commit: 5ee8dbf54602dc340d6235b1d6aa17c0f283f48c
change-id: 20260306-fix-uvc-interval-0dc36dbde48e

Best regards,
-- 
Junzhong Pan <panjunzhong@linux.spacemit.com>


             reply	other threads:[~2026-03-06  3:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06  3:30 Junzhong Pan [this message]
2026-03-06  9:58 ` Xu Yang

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=20260306-fix-uvc-interval-v1-1-9a2df6859859@linux.spacemit.com \
    --to=panjunzhong@linux.spacemit.com \
    --cc=Frank.Li@nxp.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xu.yang_2@nxp.com \
    /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

all inboxes | Powered by JetHome®