[PATCH] usb: option.c: Fix Cinterion AHxx enumeration.

From: John Ernberg
Date: Tue Dec 22 2015 - 05:57:12 EST


From: John Ernberg <john.ernberg@xxxxxxxx>

In certain kernel configurations where the cdc_ether and option drivers
are compiled as modules there can occur a race condition in enumeration.
This causes the option driver to enumerate the ethernet(wwan) interface
as usb-serial interfaces.

In dmesg it may look like this:
[ 18.380585] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 18.592290] usbcore: registered new interface driver usbserial
[ 18.606636] usbcore: registered new interface driver usbserial_generic
[ 18.614815] usbserial: USB Serial support registered for generic
[ 18.652111] usbcore: registered new interface driver option
[ 18.659745] usbserial: USB Serial support registered for GSM modem (1-port)
[ 18.667600] option 1-1:1.0: GSM modem (1-port) converter detected
[ 18.676906] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 18.686725] cdc_ether 1-1:1.4 wwan0: register 'cdc_ether' at usb-ci_hdrc.1-1, Mobile Broadband Network Device
[ 18.705587] option 1-1:1.1: GSM modem (1-port) converter detected
[ 18.713468] usbcore: registered new interface driver cdc_ether
[ 18.719930] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 18.729770] option 1-1:1.2: GSM modem (1-port) converter detected
[ 18.737421] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 18.745232] option 1-1:1.3: GSM modem (1-port) converter detected
[ 18.752838] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
[ 43.422579] option1 ttyUSB3: option_instat_callback: error -71
[ 43.622575] option1 ttyUSB3: option_instat_callback: error -71
[ 43.822579] option1 ttyUSB3: option_instat_callback: error -71
[ 44.022575] option1 ttyUSB3: option_instat_callback: error -71
[ 44.222569] option1 ttyUSB3: option_instat_callback: error -71
[ 44.398490] usb 1-1: USB disconnect, device number 2
[ 44.405414] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
[ 44.417200] option 1-1:1.0: device disconnected
[ 44.424903] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[ 44.434249] option 1-1:1.1: device disconnected
[ 44.438824] option1 ttyUSB3: option_instat_callback: error -71
[ 44.448436] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
[ 44.457736] option 1-1:1.2: device disconnected
[ 44.465204] option1 ttyUSB3: GSM modem (1-port) converter now disconnected from ttyUSB3
[ 44.474480] option 1-1:1.3: device disconnected
[ 44.479754] cdc_ether 1-1:1.4 wwan0: unregister 'cdc_ether' usb-ci_hdrc.1-1, Mobile Broadband Network Device
[ 48.960593] usb 1-1: new high-speed USB device number 3 using ci_hdrc
[ 49.116118] option 1-1:1.0: GSM modem (1-port) converter detected
[ 49.123853] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[ 49.132029] option 1-1:1.1: GSM modem (1-port) converter detected
[ 49.138778] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[ 49.147432] option 1-1:1.2: GSM modem (1-port) converter detected
[ 49.154924] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[ 49.162940] option 1-1:1.3: GSM modem (1-port) converter detected
[ 49.169724] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
[ 49.178440] option 1-1:1.4: GSM modem (1-port) converter detected
[ 49.185979] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB4
[ 49.193985] option 1-1:1.5: GSM modem (1-port) converter detected
[ 49.201458] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB5
---
drivers/usb/serial/option.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index f228060..4e483f2 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -1679,7 +1679,7 @@ static const struct usb_device_id option_ids[] = {
{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_EU3_P) },
{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8),
.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
- { USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX) },
+ { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX, 0xff) },
{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX),
.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/