diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/qcserial.c | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c index 996015c5f1ac..74e0b132af3d 100644 --- a/drivers/usb/serial/qcserial.c +++ b/drivers/usb/serial/qcserial.c | |||
@@ -127,6 +127,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
127 | __u8 nintf; | 127 | __u8 nintf; |
128 | __u8 ifnum; | 128 | __u8 ifnum; |
129 | bool is_gobi1k = id->driver_info ? true : false; | 129 | bool is_gobi1k = id->driver_info ? true : false; |
130 | int altsetting = -1; | ||
130 | 131 | ||
131 | dev_dbg(dev, "Is Gobi 1000 = %d\n", is_gobi1k); | 132 | dev_dbg(dev, "Is Gobi 1000 = %d\n", is_gobi1k); |
132 | 133 | ||
@@ -160,15 +161,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
160 | retval = 0; /* Success */ | 161 | retval = 0; /* Success */ |
161 | break; | 162 | break; |
162 | } | 163 | } |
163 | 164 | altsetting = 1; | |
164 | retval = usb_set_interface(serial->dev, ifnum, 1); | ||
165 | if (retval < 0) { | ||
166 | dev_err(dev, | ||
167 | "Could not set interface, error %d\n", | ||
168 | retval); | ||
169 | retval = -ENODEV; | ||
170 | kfree(data); | ||
171 | } | ||
172 | } | 165 | } |
173 | break; | 166 | break; |
174 | 167 | ||
@@ -193,24 +186,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
193 | 186 | ||
194 | if (ifnum == 1 && !is_gobi1k) { | 187 | if (ifnum == 1 && !is_gobi1k) { |
195 | dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n"); | 188 | dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n"); |
196 | retval = usb_set_interface(serial->dev, ifnum, 0); | 189 | altsetting = 0; |
197 | if (retval < 0) { | ||
198 | dev_err(dev, | ||
199 | "Could not set interface, error %d\n", | ||
200 | retval); | ||
201 | retval = -ENODEV; | ||
202 | kfree(data); | ||
203 | } | ||
204 | } else if (ifnum == 2) { | 190 | } else if (ifnum == 2) { |
205 | dev_dbg(dev, "Modem port found\n"); | 191 | dev_dbg(dev, "Modem port found\n"); |
206 | retval = usb_set_interface(serial->dev, ifnum, 0); | 192 | altsetting = 0; |
207 | if (retval < 0) { | ||
208 | dev_err(dev, | ||
209 | "Could not set interface, error %d\n", | ||
210 | retval); | ||
211 | retval = -ENODEV; | ||
212 | kfree(data); | ||
213 | } | ||
214 | } else if (ifnum==3 && !is_gobi1k) { | 193 | } else if (ifnum==3 && !is_gobi1k) { |
215 | /* | 194 | /* |
216 | * NMEA (serial line 9600 8N1) | 195 | * NMEA (serial line 9600 8N1) |
@@ -218,14 +197,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
218 | * # echo "\$GPS_STOP" > /dev/ttyUSBx | 197 | * # echo "\$GPS_STOP" > /dev/ttyUSBx |
219 | */ | 198 | */ |
220 | dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n"); | 199 | dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n"); |
221 | retval = usb_set_interface(serial->dev, ifnum, 0); | 200 | altsetting = 0; |
222 | if (retval < 0) { | ||
223 | dev_err(dev, | ||
224 | "Could not set interface, error %d\n", | ||
225 | retval); | ||
226 | retval = -ENODEV; | ||
227 | kfree(data); | ||
228 | } | ||
229 | } | 201 | } |
230 | break; | 202 | break; |
231 | 203 | ||
@@ -235,6 +207,17 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id) | |||
235 | retval = -ENODEV; | 207 | retval = -ENODEV; |
236 | } | 208 | } |
237 | 209 | ||
210 | if (altsetting >= 0) { | ||
211 | retval = usb_set_interface(serial->dev, ifnum, altsetting); | ||
212 | if (retval < 0) { | ||
213 | dev_err(dev, | ||
214 | "Could not set interface, error %d\n", | ||
215 | retval); | ||
216 | retval = -ENODEV; | ||
217 | kfree(data); | ||
218 | } | ||
219 | } | ||
220 | |||
238 | /* Set serial->private if not returning -ENODEV */ | 221 | /* Set serial->private if not returning -ENODEV */ |
239 | if (retval != -ENODEV) | 222 | if (retval != -ENODEV) |
240 | usb_set_serial_data(serial, data); | 223 | usb_set_serial_data(serial, data); |