Commit 0d4cda80 authored by Hayes Wang's avatar Hayes Wang Committed by David S. Miller

r8152: avoid to change cfg for all devices

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: ec51fbd1 ("r8152: add USB device driver for config selection")
Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8e7610e6
......@@ -9500,9 +9500,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;
......@@ -9571,10 +9570,19 @@ u8 rtl8152_get_version(struct usb_interface *intf)
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;
......@@ -9870,6 +9878,12 @@ static int rtl8152_cfgselector_probe(struct usb_device *udev)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment