From: Greg Kroah-Hartman Date: Mon, 18 Dec 2023 12:06:51 +0000 (+0100) Subject: 6.1-stable patches X-Git-Tag: v5.15.144~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=389f15e5c18735ba494f35802d0bc317d1a61f80;p=thirdparty%2Fkernel%2Fstable-queue.git 6.1-stable patches added patches: r8152-avoid-to-change-cfg-for-all-devices.patch r8152-fix-the-autosuspend-doesn-t-work.patch r8152-remove-rtl_vendor_mode-function.patch --- diff --git a/queue-6.1/r8152-avoid-to-change-cfg-for-all-devices.patch b/queue-6.1/r8152-avoid-to-change-cfg-for-all-devices.patch new file mode 100644 index 00000000000..183f33277fd --- /dev/null +++ b/queue-6.1/r8152-avoid-to-change-cfg-for-all-devices.patch @@ -0,0 +1,69 @@ +From 0d4cda805a183bbe523f2407edb5c14ade50b841 Mon Sep 17 00:00:00 2001 +From: Hayes Wang +Date: Tue, 17 Jan 2023 11:03:44 +0800 +Subject: r8152: avoid to change cfg for all devices + +From: Hayes Wang + +commit 0d4cda805a183bbe523f2407edb5c14ade50b841 upstream. + +The rtl8152_cfgselector_probe() should set the USB configuration to the +vendor mode only for the devices which the driver (r8152) supports. +Otherwise, no driver would be used for such devices. + +Fixes: ec51fbd1b8a2 ("r8152: add USB device driver for config selection") +Signed-off-by: Hayes Wang +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/usb/r8152.c | 20 +++++++++++++++++--- + 1 file changed, 17 insertions(+), 3 deletions(-) + +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -9556,9 +9556,8 @@ static int rtl_fw_init(struct r8152 *tp) + return 0; + } + +-u8 rtl8152_get_version(struct usb_interface *intf) ++static u8 __rtl_get_hw_ver(struct usb_device *udev) + { +- struct usb_device *udev = interface_to_usbdev(intf); + u32 ocp_data = 0; + __le32 *tmp; + u8 version; +@@ -9628,10 +9627,19 @@ u8 rtl8152_get_version(struct usb_interf + break; + default: + version = RTL_VER_UNKNOWN; +- dev_info(&intf->dev, "Unknown version 0x%04x\n", ocp_data); ++ dev_info(&udev->dev, "Unknown version 0x%04x\n", ocp_data); + break; + } + ++ return version; ++} ++ ++u8 rtl8152_get_version(struct usb_interface *intf) ++{ ++ u8 version; ++ ++ version = __rtl_get_hw_ver(interface_to_usbdev(intf)); ++ + dev_dbg(&intf->dev, "Detected version 0x%04x\n", version); + + return version; +@@ -9933,6 +9941,12 @@ static int rtl8152_cfgselector_probe(str + struct usb_host_config *c; + int i, num_configs; + ++ /* Switch the device to vendor mode, if and only if the vendor mode ++ * driver supports it. ++ */ ++ if (__rtl_get_hw_ver(udev) == RTL_VER_UNKNOWN) ++ return 0; ++ + /* The vendor mode is not always config #1, so to find it out. */ + c = udev->config; + num_configs = udev->descriptor.bNumConfigurations; diff --git a/queue-6.1/r8152-fix-the-autosuspend-doesn-t-work.patch b/queue-6.1/r8152-fix-the-autosuspend-doesn-t-work.patch new file mode 100644 index 00000000000..1c46337e3c2 --- /dev/null +++ b/queue-6.1/r8152-fix-the-autosuspend-doesn-t-work.patch @@ -0,0 +1,29 @@ +From 0fbd79c01a9a657348f7032df70c57a406468c86 Mon Sep 17 00:00:00 2001 +From: Hayes Wang +Date: Tue, 2 May 2023 11:36:27 +0800 +Subject: r8152: fix the autosuspend doesn't work + +From: Hayes Wang + +commit 0fbd79c01a9a657348f7032df70c57a406468c86 upstream. + +Set supports_autosuspend = 1 for the rtl8152_cfgselector_driver. + +Fixes: ec51fbd1b8a2 ("r8152: add USB device driver for config selection") +Signed-off-by: Hayes Wang +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/usb/r8152.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -9940,6 +9940,7 @@ static struct usb_device_driver rtl8152_ + .probe = rtl8152_cfgselector_probe, + .id_table = rtl8152_table, + .generic_subclass = 1, ++ .supports_autosuspend = 1, + }; + + static int __init rtl8152_driver_init(void) diff --git a/queue-6.1/r8152-remove-rtl_vendor_mode-function.patch b/queue-6.1/r8152-remove-rtl_vendor_mode-function.patch new file mode 100644 index 00000000000..40c23d46a65 --- /dev/null +++ b/queue-6.1/r8152-remove-rtl_vendor_mode-function.patch @@ -0,0 +1,76 @@ +From 95a4c1d617b92cdc4522297741b56e8f6cd01a1e Mon Sep 17 00:00:00 2001 +From: Hayes Wang +Date: Thu, 19 Jan 2023 15:40:42 +0800 +Subject: r8152: remove rtl_vendor_mode function + +From: Hayes Wang + +commit 95a4c1d617b92cdc4522297741b56e8f6cd01a1e upstream. + +After commit ec51fbd1b8a2 ("r8152: add USB device driver for +config selection"), the code about changing USB configuration +in rtl_vendor_mode() wouldn't be run anymore. Therefore, the +function could be removed. + +Signed-off-by: Hayes Wang +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/usb/r8152.c | 39 +-------------------------------------- + 1 file changed, 1 insertion(+), 38 deletions(-) + +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -8288,43 +8288,6 @@ static bool rtl_check_vendor_ok(struct u + return true; + } + +-static bool rtl_vendor_mode(struct usb_interface *intf) +-{ +- struct usb_host_interface *alt = intf->cur_altsetting; +- struct usb_device *udev; +- struct usb_host_config *c; +- int i, num_configs; +- +- if (alt->desc.bInterfaceClass == USB_CLASS_VENDOR_SPEC) +- return rtl_check_vendor_ok(intf); +- +- /* The vendor mode is not always config #1, so to find it out. */ +- udev = interface_to_usbdev(intf); +- c = udev->config; +- num_configs = udev->descriptor.bNumConfigurations; +- if (num_configs < 2) +- return false; +- +- for (i = 0; i < num_configs; (i++, c++)) { +- struct usb_interface_descriptor *desc = NULL; +- +- if (c->desc.bNumInterfaces > 0) +- desc = &c->intf_cache[0]->altsetting->desc; +- else +- continue; +- +- if (desc->bInterfaceClass == USB_CLASS_VENDOR_SPEC) { +- usb_driver_set_configuration(udev, c->desc.bConfigurationValue); +- break; +- } +- } +- +- if (i == num_configs) +- dev_err(&intf->dev, "Unexpected Device\n"); +- +- return false; +-} +- + static int rtl8152_pre_reset(struct usb_interface *intf) + { + struct r8152 *tp = usb_get_intfdata(intf); +@@ -9686,7 +9649,7 @@ static int rtl8152_probe(struct usb_inte + if (intf->cur_altsetting->desc.bInterfaceClass != USB_CLASS_VENDOR_SPEC) + return -ENODEV; + +- if (!rtl_vendor_mode(intf)) ++ if (!rtl_check_vendor_ok(intf)) + return -ENODEV; + + usb_reset_device(udev); diff --git a/queue-6.1/series b/queue-6.1/series index 297a50921cb..4edbf1ef0a8 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -101,3 +101,6 @@ ring-buffer-fix-a-race-in-rb_time_cmpxchg-for-32-bit-archs.patch ring-buffer-do-not-try-to-put-back-write_stamp.patch ring-buffer-have-rb_time_cmpxchg-set-the-msb-counter-too.patch net-tls-update-curr-on-splice-as-well.patch +r8152-avoid-to-change-cfg-for-all-devices.patch +r8152-remove-rtl_vendor_mode-function.patch +r8152-fix-the-autosuspend-doesn-t-work.patch