]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: at76c50x: refactor endpoint lookup
authorJohan Hovold <johan@kernel.org>
Tue, 7 Apr 2026 15:11:09 +0000 (17:11 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 8 Apr 2026 06:33:40 +0000 (08:33 +0200)
Use the common USB helper for looking up bulk and interrupt endpoints
instead of open coding.

Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260407151111.3187826-2-johan@kernel.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/atmel/at76c50x-usb.c

index 44b04ea3cc8b06d376217ca8538ba459c605e372..32e3e09e7680bb528bc55d809ad32f10cd9353be 100644 (file)
@@ -2226,34 +2226,20 @@ static struct at76_priv *at76_alloc_new_device(struct usb_device *udev)
 static int at76_alloc_urbs(struct at76_priv *priv,
                           struct usb_interface *interface)
 {
-       struct usb_endpoint_descriptor *endpoint, *ep_in, *ep_out;
-       int i;
+       struct usb_endpoint_descriptor *ep_in, *ep_out;
        int buffer_size;
        struct usb_host_interface *iface_desc;
+       int ret;
 
        at76_dbg(DBG_PROC_ENTRY, "%s: ENTER", __func__);
 
        at76_dbg(DBG_URB, "%s: NumEndpoints %d ", __func__,
                 interface->cur_altsetting->desc.bNumEndpoints);
 
-       ep_in = NULL;
-       ep_out = NULL;
        iface_desc = interface->cur_altsetting;
-       for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
-               endpoint = &iface_desc->endpoint[i].desc;
-
-               at76_dbg(DBG_URB, "%s: %d. endpoint: addr 0x%x attr 0x%x",
-                        __func__, i, endpoint->bEndpointAddress,
-                        endpoint->bmAttributes);
-
-               if (!ep_in && usb_endpoint_is_bulk_in(endpoint))
-                       ep_in = endpoint;
 
-               if (!ep_out && usb_endpoint_is_bulk_out(endpoint))
-                       ep_out = endpoint;
-       }
-
-       if (!ep_in || !ep_out) {
+       ret = usb_find_common_endpoints(iface_desc, &ep_in, &ep_out, NULL, NULL);
+       if (ret) {
                dev_err(&interface->dev, "bulk endpoints missing\n");
                return -ENXIO;
        }