Skip to contentSkip to conversation

ALSA: scarlett2: Use USB API functions rather than constants

PATCH Applied Chen Ni 2 participants 2 messages May 16, 2025

Subsystems (2)
lore
Share & tools
lore

Chen Ni

author
#0 lore raw

PATCH 1/1 ALSA: scarlett2: Use USB API functions rather than constants

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)

---
 sound/usb/mixer_scarlett2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/usb/mixer_scarlett2.c +1 -2
index 288d22e6a0b2..93589e86828a 100644
@@ -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;
Signature · 1 line
2.25.1
Applied
#1 lore raw
Quoted 11 lines · Chen Ni

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)

Thanks, applied.

Takashi