The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: Ricardo Ribalda <ribalda@chromium.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] media: uvcvideo: Use USB_DEVICE_AND_INTERFACE_INFO macro
Date: Mon, 30 Nov 2026 15:16:48 +0100	[thread overview]
Message-ID: <574cdec6-2429-4caa-a8ea-6a9cc7a57fe5@kernel.org> (raw)
In-Reply-To: <CANiDSCtadrjWaoB=z3DnUmKb=bgdGbB6L-x9+nM3N-fK2eMOGQ@mail.gmail.com>

Hi,

On 30-Nov-26 14:50, Ricardo Ribalda wrote:
> Hi Laurent
> 
> 
> On Mon, 30 Nov 2026 at 14:35, Laurent Pinchart
> <laurent.pinchart@ideasonboard.com> 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@chromium.org>
>>> ---
>>>  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.

FWIW I'm fine with relaxing the 80 columns rule for the USB_DEVICE_AND_INTERFACE_INFO()
lines.

Regards,

Hans



  reply	other threads:[~2026-11-30 14:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 15:29 [PATCH 0/3] media: uvcvideo: Automate quirk sorting Ricardo Ribalda
2026-10-02 15:29 ` [PATCH 1/3] media: uvcvideo: Use USB_DEVICE_AND_INTERFACE_INFO macro Ricardo Ribalda
2026-11-30 13:05   ` Hans de Goede
2026-11-30 13:34   ` Laurent Pinchart
2026-11-30 13:50     ` Ricardo Ribalda
2026-11-30 14:16       ` Hans de Goede [this message]
2026-10-02 15:29 ` [PATCH 2/3] media: uvcvideo: Convert one quirk to a per_device check Ricardo Ribalda
2026-11-30 13:07   ` Hans de Goede
2026-11-30 13:23   ` Laurent Pinchart
2026-11-30 13:26     ` Ricardo Ribalda
2026-11-30 13:37       ` Laurent Pinchart
2026-11-30 13:41     ` Hans de Goede
2026-11-30 13:50       ` Laurent Pinchart
2026-10-02 15:29 ` [PATCH 3/3] media: uvcvideo: Sort all the uvc_ids quirks Ricardo Ribalda
2026-11-30 13:25   ` Laurent Pinchart
2026-11-30 13:31   ` Hans de Goede

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=574cdec6-2429-4caa-a8ea-6a9cc7a57fe5@kernel.org \
    --to=hansg@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=ribalda@chromium.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