1 From 02767440e1dda9861a11ca1dbe0f19a760b1d5c2 Mon Sep 17 00:00:00 2001
2 From: Hayes Wang <hayeswang@realtek.com>
3 Date: Thu, 19 Jan 2023 15:40:43 +0800
4 Subject: [PATCH] r8152: reduce the control transfer of rtl8152_get_version()
6 Reduce the control transfer by moving calling rtl8152_get_version() in
7 rtl8152_probe(). This could prevent from calling rtl8152_get_version()
8 for unnecessary situations. For example, after setting config #2 for the
9 device, there are two interfaces and rtl8152_probe() may be called
10 twice. However, we don't need to call rtl8152_get_version() for this
13 Signed-off-by: Hayes Wang <hayeswang@realtek.com>
14 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
16 drivers/net/usb/r8152.c | 9 +++++----
17 1 file changed, 5 insertions(+), 4 deletions(-)
19 --- a/drivers/net/usb/r8152.c
20 +++ b/drivers/net/usb/r8152.c
21 @@ -9588,20 +9588,21 @@ static int rtl8152_probe(struct usb_inte
22 const struct usb_device_id *id)
24 struct usb_device *udev = interface_to_usbdev(intf);
25 - u8 version = rtl8152_get_version(intf);
27 struct net_device *netdev;
31 - if (version == RTL_VER_UNKNOWN)
34 if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC)
37 if (!rtl_check_vendor_ok(intf))
40 + version = rtl8152_get_version(intf);
41 + if (version == RTL_VER_UNKNOWN)
44 usb_reset_device(udev);
45 netdev = alloc_etherdev(sizeof(struct r8152));