Skip to content

Commit 0276744

Browse files
hayesorzkuba-moo
authored andcommitted
r8152: reduce the control transfer of rtl8152_get_version()
Reduce the control transfer by moving calling rtl8152_get_version() in rtl8152_probe(). This could prevent from calling rtl8152_get_version() for unnecessary situations. For example, after setting config #2 for the device, there are two interfaces and rtl8152_probe() may be called twice. However, we don't need to call rtl8152_get_version() for this situation. Signed-off-by: Hayes Wang <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 95a4c1d commit 0276744

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/net/usb/r8152.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9581,20 +9581,21 @@ static int rtl8152_probe(struct usb_interface *intf,
95819581
const struct usb_device_id *id)
95829582
{
95839583
struct usb_device *udev = interface_to_usbdev(intf);
9584-
u8 version = rtl8152_get_version(intf);
95859584
struct r8152 *tp;
95869585
struct net_device *netdev;
9586+
u8 version;
95879587
int ret;
95889588

9589-
if (version == RTL_VER_UNKNOWN)
9590-
return -ENODEV;
9591-
95929589
if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC)
95939590
return -ENODEV;
95949591

95959592
if (!rtl_check_vendor_ok(intf))
95969593
return -ENODEV;
95979594

9595+
version = rtl8152_get_version(intf);
9596+
if (version == RTL_VER_UNKNOWN)
9597+
return -ENODEV;
9598+
95989599
usb_reset_device(udev);
95999600
netdev = alloc_etherdev(sizeof(struct r8152));
96009601
if (!netdev) {

0 commit comments

Comments
 (0)