Re: [PATCH 1/3] media: uvcvideo: Use USB_DEVICE_AND_INTERFACE_INFO macro

From: Laurent Pinchart

Date: Mon Nov 30 2026 - 21:54:05 EST


On Mon, Nov 30, 2026 at 02:50:34PM +0100, Ricardo Ribalda wrote:
> On Mon, 30 Nov 2026 at 14:35, Laurent Pinchart wrote:
> > On Fri, Oct 02, 2026 at 03:29:05PM +0000, Ricardo Ribalda wrote:
> > > It makes the code arguably nicer and also add some structure that we can
> > > later use to automate checking for the quirks ordering.
> > >
> > > It also introduces a new macro UVC_INFO_VERSION to make the code even
> > > nicer.
> > >
> > > This does not introduce any change in the code:
> > > $ diff <(objdump -S drivers/media/usb/uvc/uvc_driver.o) \
> > > <(objdump -S drivers/media/usb/uvc/uvc_driver.o.patched)
> >
> > Wow, I didn't know anyone still used non-unified diffs :-)
> >
> > > 2c2
> > > < drivers/media/usb/uvc/uvc_driver.o: file format elf64-x86-64
> > > ---
> > > > drivers/media/usb/uvc/uvc_driver.o.patched: file format elf64-x86-64
> > > $
> > >
> > > Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> > > ---
> > > drivers/media/usb/uvc/uvc_driver.c | 704 ++++++-------------------------------
> > > 1 file changed, 107 insertions(+), 597 deletions(-)
> > >
> > > diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> > > index cbc14569716b..b789bc55e02b 100644
> > > --- a/drivers/media/usb/uvc/uvc_driver.c
> > > +++ b/drivers/media/usb/uvc/uvc_driver.c
> > > @@ -2539,6 +2539,8 @@ static const struct uvc_device_info uvc_quirk_force_y8 = {
> > > #define UVC_INFO_QUIRK(q) (kernel_ulong_t)&(struct uvc_device_info){.quirks = q}
> > > #define UVC_INFO_META(m) (kernel_ulong_t)&(struct uvc_device_info) \
> > > {.meta_format = m}
> > > +#define UVC_INFO_VERSION(v) (kernel_ulong_t)&(const struct uvc_device_info) \
> > > + {.uvc_version = v}
> > >
> > > /*
> > > * The Logitech cameras listed below have their interface class set to
> > > @@ -2549,556 +2551,195 @@ static const struct uvc_device_info uvc_quirk_force_y8 = {
> > > */
> > > static const struct usb_device_id uvc_ids[] = {
> > > /* HP Webcam HD 2300 */
> > > - { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
> > > - | USB_DEVICE_ID_MATCH_INT_INFO,
> > > - .idVendor = 0x03f0,
> > > - .idProduct = 0xe207,
> > > - .bInterfaceClass = USB_CLASS_VIDEO,
> > > - .bInterfaceSubClass = 1,
> > > - .bInterfaceProtocol = 0,
> > > + { USB_DEVICE_AND_INTERFACE_INFO(0x03f0, 0xe207, USB_CLASS_VIDEO, 1, 0),
> >
> > We could introduce a UVC_DEVICE_AND_INTERFACE_INFO() macro:
> >
> > #define UVC_DEVICE_AND_INTERFACE_INFO(vend, prod, pr) \
> > USB_DEVICE_AND_INTERFACE_INFO(vend, prod, USB_CLASS_VIDEO, 1, pr)
> >
> > to further shorten the lines. However, there are 9 entries that use
> > USB_CLASS_VENDOR_SPEC. Would keeping USB_DEVICE_AND_INTERFACE_INFO()
> > foor those break your sorting tool ?
>
> Yeah, I think it will break the nice sorting rule as is, or it will
> require that we use an obscure regex
> https://github.com/google/keep-sorted#regular-expressions
>
> I'd rather relax the 80 column rule for the quirks... but you probably
> won't like that.

I do actually :-) Assuming you mean USB_DEVICE_AND_INTERFACE_INFO() on
one line followed by .driver_info on a second line.

> > > .driver_info = (kernel_ulong_t)&uvc_quirk_stream_no_fid },
> >
> > [snip]

--
Regards,

Laurent Pinchart