795-v6.3-04-r8152-remove-rtl_vendor_mode-function.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. From 95a4c1d617b92cdc4522297741b56e8f6cd01a1e Mon Sep 17 00:00:00 2001
  2. From: Hayes Wang <[email protected]>
  3. Date: Thu, 19 Jan 2023 15:40:42 +0800
  4. Subject: [PATCH] r8152: remove rtl_vendor_mode function
  5. After commit ec51fbd1b8a2 ("r8152: add USB device driver for
  6. config selection"), the code about changing USB configuration
  7. in rtl_vendor_mode() wouldn't be run anymore. Therefore, the
  8. function could be removed.
  9. Signed-off-by: Hayes Wang <[email protected]>
  10. Signed-off-by: Jakub Kicinski <[email protected]>
  11. ---
  12. drivers/net/usb/r8152.c | 39 +--------------------------------------
  13. 1 file changed, 1 insertion(+), 38 deletions(-)
  14. --- a/drivers/net/usb/r8152.c
  15. +++ b/drivers/net/usb/r8152.c
  16. @@ -8288,43 +8288,6 @@ static bool rtl_check_vendor_ok(struct u
  17. return true;
  18. }
  19. -static bool rtl_vendor_mode(struct usb_interface *intf)
  20. -{
  21. - struct usb_host_interface *alt = intf->cur_altsetting;
  22. - struct usb_device *udev;
  23. - struct usb_host_config *c;
  24. - int i, num_configs;
  25. -
  26. - if (alt->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC)
  27. - return rtl_check_vendor_ok(intf);
  28. -
  29. - /* The vendor mode is not always config #1, so to find it out. */
  30. - udev = interface_to_usbdev(intf);
  31. - c = udev->config;
  32. - num_configs = udev->descriptor.bNumConfigurations;
  33. - if (num_configs < 2)
  34. - return false;
  35. -
  36. - for (i = 0; i < num_configs; (i++, c++)) {
  37. - struct usb_interface_descriptor *desc = NULL;
  38. -
  39. - if (c->desc.bNumInterfaces > 0)
  40. - desc = &c->intf_cache[0]->altsetting->desc;
  41. - else
  42. - continue;
  43. -
  44. - if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC) {
  45. - usb_driver_set_configuration(udev, c->desc.bConfigurationValue);
  46. - break;
  47. - }
  48. - }
  49. -
  50. - if (i == num_configs)
  51. - dev_err(&intf->dev, "Unexpected Device\n");
  52. -
  53. - return false;
  54. -}
  55. -
  56. static int rtl8152_pre_reset(struct usb_interface *intf)
  57. {
  58. struct r8152 *tp = usb_get_intfdata(intf);
  59. @@ -9686,7 +9649,7 @@ static int rtl8152_probe(struct usb_inte
  60. if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC)
  61. return -ENODEV;
  62. - if (!rtl_vendor_mode(intf))
  63. + if (!rtl_check_vendor_ok(intf))
  64. return -ENODEV;
  65. usb_reset_device(udev);