[PATCH] ALSA: usb: fcp: Use USB API functions rather than constants

Chen Ni posted 1 patch 7 months, 1 week ago
sound/usb/fcp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] ALSA: usb: fcp: Use USB API functions rather than constants
Posted by Chen Ni 7 months, 1 week ago
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>
---
 sound/usb/fcp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/usb/fcp.c b/sound/usb/fcp.c
index 7df65041ace5..98f9964311a7 100644
--- a/sound/usb/fcp.c
+++ b/sound/usb/fcp.c
@@ -1092,8 +1092,7 @@ static int fcp_find_fc_interface(struct usb_mixer_interface *mixer)
 
 		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;
-- 
2.25.1
Re: [PATCH] ALSA: usb: fcp: Use USB API functions rather than constants
Posted by Takashi Iwai 7 months, 1 week ago
On Fri, 16 May 2025 09:09:38 +0200,
Chen Ni wrote:
> 
> 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>

Thanks, applied.


Takashi