mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
nfc: nfcmrvl: 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/20260330103655.1672331-2-johan@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
177750206f
commit
dba69cba4a
@@ -288,9 +288,9 @@ static int nfcmrvl_probe(struct usb_interface *intf,
|
||||
{
|
||||
struct nfcmrvl_usb_drv_data *drv_data;
|
||||
struct nfcmrvl_private *priv;
|
||||
int i;
|
||||
struct usb_device *udev = interface_to_usbdev(intf);
|
||||
struct nfcmrvl_platform_data config;
|
||||
int ret;
|
||||
|
||||
/* No configuration for USB */
|
||||
memset(&config, 0, sizeof(config));
|
||||
@@ -302,21 +302,9 @@ static int nfcmrvl_probe(struct usb_interface *intf,
|
||||
if (!drv_data)
|
||||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) {
|
||||
struct usb_endpoint_descriptor *ep_desc;
|
||||
|
||||
ep_desc = &intf->cur_altsetting->endpoint[i].desc;
|
||||
|
||||
if (!drv_data->bulk_tx_ep &&
|
||||
usb_endpoint_is_bulk_out(ep_desc)) {
|
||||
drv_data->bulk_tx_ep = ep_desc;
|
||||
} else if (!drv_data->bulk_rx_ep &&
|
||||
usb_endpoint_is_bulk_in(ep_desc)) {
|
||||
drv_data->bulk_rx_ep = ep_desc;
|
||||
}
|
||||
}
|
||||
|
||||
if (!drv_data->bulk_tx_ep || !drv_data->bulk_rx_ep)
|
||||
ret = usb_find_common_endpoints(intf->cur_altsetting, &drv_data->bulk_rx_ep,
|
||||
&drv_data->bulk_tx_ep, NULL, NULL);
|
||||
if (ret)
|
||||
return -ENODEV;
|
||||
|
||||
drv_data->udev = udev;
|
||||
|
||||
Reference in New Issue
Block a user