ALSA: scarlett2: Use USB API functions rather than constants
authorChen Ni <nichen@iscas.ac.cn>
Fri, 16 May 2025 07:04:16 +0000 (15:04 +0800)
committerTakashi Iwai <tiwai@suse.de>
Fri, 16 May 2025 07:56:46 +0000 (09:56 +0200)
Use the function usb_endpoint_num() rather than constants.

The Coccinelle semantic patch is as follows:

@@ struct usb_endpoint_descriptor *epd; @@

- (epd->bEndpointAddress & \(USB_ENDPOINT_NUMBER_MASK\|0x0f\))
+ usb_endpoint_num(epd)

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://patch.msgid.link/20250516070416.12458-1-nichen@iscas.ac.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/mixer_scarlett2.c

index 288d22e6a0b25398bc0d69de3a966ca04639388c..93589e86828a3e7a8ebf455a6a498a6e5f4e26a3 100644 (file)
@@ -8574,8 +8574,7 @@ static int scarlett2_find_fc_interface(struct usb_device *dev,
 
                epd = get_endpoint(intf->altsetting, 0);
                private->bInterfaceNumber = desc->bInterfaceNumber;
-               private->bEndpointAddress = epd->bEndpointAddress &
-                       USB_ENDPOINT_NUMBER_MASK;
+               private->bEndpointAddress = usb_endpoint_num(epd);
                private->wMaxPacketSize = le16_to_cpu(epd->wMaxPacketSize);
                private->bInterval = epd->bInterval;
                return 0;