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.

Bluetooth: btmtk: 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>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Johan Hovold and committed by
Luiz Augusto von Dentz
12094165 5c31aaa0

+5 -24
+5 -24
drivers/bluetooth/btmtk.c
··· 995 995 { 996 996 struct btmtk_data *btmtk_data = hci_get_priv(hdev); 997 997 struct usb_interface *intf = btmtk_data->isopkt_intf; 998 - int i, err; 998 + int err; 999 999 1000 1000 if (!btmtk_data->isopkt_intf) 1001 1001 return -ENODEV; ··· 1006 1006 return err; 1007 1007 } 1008 1008 1009 - btmtk_data->isopkt_tx_ep = NULL; 1010 - btmtk_data->isopkt_rx_ep = NULL; 1011 - 1012 - for (i = 0; i < intf->cur_altsetting->desc.bNumEndpoints; i++) { 1013 - struct usb_endpoint_descriptor *ep_desc; 1014 - 1015 - ep_desc = &intf->cur_altsetting->endpoint[i].desc; 1016 - 1017 - if (!btmtk_data->isopkt_tx_ep && 1018 - usb_endpoint_is_int_out(ep_desc)) { 1019 - btmtk_data->isopkt_tx_ep = ep_desc; 1020 - continue; 1021 - } 1022 - 1023 - if (!btmtk_data->isopkt_rx_ep && 1024 - usb_endpoint_is_int_in(ep_desc)) { 1025 - btmtk_data->isopkt_rx_ep = ep_desc; 1026 - continue; 1027 - } 1028 - } 1029 - 1030 - if (!btmtk_data->isopkt_tx_ep || 1031 - !btmtk_data->isopkt_rx_ep) { 1009 + err = usb_find_common_endpoints(intf->cur_altsetting, NULL, NULL, 1010 + &btmtk_data->isopkt_rx_ep, 1011 + &btmtk_data->isopkt_tx_ep); 1012 + if (err) { 1032 1013 bt_dev_err(hdev, "invalid interrupt descriptors"); 1033 1014 return -ENODEV; 1034 1015 }