From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb@vger.kernel.org, linux-media@vger.kernel.org,
gregkh@linuxfoundation.org, laurent.pinchart@ideasonboard.com,
hdegoede@redhat.com, Thinh.Nguyen@synopsys.com,
Amardeep Rai <amardeep.rai@intel.com>,
Kannappan R <r.kannappan@intel.com>,
Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: Re: [PATCH v3 3/4] USB: Add a function to obtain USB version independent maximum bpi value
Date: Tue, 12 Aug 2025 06:15:40 +0000 [thread overview]
Message-ID: <aJrcDLVd0r_sr9xL@kekkonen.localdomain> (raw)
In-Reply-To: <5668be30-8b01-4e9a-8eb8-e9098de24e4e@rowland.harvard.edu>
Hi Alan,
On Fri, Aug 08, 2025 at 11:16:22AM -0400, Alan Stern wrote:
> On Fri, Aug 08, 2025 at 08:18:58AM +0000, Sakari Ailus wrote:
> > > >
> > > > +/**
> > > > + * usb_endpoint_max_isoc_bpi - Get maximum isochronous transfer bytes per interval
> > > > + * @dev: The USB device
> > > > + * @ep: The endpoint
> > > > + *
> > > > + * Returns: the maximum number of bytes isochronous endpoint @endpoint can
> > > > + * transfer in during a service interval, or 0 for non-isochronous endpoints.
> > > > + */
> > > > +static inline u32 usb_endpoint_max_isoc_bpi(struct usb_device *dev,
> > > > + const struct usb_host_endpoint *ep)
> > > > +{
> > > > + if (usb_endpoint_type(&ep->desc) != USB_ENDPOINT_XFER_ISOC)
> > > > + return 0;
> > > > +
> > > > + switch (dev->speed) {
> > > > + case USB_SPEED_SUPER_PLUS:
> > > > + if (USB_SS_SSP_ISOC_COMP(ep->ss_ep_comp.bmAttributes))
> > > > + return le32_to_cpu(ep->ssp_isoc_ep_comp.dwBytesPerInterval);
> > > > + fallthrough;
> > > > + case USB_SPEED_SUPER:
> > > > + return le16_to_cpu(ep->ss_ep_comp.wBytesPerInterval);
> > > > + case USB_SPEED_HIGH:
> > > > + if (ep->eusb2_isoc_ep_comp.bDescriptorType &&
> > > > + !usb_endpoint_maxp(&ep->desc) && usb_endpoint_dir_in(&ep->desc))
> > > > + return le32_to_cpu(ep->eusb2_isoc_ep_comp.dwBytesPerInterval);
> > > > + fallthrough;
> > > > + default:
> > > > + return usb_endpoint_maxp(&ep->desc) * usb_endpoint_maxp_mult(&ep->desc);
> > > > + }
> > > > +}
> > >
> > > This function is complicated enough that it probably should not be an
> > > inline routine. Not unless it's used in only one place (in which case
> > > why define it in a .h file?).
> >
> > The single user currently (and probably will be for some time at least) is
> > the UVC driver but this code is better located in the USB tree. I'd keep it
> > this way until we have more users, unless Mathias can suggest where the
> > function should be located.
>
> Okay. But in the meantime, how about putting just a declaration for
> this function in include/linux/usb.h and putting the actual (non-inline)
> definition in drivers/usb/core/usb.c, or in drivers/usb/common/common.c
> if you think the function would be used in gadget-side drivers as well
> as host-side drivers?
I'll move it to usb.c in v4.
--
Regards,
Sakari Ailus
next prev parent reply other threads:[~2025-08-12 6:16 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 5:53 [PATCH v3 0/4] eUSB2 Double Isochronous IN Bandwidth support Sakari Ailus
2025-08-07 5:53 ` [PATCH v3 1/4] xhci: Add host support for eUSB2 double isochronous bandwidth devices Sakari Ailus
2025-08-07 15:25 ` Greg KH
2025-08-08 7:55 ` Sakari Ailus
2025-08-07 5:53 ` [PATCH v3 2/4] USB: core: support eUSB2 double bandwidth large isoc URB frames Sakari Ailus
2025-08-07 15:20 ` Alan Stern
2025-08-07 5:53 ` [PATCH v3 3/4] USB: Add a function to obtain USB version independent maximum bpi value Sakari Ailus
2025-08-07 15:19 ` Alan Stern
2025-08-08 8:18 ` Sakari Ailus
2025-08-08 15:16 ` Alan Stern
2025-08-12 6:15 ` Sakari Ailus [this message]
2025-08-07 5:53 ` [PATCH v3 4/4] media: uvcvideo: eUSB2 double isochronous bandwidth support Sakari Ailus
2025-08-07 6:38 ` Ricardo Ribalda
2025-08-07 13:15 ` Laurent Pinchart
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=aJrcDLVd0r_sr9xL@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=amardeep.rai@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=r.kannappan@intel.com \
--cc=stern@rowland.harvard.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.