diff options
Diffstat (limited to 'drivers/usb/serial/cp210x.c')
| -rw-r--r-- | drivers/usb/serial/cp210x.c | 37 | 
1 files changed, 15 insertions, 22 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index eb033fc92a1..f14736f647f 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -24,10 +24,6 @@  #include <linux/uaccess.h>  #include <linux/usb/serial.h> -/* - * Version Information - */ -#define DRIVER_VERSION "v0.09"  #define DRIVER_DESC "Silicon Labs CP210x RS232 serial adaptor driver"  /* @@ -35,8 +31,7 @@   */  static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *);  static void cp210x_close(struct usb_serial_port *); -static void cp210x_get_termios(struct tty_struct *, -	struct usb_serial_port *port); +static void cp210x_get_termios(struct tty_struct *, struct usb_serial_port *);  static void cp210x_get_termios_port(struct usb_serial_port *port,  	unsigned int *cflagp, unsigned int *baudp);  static void cp210x_change_speed(struct tty_struct *, struct usb_serial_port *, @@ -118,6 +113,7 @@ static const struct usb_device_id id_table[] = {  	{ USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */  	{ USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */  	{ USB_DEVICE(0x10C4, 0x85EB) }, /* AC-Services CIS-IBUS */ +	{ USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */  	{ USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */  	{ USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */  	{ USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ @@ -169,7 +165,7 @@ struct cp210x_serial_private {  static struct usb_serial_driver cp210x_device = {  	.driver = {  		.owner =	THIS_MODULE, -		.name = 	"cp210x", +		.name =		"cp210x",  	},  	.id_table		= id_table,  	.num_ports		= 1, @@ -179,7 +175,7 @@ static struct usb_serial_driver cp210x_device = {  	.close			= cp210x_close,  	.break_ctl		= cp210x_break_ctl,  	.set_termios		= cp210x_set_termios, -	.tiocmget 		= cp210x_tiocmget, +	.tiocmget		= cp210x_tiocmget,  	.tiocmset		= cp210x_tiocmset,  	.attach			= cp210x_startup,  	.release		= cp210x_release, @@ -281,7 +277,7 @@ static int cp210x_get_config(struct usb_serial_port *port, u8 request,  	int result, i, length;  	/* Number of integers required to contain the array */ -	length = (((size - 1) | 3) + 1)/4; +	length = (((size - 1) | 3) + 1) / 4;  	buf = kcalloc(length, sizeof(__le32), GFP_KERNEL);  	if (!buf) { @@ -328,12 +324,11 @@ static int cp210x_set_config(struct usb_serial_port *port, u8 request,  	int result, i, length;  	/* Number of integers required to contain the array */ -	length = (((size - 1) | 3) + 1)/4; +	length = (((size - 1) | 3) + 1) / 4;  	buf = kmalloc(length * sizeof(__le32), GFP_KERNEL);  	if (!buf) { -		dev_err(&port->dev, "%s - out of memory.\n", -				__func__); +		dev_err(&port->dev, "%s - out of memory.\n", __func__);  		return -ENOMEM;  	} @@ -384,7 +379,8 @@ static inline int cp210x_set_config_single(struct usb_serial_port *port,   * cp210x_quantise_baudrate   * Quantises the baud rate as per AN205 Table 1   */ -static unsigned int cp210x_quantise_baudrate(unsigned int baud) { +static unsigned int cp210x_quantise_baudrate(unsigned int baud) +{  	if (baud <= 300)  		baud = 300;  	else if (baud <= 600)      baud = 600; @@ -467,9 +463,7 @@ static void cp210x_get_termios(struct tty_struct *tty,  		cp210x_get_termios_port(tty->driver_data,  			&tty->termios.c_cflag, &baud);  		tty_encode_baud_rate(tty, baud, baud); -	} - -	else { +	} else {  		unsigned int cflag;  		cflag = 0;  		cp210x_get_termios_port(port, &cflag, &baud); @@ -693,8 +687,8 @@ static void cp210x_set_termios(struct tty_struct *tty,  			break;*/  		default:  			dev_dbg(dev, "cp210x driver does not support the number of bits requested, using 8 bit mode\n"); -				bits |= BITS_DATA_8; -				break; +			bits |= BITS_DATA_8; +			break;  		}  		if (cp210x_set_config(port, CP210X_SET_LINE_CTL, &bits, 2))  			dev_dbg(dev, "Number of data bits requested not supported by device\n"); @@ -767,7 +761,7 @@ static void cp210x_set_termios(struct tty_struct *tty,  } -static int cp210x_tiocmset (struct tty_struct *tty, +static int cp210x_tiocmset(struct tty_struct *tty,  		unsigned int set, unsigned int clear)  {  	struct usb_serial_port *port = tty->driver_data; @@ -809,7 +803,7 @@ static void cp210x_dtr_rts(struct usb_serial_port *p, int on)  		cp210x_tiocmset_port(p, 0, TIOCM_DTR|TIOCM_RTS);  } -static int cp210x_tiocmget (struct tty_struct *tty) +static int cp210x_tiocmget(struct tty_struct *tty)  {  	struct usb_serial_port *port = tty->driver_data;  	unsigned int control; @@ -829,7 +823,7 @@ static int cp210x_tiocmget (struct tty_struct *tty)  	return result;  } -static void cp210x_break_ctl (struct tty_struct *tty, int break_state) +static void cp210x_break_ctl(struct tty_struct *tty, int break_state)  {  	struct usb_serial_port *port = tty->driver_data;  	unsigned int state; @@ -874,5 +868,4 @@ static void cp210x_release(struct usb_serial *serial)  module_usb_serial_driver(serial_drivers, id_table);  MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_VERSION(DRIVER_VERSION);  MODULE_LICENSE("GPL");  | 
