Re: [PATCH] USB: core: Add eUSB2 descriptor and parsing in USB core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 21, 2025 at 10:53:08AM +0200, Mathias Nyman wrote:
> We did consider defining 0x0220, but checked that usb core uses magic numbers
> for bcdUSB in other places:
> 
> hcd.c:  if (le16_to_cpu(usb_dev->descriptor.bcdUSB) >= 0x0201) {
> hub.c:                  (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0300)) {
> hub.c:  if (le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0201) {
> hub.c:          if (le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0200
> hub.h:          le16_to_cpu(hdev->descriptor.bcdUSB) >= 0x0310 &&
> 
> Makes sense to add a separate patch later on that define all these.

It's hard to imagine how introducing #define's for these numbers could 
improve the readability of the code.  I mean, is it really better to 
say

	if (le16_to_cpu(udev->descriptor.bcdUSB) >= USB_v3_10

than

	if (le16_to_cpu(udev->descriptor.bcdUSB) >= 0x0310

?

Alan Stern




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux