diff options
author | Alan Cox <alan@redhat.com> | 2008-07-22 06:09:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-22 16:03:22 -0400 |
commit | b69c14992ecbff99d1b2b66d8ccbcffe131c6e38 (patch) | |
tree | 9634bd935ca10f21751bdd4879b8823e17d8fc69 /drivers | |
parent | 72e2741256e65f2adcc03754523d6a2fdb260e4a (diff) |
belkin_sa: clean up code
Coding style tidy up for belkin_sa
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')
-rw-r--r-- | drivers/usb/serial/belkin_sa.c | 148 | ||||
-rw-r--r-- | drivers/usb/serial/belkin_sa.h | 15 |
2 files changed, 94 insertions, 69 deletions
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 1a762692c739..2ebe06c3405a 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c | |||
@@ -7,13 +7,14 @@ | |||
7 | * This program is largely derived from work by the linux-usb group | 7 | * This program is largely derived from work by the linux-usb group |
8 | * and associated source files. Please see the usb/serial files for | 8 | * and associated source files. Please see the usb/serial files for |
9 | * individual credits and copyrights. | 9 | * individual credits and copyrights. |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License as published by |
13 | * the Free Software Foundation; either version 2 of the License, or | 13 | * the Free Software Foundation; either version 2 of the License, or |
14 | * (at your option) any later version. | 14 | * (at your option) any later version. |
15 | * | 15 | * |
16 | * See Documentation/usb/usb-serial.txt for more information on using this driver | 16 | * See Documentation/usb/usb-serial.txt for more information on using this |
17 | * driver | ||
17 | * | 18 | * |
18 | * TODO: | 19 | * TODO: |
19 | * -- Add true modem contol line query capability. Currently we track the | 20 | * -- Add true modem contol line query capability. Currently we track the |
@@ -28,7 +29,8 @@ | |||
28 | * compressed all the differnent device entries into 1. | 29 | * compressed all the differnent device entries into 1. |
29 | * | 30 | * |
30 | * 30-May-2001 gkh | 31 | * 30-May-2001 gkh |
31 | * switched from using spinlock to a semaphore, which fixes lots of problems. | 32 | * switched from using spinlock to a semaphore, which fixes lots of |
33 | * problems. | ||
32 | * | 34 | * |
33 | * 08-Apr-2001 gb | 35 | * 08-Apr-2001 gb |
34 | * - Identify version on module load. | 36 | * - Identify version on module load. |
@@ -41,7 +43,7 @@ | |||
41 | * - Added support for the old Belkin and Peracom devices. | 43 | * - Added support for the old Belkin and Peracom devices. |
42 | * - Made the port able to be opened multiple times. | 44 | * - Made the port able to be opened multiple times. |
43 | * - Added some defaults incase the line settings are things these devices | 45 | * - Added some defaults incase the line settings are things these devices |
44 | * can't support. | 46 | * can't support. |
45 | * | 47 | * |
46 | * 18-Oct-2000 William Greathouse | 48 | * 18-Oct-2000 William Greathouse |
47 | * Released into the wild (linux-usb-devel) | 49 | * Released into the wild (linux-usb-devel) |
@@ -72,7 +74,7 @@ | |||
72 | #include <linux/tty_flip.h> | 74 | #include <linux/tty_flip.h> |
73 | #include <linux/module.h> | 75 | #include <linux/module.h> |
74 | #include <linux/spinlock.h> | 76 | #include <linux/spinlock.h> |
75 | #include <asm/uaccess.h> | 77 | #include <linux/uaccess.h> |
76 | #include <linux/usb.h> | 78 | #include <linux/usb.h> |
77 | #include <linux/usb/serial.h> | 79 | #include <linux/usb/serial.h> |
78 | #include "belkin_sa.h" | 80 | #include "belkin_sa.h" |
@@ -87,15 +89,19 @@ static int debug; | |||
87 | #define DRIVER_DESC "USB Belkin Serial converter driver" | 89 | #define DRIVER_DESC "USB Belkin Serial converter driver" |
88 | 90 | ||
89 | /* function prototypes for a Belkin USB Serial Adapter F5U103 */ | 91 | /* function prototypes for a Belkin USB Serial Adapter F5U103 */ |
90 | static int belkin_sa_startup (struct usb_serial *serial); | 92 | static int belkin_sa_startup(struct usb_serial *serial); |
91 | static void belkin_sa_shutdown (struct usb_serial *serial); | 93 | static void belkin_sa_shutdown(struct usb_serial *serial); |
92 | static int belkin_sa_open (struct tty_struct *tty, struct usb_serial_port *port, struct file *filp); | 94 | static int belkin_sa_open(struct tty_struct *tty, |
93 | static void belkin_sa_close (struct tty_struct *tty, struct usb_serial_port *port, struct file *filp); | 95 | struct usb_serial_port *port, struct file *filp); |
94 | static void belkin_sa_read_int_callback (struct urb *urb); | 96 | static void belkin_sa_close(struct tty_struct *tty, |
95 | static void belkin_sa_set_termios (struct tty_struct *tty, struct usb_serial_port *port, struct ktermios * old); | 97 | struct usb_serial_port *port, struct file *filp); |
96 | static void belkin_sa_break_ctl (struct tty_struct *tty, int break_state ); | 98 | static void belkin_sa_read_int_callback(struct urb *urb); |
97 | static int belkin_sa_tiocmget (struct tty_struct *tty, struct file *file); | 99 | static void belkin_sa_set_termios(struct tty_struct *tty, |
98 | static int belkin_sa_tiocmset (struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear); | 100 | struct usb_serial_port *port, struct ktermios * old); |
101 | static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state); | ||
102 | static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file); | ||
103 | static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, | ||
104 | unsigned int set, unsigned int clear); | ||
99 | 105 | ||
100 | 106 | ||
101 | static struct usb_device_id id_table_combined [] = { | 107 | static struct usb_device_id id_table_combined [] = { |
@@ -105,10 +111,10 @@ static struct usb_device_id id_table_combined [] = { | |||
105 | { USB_DEVICE(GOHUBS_VID, GOHUBS_PID) }, | 111 | { USB_DEVICE(GOHUBS_VID, GOHUBS_PID) }, |
106 | { USB_DEVICE(GOHUBS_VID, HANDYLINK_PID) }, | 112 | { USB_DEVICE(GOHUBS_VID, HANDYLINK_PID) }, |
107 | { USB_DEVICE(BELKIN_DOCKSTATION_VID, BELKIN_DOCKSTATION_PID) }, | 113 | { USB_DEVICE(BELKIN_DOCKSTATION_VID, BELKIN_DOCKSTATION_PID) }, |
108 | { } /* Terminating entry */ | 114 | { } /* Terminating entry */ |
109 | }; | 115 | }; |
110 | 116 | ||
111 | MODULE_DEVICE_TABLE (usb, id_table_combined); | 117 | MODULE_DEVICE_TABLE(usb, id_table_combined); |
112 | 118 | ||
113 | static struct usb_driver belkin_driver = { | 119 | static struct usb_driver belkin_driver = { |
114 | .name = "belkin", | 120 | .name = "belkin", |
@@ -130,7 +136,8 @@ static struct usb_serial_driver belkin_device = { | |||
130 | .num_ports = 1, | 136 | .num_ports = 1, |
131 | .open = belkin_sa_open, | 137 | .open = belkin_sa_open, |
132 | .close = belkin_sa_close, | 138 | .close = belkin_sa_close, |
133 | .read_int_callback = belkin_sa_read_int_callback, /* How we get the status info */ | 139 | .read_int_callback = belkin_sa_read_int_callback, |
140 | /* How we get the status info */ | ||
134 | .set_termios = belkin_sa_set_termios, | 141 | .set_termios = belkin_sa_set_termios, |
135 | .break_ctl = belkin_sa_break_ctl, | 142 | .break_ctl = belkin_sa_break_ctl, |
136 | .tiocmget = belkin_sa_tiocmget, | 143 | .tiocmget = belkin_sa_tiocmget, |
@@ -158,12 +165,12 @@ struct belkin_sa_private { | |||
158 | #define WDR_TIMEOUT 5000 /* default urb timeout */ | 165 | #define WDR_TIMEOUT 5000 /* default urb timeout */ |
159 | 166 | ||
160 | /* assumes that struct usb_serial *serial is available */ | 167 | /* assumes that struct usb_serial *serial is available */ |
161 | #define BSA_USB_CMD(c,v) usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), \ | 168 | #define BSA_USB_CMD(c, v) usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), \ |
162 | (c), BELKIN_SA_SET_REQUEST_TYPE, \ | 169 | (c), BELKIN_SA_SET_REQUEST_TYPE, \ |
163 | (v), 0, NULL, 0, WDR_TIMEOUT) | 170 | (v), 0, NULL, 0, WDR_TIMEOUT) |
164 | 171 | ||
165 | /* do some startup allocations not currently performed by usb_serial_probe() */ | 172 | /* do some startup allocations not currently performed by usb_serial_probe() */ |
166 | static int belkin_sa_startup (struct usb_serial *serial) | 173 | static int belkin_sa_startup(struct usb_serial *serial) |
167 | { | 174 | { |
168 | struct usb_device *dev = serial->dev; | 175 | struct usb_device *dev = serial->dev; |
169 | struct belkin_sa_private *priv; | 176 | struct belkin_sa_private *priv; |
@@ -171,20 +178,23 @@ static int belkin_sa_startup (struct usb_serial *serial) | |||
171 | /* allocate the private data structure */ | 178 | /* allocate the private data structure */ |
172 | priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL); | 179 | priv = kmalloc(sizeof(struct belkin_sa_private), GFP_KERNEL); |
173 | if (!priv) | 180 | if (!priv) |
174 | return (-1); /* error */ | 181 | return -1; /* error */ |
175 | /* set initial values for control structures */ | 182 | /* set initial values for control structures */ |
176 | spin_lock_init(&priv->lock); | 183 | spin_lock_init(&priv->lock); |
177 | priv->control_state = 0; | 184 | priv->control_state = 0; |
178 | priv->last_lsr = 0; | 185 | priv->last_lsr = 0; |
179 | priv->last_msr = 0; | 186 | priv->last_msr = 0; |
180 | /* see comments at top of file */ | 187 | /* see comments at top of file */ |
181 | priv->bad_flow_control = (le16_to_cpu(dev->descriptor.bcdDevice) <= 0x0206) ? 1 : 0; | 188 | priv->bad_flow_control = |
182 | info("bcdDevice: %04x, bfc: %d", le16_to_cpu(dev->descriptor.bcdDevice), priv->bad_flow_control); | 189 | (le16_to_cpu(dev->descriptor.bcdDevice) <= 0x0206) ? 1 : 0; |
190 | info("bcdDevice: %04x, bfc: %d", | ||
191 | le16_to_cpu(dev->descriptor.bcdDevice), | ||
192 | priv->bad_flow_control); | ||
183 | 193 | ||
184 | init_waitqueue_head(&serial->port[0]->write_wait); | 194 | init_waitqueue_head(&serial->port[0]->write_wait); |
185 | usb_set_serial_port_data(serial->port[0], priv); | 195 | usb_set_serial_port_data(serial->port[0], priv); |
186 | 196 | ||
187 | return (0); | 197 | return 0; |
188 | } | 198 | } |
189 | 199 | ||
190 | 200 | ||
@@ -192,11 +202,11 @@ static void belkin_sa_shutdown(struct usb_serial *serial) | |||
192 | { | 202 | { |
193 | struct belkin_sa_private *priv; | 203 | struct belkin_sa_private *priv; |
194 | int i; | 204 | int i; |
195 | 205 | ||
196 | dbg ("%s", __func__); | 206 | dbg("%s", __func__); |
197 | 207 | ||
198 | /* stop reads and writes on all ports */ | 208 | /* stop reads and writes on all ports */ |
199 | for (i=0; i < serial->num_ports; ++i) { | 209 | for (i = 0; i < serial->num_ports; ++i) { |
200 | /* My special items, the standard routines free my urbs */ | 210 | /* My special items, the standard routines free my urbs */ |
201 | priv = usb_get_serial_port_data(serial->port[i]); | 211 | priv = usb_get_serial_port_data(serial->port[i]); |
202 | kfree(priv); | 212 | kfree(priv); |
@@ -204,7 +214,8 @@ static void belkin_sa_shutdown(struct usb_serial *serial) | |||
204 | } | 214 | } |
205 | 215 | ||
206 | 216 | ||
207 | static int belkin_sa_open(struct tty_struct *tty, struct usb_serial_port *port, struct file *filp) | 217 | static int belkin_sa_open(struct tty_struct *tty, |
218 | struct usb_serial_port *port, struct file *filp) | ||
208 | { | 219 | { |
209 | int retval = 0; | 220 | int retval = 0; |
210 | 221 | ||
@@ -233,7 +244,7 @@ exit: | |||
233 | } /* belkin_sa_open */ | 244 | } /* belkin_sa_open */ |
234 | 245 | ||
235 | 246 | ||
236 | static void belkin_sa_close (struct tty_struct *tty, | 247 | static void belkin_sa_close(struct tty_struct *tty, |
237 | struct usb_serial_port *port, struct file *filp) | 248 | struct usb_serial_port *port, struct file *filp) |
238 | { | 249 | { |
239 | dbg("%s port %d", __func__, port->number); | 250 | dbg("%s port %d", __func__, port->number); |
@@ -271,7 +282,8 @@ static void belkin_sa_read_int_callback(struct urb *urb) | |||
271 | goto exit; | 282 | goto exit; |
272 | } | 283 | } |
273 | 284 | ||
274 | usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data); | 285 | usb_serial_debug_data(debug, &port->dev, __func__, |
286 | urb->actual_length, data); | ||
275 | 287 | ||
276 | /* Handle known interrupt data */ | 288 | /* Handle known interrupt data */ |
277 | /* ignore data[0] and data[1] */ | 289 | /* ignore data[0] and data[1] */ |
@@ -279,7 +291,7 @@ static void belkin_sa_read_int_callback(struct urb *urb) | |||
279 | priv = usb_get_serial_port_data(port); | 291 | priv = usb_get_serial_port_data(port); |
280 | spin_lock_irqsave(&priv->lock, flags); | 292 | spin_lock_irqsave(&priv->lock, flags); |
281 | priv->last_msr = data[BELKIN_SA_MSR_INDEX]; | 293 | priv->last_msr = data[BELKIN_SA_MSR_INDEX]; |
282 | 294 | ||
283 | /* Record Control Line states */ | 295 | /* Record Control Line states */ |
284 | if (priv->last_msr & BELKIN_SA_MSR_DSR) | 296 | if (priv->last_msr & BELKIN_SA_MSR_DSR) |
285 | priv->control_state |= TIOCM_DSR; | 297 | priv->control_state |= TIOCM_DSR; |
@@ -327,9 +339,9 @@ static void belkin_sa_read_int_callback(struct urb *urb) | |||
327 | #endif | 339 | #endif |
328 | spin_unlock_irqrestore(&priv->lock, flags); | 340 | spin_unlock_irqrestore(&priv->lock, flags); |
329 | exit: | 341 | exit: |
330 | retval = usb_submit_urb (urb, GFP_ATOMIC); | 342 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
331 | if (retval) | 343 | if (retval) |
332 | err ("%s - usb_submit_urb failed with result %d", | 344 | err("%s - usb_submit_urb failed with result %d", |
333 | __func__, retval); | 345 | __func__, retval); |
334 | } | 346 | } |
335 | 347 | ||
@@ -348,7 +360,7 @@ static void belkin_sa_set_termios(struct tty_struct *tty, | |||
348 | int bad_flow_control; | 360 | int bad_flow_control; |
349 | speed_t baud; | 361 | speed_t baud; |
350 | struct ktermios *termios = tty->termios; | 362 | struct ktermios *termios = tty->termios; |
351 | 363 | ||
352 | iflag = termios->c_iflag; | 364 | iflag = termios->c_iflag; |
353 | cflag = termios->c_cflag; | 365 | cflag = termios->c_cflag; |
354 | 366 | ||
@@ -359,20 +371,21 @@ static void belkin_sa_set_termios(struct tty_struct *tty, | |||
359 | control_state = priv->control_state; | 371 | control_state = priv->control_state; |
360 | bad_flow_control = priv->bad_flow_control; | 372 | bad_flow_control = priv->bad_flow_control; |
361 | spin_unlock_irqrestore(&priv->lock, flags); | 373 | spin_unlock_irqrestore(&priv->lock, flags); |
362 | 374 | ||
363 | old_iflag = old_termios->c_iflag; | 375 | old_iflag = old_termios->c_iflag; |
364 | old_cflag = old_termios->c_cflag; | 376 | old_cflag = old_termios->c_cflag; |
365 | 377 | ||
366 | /* Set the baud rate */ | 378 | /* Set the baud rate */ |
367 | if ((cflag & CBAUD) != (old_cflag & CBAUD)) { | 379 | if ((cflag & CBAUD) != (old_cflag & CBAUD)) { |
368 | /* reassert DTR and (maybe) RTS on transition from B0 */ | 380 | /* reassert DTR and (maybe) RTS on transition from B0 */ |
369 | if( (old_cflag&CBAUD) == B0 ) { | 381 | if ((old_cflag & CBAUD) == B0) { |
370 | control_state |= (TIOCM_DTR|TIOCM_RTS); | 382 | control_state |= (TIOCM_DTR|TIOCM_RTS); |
371 | if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 1) < 0) | 383 | if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 1) < 0) |
372 | err("Set DTR error"); | 384 | err("Set DTR error"); |
373 | /* don't set RTS if using hardware flow control */ | 385 | /* don't set RTS if using hardware flow control */ |
374 | if (!(old_cflag & CRTSCTS)) | 386 | if (!(old_cflag & CRTSCTS)) |
375 | if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, 1) < 0) | 387 | if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST |
388 | , 1) < 0) | ||
376 | err("Set RTS error"); | 389 | err("Set RTS error"); |
377 | } | 390 | } |
378 | } | 391 | } |
@@ -392,7 +405,8 @@ static void belkin_sa_set_termios(struct tty_struct *tty, | |||
392 | err("Set baudrate error"); | 405 | err("Set baudrate error"); |
393 | } else { | 406 | } else { |
394 | /* Disable flow control */ | 407 | /* Disable flow control */ |
395 | if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST, BELKIN_SA_FLOW_NONE) < 0) | 408 | if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST, |
409 | BELKIN_SA_FLOW_NONE) < 0) | ||
396 | err("Disable flowcontrol error"); | 410 | err("Disable flowcontrol error"); |
397 | /* Drop RTS and DTR */ | 411 | /* Drop RTS and DTR */ |
398 | control_state &= ~(TIOCM_DTR | TIOCM_RTS); | 412 | control_state &= ~(TIOCM_DTR | TIOCM_RTS); |
@@ -403,9 +417,10 @@ static void belkin_sa_set_termios(struct tty_struct *tty, | |||
403 | } | 417 | } |
404 | 418 | ||
405 | /* set the parity */ | 419 | /* set the parity */ |
406 | if( (cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD)) ) { | 420 | if ((cflag ^ old_cflag) & (PARENB | PARODD)) { |
407 | if (cflag & PARENB) | 421 | if (cflag & PARENB) |
408 | urb_value = (cflag & PARODD) ? BELKIN_SA_PARITY_ODD : BELKIN_SA_PARITY_EVEN; | 422 | urb_value = (cflag & PARODD) ? BELKIN_SA_PARITY_ODD |
423 | : BELKIN_SA_PARITY_EVEN; | ||
409 | else | 424 | else |
410 | urb_value = BELKIN_SA_PARITY_NONE; | 425 | urb_value = BELKIN_SA_PARITY_NONE; |
411 | if (BSA_USB_CMD(BELKIN_SA_SET_PARITY_REQUEST, urb_value) < 0) | 426 | if (BSA_USB_CMD(BELKIN_SA_SET_PARITY_REQUEST, urb_value) < 0) |
@@ -413,31 +428,40 @@ static void belkin_sa_set_termios(struct tty_struct *tty, | |||
413 | } | 428 | } |
414 | 429 | ||
415 | /* set the number of data bits */ | 430 | /* set the number of data bits */ |
416 | if( (cflag&CSIZE) != (old_cflag&CSIZE) ) { | 431 | if ((cflag & CSIZE) != (old_cflag & CSIZE)) { |
417 | switch (cflag & CSIZE) { | 432 | switch (cflag & CSIZE) { |
418 | case CS5: urb_value = BELKIN_SA_DATA_BITS(5); break; | 433 | case CS5: |
419 | case CS6: urb_value = BELKIN_SA_DATA_BITS(6); break; | 434 | urb_value = BELKIN_SA_DATA_BITS(5); |
420 | case CS7: urb_value = BELKIN_SA_DATA_BITS(7); break; | 435 | break; |
421 | case CS8: urb_value = BELKIN_SA_DATA_BITS(8); break; | 436 | case CS6: |
422 | default: dbg("CSIZE was not CS5-CS8, using default of 8"); | 437 | urb_value = BELKIN_SA_DATA_BITS(6); |
423 | urb_value = BELKIN_SA_DATA_BITS(8); | 438 | break; |
424 | break; | 439 | case CS7: |
440 | urb_value = BELKIN_SA_DATA_BITS(7); | ||
441 | break; | ||
442 | case CS8: | ||
443 | urb_value = BELKIN_SA_DATA_BITS(8); | ||
444 | break; | ||
445 | default: dbg("CSIZE was not CS5-CS8, using default of 8"); | ||
446 | urb_value = BELKIN_SA_DATA_BITS(8); | ||
447 | break; | ||
425 | } | 448 | } |
426 | if (BSA_USB_CMD(BELKIN_SA_SET_DATA_BITS_REQUEST, urb_value) < 0) | 449 | if (BSA_USB_CMD(BELKIN_SA_SET_DATA_BITS_REQUEST, urb_value) < 0) |
427 | err("Set data bits error"); | 450 | err("Set data bits error"); |
428 | } | 451 | } |
429 | 452 | ||
430 | /* set the number of stop bits */ | 453 | /* set the number of stop bits */ |
431 | if( (cflag&CSTOPB) != (old_cflag&CSTOPB) ) { | 454 | if ((cflag & CSTOPB) != (old_cflag & CSTOPB)) { |
432 | urb_value = (cflag & CSTOPB) ? BELKIN_SA_STOP_BITS(2) : BELKIN_SA_STOP_BITS(1); | 455 | urb_value = (cflag & CSTOPB) ? BELKIN_SA_STOP_BITS(2) |
433 | if (BSA_USB_CMD(BELKIN_SA_SET_STOP_BITS_REQUEST, urb_value) < 0) | 456 | : BELKIN_SA_STOP_BITS(1); |
457 | if (BSA_USB_CMD(BELKIN_SA_SET_STOP_BITS_REQUEST, | ||
458 | urb_value) < 0) | ||
434 | err("Set stop bits error"); | 459 | err("Set stop bits error"); |
435 | } | 460 | } |
436 | 461 | ||
437 | /* Set flow control */ | 462 | /* Set flow control */ |
438 | if( (iflag&IXOFF) != (old_iflag&IXOFF) | 463 | if (((iflag ^ old_iflag) & (IXOFF | IXON)) || |
439 | || (iflag&IXON) != (old_iflag&IXON) | 464 | ((cflag ^ old_cflag) & CRTSCTS)) { |
440 | || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) { | ||
441 | urb_value = 0; | 465 | urb_value = 0; |
442 | if ((iflag & IXOFF) || (iflag & IXON)) | 466 | if ((iflag & IXOFF) || (iflag & IXON)) |
443 | urb_value |= (BELKIN_SA_FLOW_OXON | BELKIN_SA_FLOW_IXON); | 467 | urb_value |= (BELKIN_SA_FLOW_OXON | BELKIN_SA_FLOW_IXON); |
@@ -479,7 +503,7 @@ static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file) | |||
479 | struct belkin_sa_private *priv = usb_get_serial_port_data(port); | 503 | struct belkin_sa_private *priv = usb_get_serial_port_data(port); |
480 | unsigned long control_state; | 504 | unsigned long control_state; |
481 | unsigned long flags; | 505 | unsigned long flags; |
482 | 506 | ||
483 | dbg("%s", __func__); | 507 | dbg("%s", __func__); |
484 | 508 | ||
485 | spin_lock_irqsave(&priv->lock, flags); | 509 | spin_lock_irqsave(&priv->lock, flags); |
@@ -501,7 +525,7 @@ static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file, | |||
501 | int retval; | 525 | int retval; |
502 | int rts = 0; | 526 | int rts = 0; |
503 | int dtr = 0; | 527 | int dtr = 0; |
504 | 528 | ||
505 | dbg("%s", __func__); | 529 | dbg("%s", __func__); |
506 | 530 | ||
507 | spin_lock_irqsave(&priv->lock, flags); | 531 | spin_lock_irqsave(&priv->lock, flags); |
@@ -563,17 +587,17 @@ failed_usb_serial_register: | |||
563 | 587 | ||
564 | static void __exit belkin_sa_exit (void) | 588 | static void __exit belkin_sa_exit (void) |
565 | { | 589 | { |
566 | usb_deregister (&belkin_driver); | 590 | usb_deregister(&belkin_driver); |
567 | usb_serial_deregister(&belkin_device); | 591 | usb_serial_deregister(&belkin_device); |
568 | } | 592 | } |
569 | 593 | ||
570 | 594 | ||
571 | module_init (belkin_sa_init); | 595 | module_init(belkin_sa_init); |
572 | module_exit (belkin_sa_exit); | 596 | module_exit(belkin_sa_exit); |
573 | 597 | ||
574 | MODULE_AUTHOR( DRIVER_AUTHOR ); | 598 | MODULE_AUTHOR(DRIVER_AUTHOR); |
575 | MODULE_DESCRIPTION( DRIVER_DESC ); | 599 | MODULE_DESCRIPTION(DRIVER_DESC); |
576 | MODULE_VERSION( DRIVER_VERSION ); | 600 | MODULE_VERSION(DRIVER_VERSION); |
577 | MODULE_LICENSE("GPL"); | 601 | MODULE_LICENSE("GPL"); |
578 | 602 | ||
579 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 603 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
diff --git a/drivers/usb/serial/belkin_sa.h b/drivers/usb/serial/belkin_sa.h index 9116b92f4622..c66a6730d38c 100644 --- a/drivers/usb/serial/belkin_sa.h +++ b/drivers/usb/serial/belkin_sa.h | |||
@@ -7,13 +7,14 @@ | |||
7 | * This program is largely derived from work by the linux-usb group | 7 | * This program is largely derived from work by the linux-usb group |
8 | * and associated source files. Please see the usb/serial files for | 8 | * and associated source files. Please see the usb/serial files for |
9 | * individual credits and copyrights. | 9 | * individual credits and copyrights. |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License as published by |
13 | * the Free Software Foundation; either version 2 of the License, or | 13 | * the Free Software Foundation; either version 2 of the License, or |
14 | * (at your option) any later version. | 14 | * (at your option) any later version. |
15 | * | 15 | * |
16 | * See Documentation/usb/usb-serial.txt for more information on using this driver | 16 | * See Documentation/usb/usb-serial.txt for more information on using this |
17 | * driver | ||
17 | * | 18 | * |
18 | * 12-Mar-2001 gkh | 19 | * 12-Mar-2001 gkh |
19 | * Added GoHubs GO-COM232 device id. | 20 | * Added GoHubs GO-COM232 device id. |
@@ -27,7 +28,7 @@ | |||
27 | * adapter, so pardon any stupid mistakes. All of the information | 28 | * adapter, so pardon any stupid mistakes. All of the information |
28 | * I am using to write this driver was acquired by using a modified | 29 | * I am using to write this driver was acquired by using a modified |
29 | * UsbSnoop on Windows2000. | 30 | * UsbSnoop on Windows2000. |
30 | * | 31 | * |
31 | */ | 32 | */ |
32 | 33 | ||
33 | #ifndef __LINUX_USB_SERIAL_BSA_H | 34 | #ifndef __LINUX_USB_SERIAL_BSA_H |
@@ -96,20 +97,20 @@ | |||
96 | 97 | ||
97 | /* | 98 | /* |
98 | * It seems that the interrupt pipe is closely modelled after the | 99 | * It seems that the interrupt pipe is closely modelled after the |
99 | * 16550 register layout. This is probably because the adapter can | 100 | * 16550 register layout. This is probably because the adapter can |
100 | * be used in a "DOS" environment to simulate a standard hardware port. | 101 | * be used in a "DOS" environment to simulate a standard hardware port. |
101 | */ | 102 | */ |
102 | #define BELKIN_SA_LSR_INDEX 2 /* Line Status Register */ | 103 | #define BELKIN_SA_LSR_INDEX 2 /* Line Status Register */ |
103 | #define BELKIN_SA_LSR_RDR 0x01 /* receive data ready */ | 104 | #define BELKIN_SA_LSR_RDR 0x01 /* receive data ready */ |
104 | #define BELKIN_SA_LSR_OE 0x02 /* overrun error */ | 105 | #define BELKIN_SA_LSR_OE 0x02 /* overrun error */ |
105 | #define BELKIN_SA_LSR_PE 0x04 /* parity error */ | 106 | #define BELKIN_SA_LSR_PE 0x04 /* parity error */ |
106 | #define BELKIN_SA_LSR_FE 0x08 /* framing error */ | 107 | #define BELKIN_SA_LSR_FE 0x08 /* framing error */ |
107 | #define BELKIN_SA_LSR_BI 0x10 /* break indicator */ | 108 | #define BELKIN_SA_LSR_BI 0x10 /* break indicator */ |
108 | #define BELKIN_SA_LSR_THE 0x20 /* transmit holding register empty */ | 109 | #define BELKIN_SA_LSR_THE 0x20 /* tx holding register empty */ |
109 | #define BELKIN_SA_LSR_TE 0x40 /* transmit register empty */ | 110 | #define BELKIN_SA_LSR_TE 0x40 /* transmit register empty */ |
110 | #define BELKIN_SA_LSR_ERR 0x80 /* OE | PE | FE | BI */ | 111 | #define BELKIN_SA_LSR_ERR 0x80 /* OE | PE | FE | BI */ |
111 | 112 | ||
112 | #define BELKIN_SA_MSR_INDEX 3 /* Modem Status Register */ | 113 | #define BELKIN_SA_MSR_INDEX 3 /* Modem Status Register */ |
113 | #define BELKIN_SA_MSR_DCTS 0x01 /* Delta CTS */ | 114 | #define BELKIN_SA_MSR_DCTS 0x01 /* Delta CTS */ |
114 | #define BELKIN_SA_MSR_DDSR 0x02 /* Delta DSR */ | 115 | #define BELKIN_SA_MSR_DDSR 0x02 /* Delta DSR */ |
115 | #define BELKIN_SA_MSR_DRI 0x04 /* Delta RI */ | 116 | #define BELKIN_SA_MSR_DRI 0x04 /* Delta RI */ |