Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

wifi: at76c50x: refactor endpoint lookup

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>

authored by

Johan Hovold and committed by
Johannes Berg
607363a1 aa5e9884

+4 -18
+4 -18
drivers/net/wireless/atmel/at76c50x-usb.c
··· 2226 2226 static int at76_alloc_urbs(struct at76_priv *priv, 2227 2227 struct usb_interface *interface) 2228 2228 { 2229 - struct usb_endpoint_descriptor *endpoint, *ep_in, *ep_out; 2230 - int i; 2229 + struct usb_endpoint_descriptor *ep_in, *ep_out; 2231 2230 int buffer_size; 2232 2231 struct usb_host_interface *iface_desc; 2232 + int ret; 2233 2233 2234 2234 at76_dbg(DBG_PROC_ENTRY, "%s: ENTER", __func__); 2235 2235 2236 2236 at76_dbg(DBG_URB, "%s: NumEndpoints %d ", __func__, 2237 2237 interface->cur_altsetting->desc.bNumEndpoints); 2238 2238 2239 - ep_in = NULL; 2240 - ep_out = NULL; 2241 2239 iface_desc = interface->cur_altsetting; 2242 - for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { 2243 - endpoint = &iface_desc->endpoint[i].desc; 2244 2240 2245 - at76_dbg(DBG_URB, "%s: %d. endpoint: addr 0x%x attr 0x%x", 2246 - __func__, i, endpoint->bEndpointAddress, 2247 - endpoint->bmAttributes); 2248 - 2249 - if (!ep_in && usb_endpoint_is_bulk_in(endpoint)) 2250 - ep_in = endpoint; 2251 - 2252 - if (!ep_out && usb_endpoint_is_bulk_out(endpoint)) 2253 - ep_out = endpoint; 2254 - } 2255 - 2256 - if (!ep_in || !ep_out) { 2241 + ret = usb_find_common_endpoints(iface_desc, &ep_in, &ep_out, NULL, NULL); 2242 + if (ret) { 2257 2243 dev_err(&interface->dev, "bulk endpoints missing\n"); 2258 2244 return -ENXIO; 2259 2245 }