Make parameters to ARK3116_SND and ARK3116_RCV u8 values. Switch the order of ARK3116_SND parameters so the index comes 2nd in both SND and RCV functions. Signed-off-by: Mike McCormack <mikem@xxxxxxxxxx> --- drivers/usb/serial/ark3116.c | 127 ++++++++++++++++++++--------------------- 1 files changed, 62 insertions(+), 65 deletions(-) diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index b859455..89ac077 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c @@ -46,7 +46,7 @@ static int is_irda(struct usb_serial *serial) } static inline int ARK3116_SND(struct usb_serial *serial, - __u16 value, __u16 index) + u8 index, u8 value) { return usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), @@ -55,7 +55,7 @@ static inline int ARK3116_SND(struct usb_serial *serial, } static inline int ARK3116_RCV(struct usb_serial *serial, - __u16 index, char *buf) + u8 index, u8 *buf) { return usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), @@ -65,7 +65,7 @@ static inline int ARK3116_RCV(struct usb_serial *serial, static int ark3116_attach(struct usb_serial *serial) { - char *buf; + u8 *buf; buf = kmalloc(1, GFP_KERNEL); if (!buf) { @@ -77,60 +77,59 @@ static int ark3116_attach(struct usb_serial *serial) dbg("IrDA mode"); /* 3 */ - ARK3116_SND(serial, 0x0008, 0x0002); - ARK3116_SND(serial, 0x0008, 0x0001); - ARK3116_SND(serial, 0x0000, 0x0008); - ARK3116_SND(serial, is_irda(serial) ? 0x0001 : 0x0000, - 0x000B); + ARK3116_SND(serial, 0x02, 0x08); + ARK3116_SND(serial, 0x01, 0x08); + ARK3116_SND(serial, 0x08, 0x00); + ARK3116_SND(serial, 0x0b, is_irda(serial) ? 0x01 : 0x00); if (is_irda(serial)) { - ARK3116_SND(serial, 0x0000, 0x000C); - ARK3116_SND(serial, 0x0041, 0x000D); - ARK3116_SND(serial, 0x0001, 0x000A); + ARK3116_SND(serial, 0x0C, 0x00); + ARK3116_SND(serial, 0x0D, 0x41); + ARK3116_SND(serial, 0x0A, 0x01); } /* <-- seq7 */ - ARK3116_RCV(serial, 0x0003, buf); - ARK3116_SND(serial, 0x0080, 0x0003); - ARK3116_SND(serial, 0x001A, 0x0000); - ARK3116_SND(serial, 0x0000, 0x0001); - ARK3116_SND(serial, 0x0000, 0x0003); + ARK3116_RCV(serial, 0x03, buf); + ARK3116_SND(serial, 0x03, 0x80); + ARK3116_SND(serial, 0x00, 0x1A); + ARK3116_SND(serial, 0x01, 0x00); + ARK3116_SND(serial, 0x03, 0x00); /* <-- seq12 */ - ARK3116_RCV(serial, 0x0004, buf); - ARK3116_SND(serial, 0x0000, 0x0004); + ARK3116_RCV(serial, 0x04, buf); + ARK3116_SND(serial, 0x04, 0x00); /* 14 */ - ARK3116_RCV(serial, 0x0004, buf); - ARK3116_SND(serial, 0x0000, 0x0004); + ARK3116_RCV(serial, 0x04, buf); + ARK3116_SND(serial, 0x04, 0x00); /* 16 */ - ARK3116_RCV(serial, 0x0004, buf); + ARK3116_RCV(serial, 0x04, buf); /* --> seq17 */ - ARK3116_SND(serial, 0x0001, 0x0004); + ARK3116_SND(serial, 0x04, 0x01); /* <-- seq18 */ - ARK3116_RCV(serial, 0x0004, buf); + ARK3116_RCV(serial, 0x04, buf); /* --> seq19 */ - ARK3116_SND(serial, 0x0003, 0x0004); + ARK3116_SND(serial, 0x04, 0x03); /* <-- seq20 */ /* seems like serial port status info (RTS, CTS, ...) */ /* returns modem control line status?! */ - ARK3116_RCV(serial, 0x0006, buf); + ARK3116_RCV(serial, 0x06, buf); /* set 9600 baud & do some init?! */ - ARK3116_SND(serial, 0x0083, 0x0003); - ARK3116_SND(serial, 0x0038, 0x0000); - ARK3116_SND(serial, 0x0001, 0x0001); + ARK3116_SND(serial, 0x03, 0x83); + ARK3116_SND(serial, 0x00, 0x38); + ARK3116_SND(serial, 0x01, 0x01); if (is_irda(serial)) - ARK3116_SND(serial, 0x0000, 0x0009); - ARK3116_SND(serial, 0x0003, 0x0003); - ARK3116_RCV(serial, 0x0004, buf); - ARK3116_SND(serial, 0x0000, 0x0003); - ARK3116_RCV(serial, 0x0003, buf); - ARK3116_SND(serial, 0x0003, 0x0003); + ARK3116_SND(serial, 0x09, 0x00); + ARK3116_SND(serial, 0x03, 0x03); + ARK3116_RCV(serial, 0x04, buf); + ARK3116_SND(serial, 0x03, 0x00); + ARK3116_RCV(serial, 0x03, buf); + ARK3116_SND(serial, 0x03, 0x03); kfree(buf); return 0; @@ -155,8 +154,8 @@ static void ark3116_set_termios(struct tty_struct *tty, unsigned int cflag = termios->c_cflag; int baud; int ark3116_baud; - char *buf; - char config; + u8 *buf; + u8 config; config = 0; @@ -260,7 +259,7 @@ static void ark3116_set_termios(struct tty_struct *tty, ark3116_baud = 3000000 / baud; /* ? */ - ARK3116_RCV(serial, 0x0003, buf); + ARK3116_RCV(serial, 0x03, buf); /* offset = buf[0]; */ /* offset = 0x03; */ @@ -268,21 +267,19 @@ static void ark3116_set_termios(struct tty_struct *tty, /* set baudrate */ dbg("setting baudrate to %d (->reg=%d)", baud, ark3116_baud); - ARK3116_SND(serial, 0x0083, 0x0003); - ARK3116_SND(serial, - (ark3116_baud & 0x00FF), 0x0000); - ARK3116_SND(serial, - (ark3116_baud & 0xFF00) >> 8, 0x0001); - ARK3116_SND(serial, 0x0003, 0x0003); + ARK3116_SND(serial, 0x03, 0x83); + ARK3116_SND(serial, 0x00, (ark3116_baud & 0x00FF)); + ARK3116_SND(serial, 0x01, (ark3116_baud & 0xFF00) >> 8); + ARK3116_SND(serial, 0x03, 0x03); /* ? */ - ARK3116_RCV(serial, 0x0004, buf); - ARK3116_SND(serial, 0x0000, 0x0003); + ARK3116_RCV(serial, 0x04, buf); + ARK3116_SND(serial, 0x03, 0x00); /* set data bit count, stop bit count & parity: */ dbg("updating bit count, stop bit or parity (cfg=0x%02X)", config); - ARK3116_RCV(serial, 0x0003, buf); - ARK3116_SND(serial, config, 0x0003); + ARK3116_RCV(serial, 0x03, buf); + ARK3116_SND(serial, 0x03, config); if (cflag & CRTSCTS) dbg("CRTSCTS not supported by chipset?!"); @@ -298,7 +295,7 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port) { struct ktermios tmp_termios; struct usb_serial *serial = port->serial; - char *buf; + u8 *buf; int result = 0; dbg("%s - port %d", __func__, port->number); @@ -314,29 +311,29 @@ static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port) goto err_out; /* open */ - ARK3116_RCV(serial, 0x0003, buf); + ARK3116_RCV(serial, 0x03, buf); - ARK3116_SND(serial, 0x0082, 0x0003); - ARK3116_SND(serial, 0x001A, 0x0000); - ARK3116_SND(serial, 0x0000, 0x0001); - ARK3116_SND(serial, 0x0002, 0x0003); + ARK3116_SND(serial, 0x03, 0x82); + ARK3116_SND(serial, 0x00, 0x1A); + ARK3116_SND(serial, 0x01, 0x00); + ARK3116_SND(serial, 0x03, 0x02); - ARK3116_RCV(serial, 0x0004, buf); - ARK3116_SND(serial, 0x0002, 0x0004); + ARK3116_RCV(serial, 0x04, buf); + ARK3116_SND(serial, 0x04, 0x02); - ARK3116_RCV(serial, 0x0004, buf); - ARK3116_SND(serial, 0x0000, 0x0004); + ARK3116_RCV(serial, 0x04, buf); + ARK3116_SND(serial, 0x04, 0x00); - ARK3116_RCV(serial, 0x0004, buf); + ARK3116_RCV(serial, 0x04, buf); - ARK3116_SND(serial, 0x0001, 0x0004); + ARK3116_SND(serial, 0x04, 0x01); - ARK3116_RCV(serial, 0x0004, buf); + ARK3116_RCV(serial, 0x04, buf); - ARK3116_SND(serial, 0x0003, 0x0004); + ARK3116_SND(serial, 0x04, 0x03); /* returns different values (control lines?!) */ - ARK3116_RCV(serial, 0x0006, buf); + ARK3116_RCV(serial, 0x06, buf); /* initialise termios */ if (tty) @@ -385,8 +382,8 @@ static int ark3116_tiocmget(struct tty_struct *tty, struct file *file) { struct usb_serial_port *port = tty->driver_data; struct usb_serial *serial = port->serial; - char *buf; - char temp; + u8 *buf; + u8 temp; /* seems like serial port status info (RTS, CTS, ...) is stored * in reg(?) 0x0006 @@ -401,7 +398,7 @@ static int ark3116_tiocmget(struct tty_struct *tty, struct file *file) } /* read register */ - ARK3116_RCV(serial, 0x0006, buf); + ARK3116_RCV(serial, 0x06, buf); temp = buf[0]; kfree(buf); -- 1.5.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html