freebsd-src icon indicating copy to clipboard operation
freebsd-src copied to clipboard

usb: Fix and cleanup quirks list

Open VexedUXR opened this issue 1 year ago • 3 comments

The USB_QUIRK_VP macro was being misused in the usb_quirks list, e.g USB_QUIRK_VP(USB_VENDOR_MPMAN, 0, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY) would set lo_res and hi_res to the first two specified quirks.

I've replaced it with a new macro, USB_QUIRK_VO, which removes the unneeded verbosity. Having this macro also removes the need for the dummy products used to specify vendor only quirks.

I also separated the usb quirks that target specific revisions from those that dont. A lot of the quirks dont use lo_rev and hi_rev, so we can abstract the 0x0000, 0xffff into a macro.

Edit: Forgot to mention that I also replaced a | with ,. Looks like it was left over from eb58441 https://github.com/freebsd/freebsd-src/blob/main/sys/dev/usb/quirk/usb_quirk.c#L335

VexedUXR avatar Apr 04 '24 01:04 VexedUXR

I'm struggling with how to review this. I think that we need to break it up into smaller chunks so we can review and verify it does what it's trying to do. Can you separate all that out please?

bsdimp avatar Apr 19 '24 18:04 bsdimp

I separated the changes into two commits: one replacing USB_QUIRK_VP and another adding USB_QUIRK_REV.

A large part of the changes are in the second commit, not sure I can separate them though.

Edit: Also fix some > 80 character warnings

VexedUXR avatar Apr 20 '24 02:04 VexedUXR

the latest changes look like they can be reviewed, so I'll go over them with a fine toothed comb to see if anything stands out.

bsdimp avatar Apr 23 '24 22:04 bsdimp

That's new :) Thanks.

VexedUXR avatar May 12 '24 11:05 VexedUXR