diff options
author | Alan Cox <alan@redhat.com> | 2008-07-22 06:12:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:03:24 -0400 |
commit | 6d1d1698966ab6a5ac7ddcb16602ffebcf97f887 (patch) | |
tree | bee81abd7990c236e272c8851061c3fbbadf1dbb /drivers/usb/serial/ipw.c | |
parent | eb6215ccd403153c6376f7eaa7b31eef19e488f5 (diff) |
tty-usb-ipw: Coding style
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/serial/ipw.c')
-rw-r--r-- | drivers/usb/serial/ipw.c | 279 |
1 files changed, 144 insertions, 135 deletions
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index a89ebfe9e915..a842025b9b57 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -10,27 +10,27 @@ | |||
10 | * (at your option) any later version. | 10 | * (at your option) any later version. |
11 | * | 11 | * |
12 | * All information about the device was acquired using SnoopyPro | 12 | * All information about the device was acquired using SnoopyPro |
13 | * on MSFT's O/S, and examing the MSFT drivers' debug output | 13 | * on MSFT's O/S, and examing the MSFT drivers' debug output |
14 | * (insanely left _on_ in the enduser version) | 14 | * (insanely left _on_ in the enduser version) |
15 | * | 15 | * |
16 | * It was written out of frustration with the IPWireless USB modem | 16 | * It was written out of frustration with the IPWireless USB modem |
17 | * supplied by Axity3G/Sentech South Africa not supporting | 17 | * supplied by Axity3G/Sentech South Africa not supporting |
18 | * Linux whatsoever. | 18 | * Linux whatsoever. |
19 | * | 19 | * |
20 | * Nobody provided any proprietary information that was not already | 20 | * Nobody provided any proprietary information that was not already |
21 | * available for this device. | 21 | * available for this device. |
22 | * | 22 | * |
23 | * The modem adheres to the "3GPP TS 27.007 AT command set for 3G | 23 | * The modem adheres to the "3GPP TS 27.007 AT command set for 3G |
24 | * User Equipment (UE)" standard, available from | 24 | * User Equipment (UE)" standard, available from |
25 | * http://www.3gpp.org/ftp/Specs/html-info/27007.htm | 25 | * http://www.3gpp.org/ftp/Specs/html-info/27007.htm |
26 | * | 26 | * |
27 | * The code was only tested the IPWireless handheld modem distributed | 27 | * The code was only tested the IPWireless handheld modem distributed |
28 | * in South Africa by Sentech. | 28 | * in South Africa by Sentech. |
29 | * | 29 | * |
30 | * It may work for Woosh Inc in .nz too, as it appears they use the | 30 | * It may work for Woosh Inc in .nz too, as it appears they use the |
31 | * same kit. | 31 | * same kit. |
32 | * | 32 | * |
33 | * There is still some work to be done in terms of handling | 33 | * There is still some work to be done in terms of handling |
34 | * DCD, DTR, RTS, CTS which are currently faked. | 34 | * DCD, DTR, RTS, CTS which are currently faked. |
35 | * It's good enough for PPP at this point. It's based off all kinds of | 35 | * It's good enough for PPP at this point. It's based off all kinds of |
36 | * code found in usb/serial and usb/class | 36 | * code found in usb/serial and usb/class |
@@ -47,7 +47,7 @@ | |||
47 | #include <linux/spinlock.h> | 47 | #include <linux/spinlock.h> |
48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include <linux/usb/serial.h> | 49 | #include <linux/usb/serial.h> |
50 | #include <asm/uaccess.h> | 50 | #include <linux/uaccess.h> |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * Version Information | 53 | * Version Information |
@@ -64,7 +64,7 @@ | |||
64 | 64 | ||
65 | /* Message sizes */ | 65 | /* Message sizes */ |
66 | #define EVENT_BUFFER_SIZE 0xFF | 66 | #define EVENT_BUFFER_SIZE 0xFF |
67 | #define CHAR2INT16(c1,c0) (((u32)((c1) & 0xff) << 8) + (u32)((c0) & 0xff)) | 67 | #define CHAR2INT16(c1, c0) (((u32)((c1) & 0xff) << 8) + (u32)((c0) & 0xff)) |
68 | #define NUM_BULK_URBS 24 | 68 | #define NUM_BULK_URBS 24 |
69 | #define NUM_CONTROL_URBS 16 | 69 | #define NUM_CONTROL_URBS 16 |
70 | 70 | ||
@@ -94,33 +94,34 @@ enum { | |||
94 | 94 | ||
95 | /* data bits */ | 95 | /* data bits */ |
96 | #define ipw_dtb_7 0x700 | 96 | #define ipw_dtb_7 0x700 |
97 | #define ipw_dtb_8 0x810 // ok so the define is misleading, I know, but forces 8,n,1 | 97 | #define ipw_dtb_8 0x810 /* ok so the define is misleading, I know, but forces 8,n,1 */ |
98 | // I mean, is there a point to any other setting these days? :) | 98 | /* I mean, is there a point to any other setting these days? :) */ |
99 | 99 | ||
100 | /* usb control request types : */ | 100 | /* usb control request types : */ |
101 | #define IPW_SIO_RXCTL 0x00 // control bulk rx channel transmissions, value=1/0 (on/off) | 101 | #define IPW_SIO_RXCTL 0x00 /* control bulk rx channel transmissions, value=1/0 (on/off) */ |
102 | #define IPW_SIO_SET_BAUD 0x01 // set baud, value=requested ipw_sio_bxxxx | 102 | #define IPW_SIO_SET_BAUD 0x01 /* set baud, value=requested ipw_sio_bxxxx */ |
103 | #define IPW_SIO_SET_LINE 0x03 // set databits, parity. value=ipw_dtb_x | 103 | #define IPW_SIO_SET_LINE 0x03 /* set databits, parity. value=ipw_dtb_x */ |
104 | #define IPW_SIO_SET_PIN 0x03 // set/clear dtr/rts value=ipw_pin_xxx | 104 | #define IPW_SIO_SET_PIN 0x03 /* set/clear dtr/rts value=ipw_pin_xxx */ |
105 | #define IPW_SIO_POLL 0x08 // get serial port status byte, call with value=0 | 105 | #define IPW_SIO_POLL 0x08 /* get serial port status byte, call with value=0 */ |
106 | #define IPW_SIO_INIT 0x11 // initializes ? value=0 (appears as first thing todo on open) | 106 | #define IPW_SIO_INIT 0x11 /* initializes ? value=0 (appears as first thing todo on open) */ |
107 | #define IPW_SIO_PURGE 0x12 // purge all transmissions?, call with value=numchar_to_purge | 107 | #define IPW_SIO_PURGE 0x12 /* purge all transmissions?, call with value=numchar_to_purge */ |
108 | #define IPW_SIO_HANDFLOW 0x13 // set xon/xoff limits value=0, and a buffer of 0x10 bytes | 108 | #define IPW_SIO_HANDFLOW 0x13 /* set xon/xoff limits value=0, and a buffer of 0x10 bytes */ |
109 | #define IPW_SIO_SETCHARS 0x13 // set the flowcontrol special chars, value=0, buf=6 bytes, | 109 | #define IPW_SIO_SETCHARS 0x13 /* set the flowcontrol special chars, value=0, buf=6 bytes, */ |
110 | // last 2 bytes contain flowcontrol chars e.g. 00 00 00 00 11 13 | 110 | /* last 2 bytes contain flowcontrol chars e.g. 00 00 00 00 11 13 */ |
111 | 111 | ||
112 | /* values used for request IPW_SIO_SET_PIN */ | 112 | /* values used for request IPW_SIO_SET_PIN */ |
113 | #define IPW_PIN_SETDTR 0x101 | 113 | #define IPW_PIN_SETDTR 0x101 |
114 | #define IPW_PIN_SETRTS 0x202 | 114 | #define IPW_PIN_SETRTS 0x202 |
115 | #define IPW_PIN_CLRDTR 0x100 | 115 | #define IPW_PIN_CLRDTR 0x100 |
116 | #define IPW_PIN_CLRRTS 0x200 // unconfirmed | 116 | #define IPW_PIN_CLRRTS 0x200 /* unconfirmed */ |
117 | 117 | ||
118 | /* values used for request IPW_SIO_RXCTL */ | 118 | /* values used for request IPW_SIO_RXCTL */ |
119 | #define IPW_RXBULK_ON 1 | 119 | #define IPW_RXBULK_ON 1 |
120 | #define IPW_RXBULK_OFF 0 | 120 | #define IPW_RXBULK_OFF 0 |
121 | 121 | ||
122 | /* various 16 byte hardcoded transferbuffers used by flow control */ | 122 | /* various 16 byte hardcoded transferbuffers used by flow control */ |
123 | #define IPW_BYTES_FLOWINIT { 0x01, 0, 0, 0, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } | 123 | #define IPW_BYTES_FLOWINIT { 0x01, 0, 0, 0, 0x40, 0, 0, 0, \ |
124 | 0, 0, 0, 0, 0, 0, 0, 0 } | ||
124 | 125 | ||
125 | /* Interpretation of modem status lines */ | 126 | /* Interpretation of modem status lines */ |
126 | /* These need sorting out by individually connecting pins and checking | 127 | /* These need sorting out by individually connecting pins and checking |
@@ -132,17 +133,6 @@ enum { | |||
132 | #define IPW_CTS ((1<<5) | (1<<4)) | 133 | #define IPW_CTS ((1<<5) | (1<<4)) |
133 | 134 | ||
134 | #define IPW_WANTS_TO_SEND 0x30 | 135 | #define IPW_WANTS_TO_SEND 0x30 |
135 | //#define IPW_DTR /* Data Terminal Ready */ | ||
136 | //#define IPW_CTS /* Clear To Send */ | ||
137 | //#define IPW_CD /* Carrier Detect */ | ||
138 | //#define IPW_DSR /* Data Set Ready */ | ||
139 | //#define IPW_RxD /* Receive pin */ | ||
140 | |||
141 | //#define IPW_LE | ||
142 | //#define IPW_RTS | ||
143 | //#define IPW_ST | ||
144 | //#define IPW_SR | ||
145 | //#define IPW_RI /* Ring Indicator */ | ||
146 | 136 | ||
147 | static struct usb_device_id usb_ipw_ids[] = { | 137 | static struct usb_device_id usb_ipw_ids[] = { |
148 | { USB_DEVICE(IPW_VID, IPW_PID) }, | 138 | { USB_DEVICE(IPW_VID, IPW_PID) }, |
@@ -177,7 +167,8 @@ static void ipw_read_bulk_callback(struct urb *urb) | |||
177 | return; | 167 | return; |
178 | } | 168 | } |
179 | 169 | ||
180 | usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); | 170 | usb_serial_debug_data(debug, &port->dev, __func__, |
171 | urb->actual_length, data); | ||
181 | 172 | ||
182 | tty = port->port.tty; | 173 | tty = port->port.tty; |
183 | if (tty && urb->actual_length) { | 174 | if (tty && urb->actual_length) { |
@@ -187,15 +178,17 @@ static void ipw_read_bulk_callback(struct urb *urb) | |||
187 | } | 178 | } |
188 | 179 | ||
189 | /* Continue trying to always read */ | 180 | /* Continue trying to always read */ |
190 | usb_fill_bulk_urb (port->read_urb, port->serial->dev, | 181 | usb_fill_bulk_urb(port->read_urb, port->serial->dev, |
191 | usb_rcvbulkpipe(port->serial->dev, | 182 | usb_rcvbulkpipe(port->serial->dev, |
192 | port->bulk_in_endpointAddress), | 183 | port->bulk_in_endpointAddress), |
193 | port->read_urb->transfer_buffer, | 184 | port->read_urb->transfer_buffer, |
194 | port->read_urb->transfer_buffer_length, | 185 | port->read_urb->transfer_buffer_length, |
195 | ipw_read_bulk_callback, port); | 186 | ipw_read_bulk_callback, port); |
196 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); | 187 | result = usb_submit_urb(port->read_urb, GFP_ATOMIC); |
197 | if (result) | 188 | if (result) |
198 | dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n", __func__, result); | 189 | dev_err(&port->dev, |
190 | "%s - failed resubmitting read urb, error %d\n", | ||
191 | __func__, result); | ||
199 | return; | 192 | return; |
200 | } | 193 | } |
201 | 194 | ||
@@ -216,26 +209,30 @@ static int ipw_open(struct tty_struct *tty, | |||
216 | if (tty) | 209 | if (tty) |
217 | tty->low_latency = 1; | 210 | tty->low_latency = 1; |
218 | 211 | ||
219 | /* --1: Tell the modem to initialize (we think) From sniffs this is always the | 212 | /* --1: Tell the modem to initialize (we think) From sniffs this is |
220 | * first thing that gets sent to the modem during opening of the device */ | 213 | * always the first thing that gets sent to the modem during |
221 | dbg("%s: Sending SIO_INIT (we guess)",__func__); | 214 | * opening of the device */ |
222 | result = usb_control_msg(dev, usb_sndctrlpipe(dev,0), | 215 | dbg("%s: Sending SIO_INIT (we guess)", __func__); |
223 | IPW_SIO_INIT, | 216 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
224 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 217 | IPW_SIO_INIT, |
225 | 0, | 218 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
226 | 0, /* index */ | 219 | 0, |
227 | NULL, | 220 | 0, /* index */ |
228 | 0, | 221 | NULL, |
229 | 100000); | 222 | 0, |
223 | 100000); | ||
230 | if (result < 0) | 224 | if (result < 0) |
231 | dev_err(&port->dev, "Init of modem failed (error = %d)\n", result); | 225 | dev_err(&port->dev, |
226 | "Init of modem failed (error = %d)\n", result); | ||
232 | 227 | ||
233 | /* reset the bulk pipes */ | 228 | /* reset the bulk pipes */ |
234 | usb_clear_halt(dev, usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress)); | 229 | usb_clear_halt(dev, |
235 | usb_clear_halt(dev, usb_sndbulkpipe(dev, port->bulk_out_endpointAddress)); | 230 | usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress)); |
231 | usb_clear_halt(dev, | ||
232 | usb_sndbulkpipe(dev, port->bulk_out_endpointAddress)); | ||
236 | 233 | ||
237 | /*--2: Start reading from the device */ | 234 | /*--2: Start reading from the device */ |
238 | dbg("%s: setting up bulk read callback",__func__); | 235 | dbg("%s: setting up bulk read callback", __func__); |
239 | usb_fill_bulk_urb(port->read_urb, dev, | 236 | usb_fill_bulk_urb(port->read_urb, dev, |
240 | usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress), | 237 | usb_rcvbulkpipe(dev, port->bulk_in_endpointAddress), |
241 | port->bulk_in_buffer, | 238 | port->bulk_in_buffer, |
@@ -243,67 +240,72 @@ static int ipw_open(struct tty_struct *tty, | |||
243 | ipw_read_bulk_callback, port); | 240 | ipw_read_bulk_callback, port); |
244 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); | 241 | result = usb_submit_urb(port->read_urb, GFP_KERNEL); |
245 | if (result < 0) | 242 | if (result < 0) |
246 | dbg("%s - usb_submit_urb(read bulk) failed with status %d", __func__, result); | 243 | dbg("%s - usb_submit_urb(read bulk) failed with status %d", |
244 | __func__, result); | ||
247 | 245 | ||
248 | /*--3: Tell the modem to open the floodgates on the rx bulk channel */ | 246 | /*--3: Tell the modem to open the floodgates on the rx bulk channel */ |
249 | dbg("%s:asking modem for RxRead (RXBULK_ON)",__func__); | 247 | dbg("%s:asking modem for RxRead (RXBULK_ON)", __func__); |
250 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 248 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
251 | IPW_SIO_RXCTL, | 249 | IPW_SIO_RXCTL, |
252 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 250 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
253 | IPW_RXBULK_ON, | 251 | IPW_RXBULK_ON, |
254 | 0, /* index */ | 252 | 0, /* index */ |
255 | NULL, | 253 | NULL, |
256 | 0, | 254 | 0, |
257 | 100000); | 255 | 100000); |
258 | if (result < 0) | 256 | if (result < 0) |
259 | dev_err(&port->dev, "Enabling bulk RxRead failed (error = %d)\n", result); | 257 | dev_err(&port->dev, |
258 | "Enabling bulk RxRead failed (error = %d)\n", result); | ||
260 | 259 | ||
261 | /*--4: setup the initial flowcontrol */ | 260 | /*--4: setup the initial flowcontrol */ |
262 | dbg("%s:setting init flowcontrol (%s)",__func__,buf_flow_init); | 261 | dbg("%s:setting init flowcontrol (%s)", __func__, buf_flow_init); |
263 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 262 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
264 | IPW_SIO_HANDFLOW, | 263 | IPW_SIO_HANDFLOW, |
265 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 264 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
266 | 0, | 265 | 0, |
267 | 0, | 266 | 0, |
268 | buf_flow_init, | 267 | buf_flow_init, |
269 | 0x10, | 268 | 0x10, |
270 | 200000); | 269 | 200000); |
271 | if (result < 0) | 270 | if (result < 0) |
272 | dev_err(&port->dev, "initial flowcontrol failed (error = %d)\n", result); | 271 | dev_err(&port->dev, |
272 | "initial flowcontrol failed (error = %d)\n", result); | ||
273 | 273 | ||
274 | 274 | ||
275 | /*--5: raise the dtr */ | 275 | /*--5: raise the dtr */ |
276 | dbg("%s:raising dtr",__func__); | 276 | dbg("%s:raising dtr", __func__); |
277 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 277 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
278 | IPW_SIO_SET_PIN, | 278 | IPW_SIO_SET_PIN, |
279 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 279 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
280 | IPW_PIN_SETDTR, | 280 | IPW_PIN_SETDTR, |
281 | 0, | 281 | 0, |
282 | NULL, | 282 | NULL, |
283 | 0, | 283 | 0, |
284 | 200000); | 284 | 200000); |
285 | if (result < 0) | 285 | if (result < 0) |
286 | dev_err(&port->dev, "setting dtr failed (error = %d)\n", result); | 286 | dev_err(&port->dev, |
287 | "setting dtr failed (error = %d)\n", result); | ||
287 | 288 | ||
288 | /*--6: raise the rts */ | 289 | /*--6: raise the rts */ |
289 | dbg("%s:raising rts",__func__); | 290 | dbg("%s:raising rts", __func__); |
290 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 291 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
291 | IPW_SIO_SET_PIN, | 292 | IPW_SIO_SET_PIN, |
292 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 293 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
293 | IPW_PIN_SETRTS, | 294 | IPW_PIN_SETRTS, |
294 | 0, | 295 | 0, |
295 | NULL, | 296 | NULL, |
296 | 0, | 297 | 0, |
297 | 200000); | 298 | 200000); |
298 | if (result < 0) | 299 | if (result < 0) |
299 | dev_err(&port->dev, "setting dtr failed (error = %d)\n", result); | 300 | dev_err(&port->dev, |
300 | 301 | "setting dtr failed (error = %d)\n", result); | |
302 | |||
301 | kfree(buf_flow_init); | 303 | kfree(buf_flow_init); |
302 | return 0; | 304 | return 0; |
303 | } | 305 | } |
304 | 306 | ||
305 | static void ipw_close(struct tty_struct *tty, | 307 | static void ipw_close(struct tty_struct *tty, |
306 | struct usb_serial_port *port, struct file * filp) | 308 | struct usb_serial_port *port, struct file *filp) |
307 | { | 309 | { |
308 | struct usb_device *dev = port->serial->dev; | 310 | struct usb_device *dev = port->serial->dev; |
309 | int result; | 311 | int result; |
@@ -314,56 +316,62 @@ static void ipw_close(struct tty_struct *tty, | |||
314 | } | 316 | } |
315 | 317 | ||
316 | /*--1: drop the dtr */ | 318 | /*--1: drop the dtr */ |
317 | dbg("%s:dropping dtr",__func__); | 319 | dbg("%s:dropping dtr", __func__); |
318 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 320 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
319 | IPW_SIO_SET_PIN, | 321 | IPW_SIO_SET_PIN, |
320 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 322 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
321 | IPW_PIN_CLRDTR, | 323 | IPW_PIN_CLRDTR, |
322 | 0, | 324 | 0, |
323 | NULL, | 325 | NULL, |
324 | 0, | 326 | 0, |
325 | 200000); | 327 | 200000); |
326 | if (result < 0) | 328 | if (result < 0) |
327 | dev_err(&port->dev, "dropping dtr failed (error = %d)\n", result); | 329 | dev_err(&port->dev, "dropping dtr failed (error = %d)\n", |
330 | result); | ||
328 | 331 | ||
329 | /*--2: drop the rts */ | 332 | /*--2: drop the rts */ |
330 | dbg("%s:dropping rts",__func__); | 333 | dbg("%s:dropping rts", __func__); |
331 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 334 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
332 | IPW_SIO_SET_PIN, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 335 | IPW_SIO_SET_PIN, USB_TYPE_VENDOR | |
333 | IPW_PIN_CLRRTS, | 336 | USB_RECIP_INTERFACE | USB_DIR_OUT, |
334 | 0, | 337 | IPW_PIN_CLRRTS, |
335 | NULL, | 338 | 0, |
336 | 0, | 339 | NULL, |
337 | 200000); | 340 | 0, |
341 | 200000); | ||
338 | if (result < 0) | 342 | if (result < 0) |
339 | dev_err(&port->dev, "dropping rts failed (error = %d)\n", result); | 343 | dev_err(&port->dev, |
344 | "dropping rts failed (error = %d)\n", result); | ||
340 | 345 | ||
341 | 346 | ||
342 | /*--3: purge */ | 347 | /*--3: purge */ |
343 | dbg("%s:sending purge",__func__); | 348 | dbg("%s:sending purge", __func__); |
344 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 349 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
345 | IPW_SIO_PURGE, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 350 | IPW_SIO_PURGE, USB_TYPE_VENDOR | |
346 | 0x03, | 351 | USB_RECIP_INTERFACE | USB_DIR_OUT, |
347 | 0, | 352 | 0x03, |
348 | NULL, | 353 | 0, |
349 | 0, | 354 | NULL, |
350 | 200000); | 355 | 0, |
356 | 200000); | ||
351 | if (result < 0) | 357 | if (result < 0) |
352 | dev_err(&port->dev, "purge failed (error = %d)\n", result); | 358 | dev_err(&port->dev, "purge failed (error = %d)\n", result); |
353 | 359 | ||
354 | 360 | ||
355 | /* send RXBULK_off (tell modem to stop transmitting bulk data on rx chan) */ | 361 | /* send RXBULK_off (tell modem to stop transmitting bulk data on |
362 | rx chan) */ | ||
356 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 363 | result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
357 | IPW_SIO_RXCTL, | 364 | IPW_SIO_RXCTL, |
358 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, | 365 | USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, |
359 | IPW_RXBULK_OFF, | 366 | IPW_RXBULK_OFF, |
360 | 0, /* index */ | 367 | 0, /* index */ |
361 | NULL, | 368 | NULL, |
362 | 0, | 369 | 0, |
363 | 100000); | 370 | 100000); |
364 | 371 | ||
365 | if (result < 0) | 372 | if (result < 0) |
366 | dev_err(&port->dev, "Disabling bulk RxRead failed (error = %d)\n", result); | 373 | dev_err(&port->dev, |
374 | "Disabling bulk RxRead failed (error = %d)\n", result); | ||
367 | 375 | ||
368 | /* shutdown any in-flight urbs that we know about */ | 376 | /* shutdown any in-flight urbs that we know about */ |
369 | usb_kill_urb(port->read_urb); | 377 | usb_kill_urb(port->read_urb); |
@@ -393,7 +401,7 @@ static int ipw_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
393 | int ret; | 401 | int ret; |
394 | 402 | ||
395 | dbg("%s: TOP: count=%d, in_interrupt=%ld", __func__, | 403 | dbg("%s: TOP: count=%d, in_interrupt=%ld", __func__, |
396 | count, in_interrupt() ); | 404 | count, in_interrupt()); |
397 | 405 | ||
398 | if (count == 0) { | 406 | if (count == 0) { |
399 | dbg("%s - write request of 0 bytes", __func__); | 407 | dbg("%s - write request of 0 bytes", __func__); |
@@ -424,13 +432,14 @@ static int ipw_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
424 | ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); | 432 | ret = usb_submit_urb(port->write_urb, GFP_ATOMIC); |
425 | if (ret != 0) { | 433 | if (ret != 0) { |
426 | port->write_urb_busy = 0; | 434 | port->write_urb_busy = 0; |
427 | dbg("%s - usb_submit_urb(write bulk) failed with error = %d", __func__, ret); | 435 | dbg("%s - usb_submit_urb(write bulk) failed with error = %d", |
436 | __func__, ret); | ||
428 | return ret; | 437 | return ret; |
429 | } | 438 | } |
430 | 439 | ||
431 | dbg("%s returning %d", __func__, count); | 440 | dbg("%s returning %d", __func__, count); |
432 | return count; | 441 | return count; |
433 | } | 442 | } |
434 | 443 | ||
435 | static int ipw_probe(struct usb_serial_port *port) | 444 | static int ipw_probe(struct usb_serial_port *port) |
436 | { | 445 | { |
@@ -489,8 +498,8 @@ module_init(usb_ipw_init); | |||
489 | module_exit(usb_ipw_exit); | 498 | module_exit(usb_ipw_exit); |
490 | 499 | ||
491 | /* Module information */ | 500 | /* Module information */ |
492 | MODULE_AUTHOR( DRIVER_AUTHOR ); | 501 | MODULE_AUTHOR(DRIVER_AUTHOR); |
493 | MODULE_DESCRIPTION( DRIVER_DESC ); | 502 | MODULE_DESCRIPTION(DRIVER_DESC); |
494 | MODULE_LICENSE("GPL"); | 503 | MODULE_LICENSE("GPL"); |
495 | 504 | ||
496 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 505 | module_param(debug, bool, S_IRUGO | S_IWUSR); |