aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/iuu_phoenix.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 16:23:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-01 16:23:01 -0400
commitd9a807461fc8cc0d6ba589ea0730d139122af012 (patch)
tree9d8c7a044659d821748dd40718a22557c04e4299 /drivers/usb/serial/iuu_phoenix.c
parent3498d13b8090c0b0ef911409fbc503a7c4cca6ef (diff)
parent70c048a238c780c226eb4b115ebaa908cb3b34ec (diff)
Merge tag 'usb-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB changes from Greg Kroah-Hartman: "Here is the big USB pull request for 3.7-rc1 There are lots of gadget driver changes (including copying a bunch of files into the drivers/staging/ccg/ directory so that the other gadget drivers can be fixed up properly without breaking that driver), and we remove the old obsolete ub.c driver from the tree. There are also the usual XHCI set of updates, and other various driver changes and updates. We also are trying hard to remove the old dbg() macro, but the final bits of that removal will be coming in through the networking tree before we can delete it for good. All of these patches have been in the linux-next tree. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" Fix up several annoying - but fairly mindless - conflicts due to the termios structure having moved into the tty device, and often clashing with dbg -> dev_dbg conversion. * tag 'usb-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (339 commits) USB: ezusb: move ezusb.c from drivers/usb/serial to drivers/usb/misc USB: uas: fix gcc warning USB: uas: fix locking USB: Fix race condition when removing host controllers USB: uas: add locking USB: uas: fix abort USB: uas: remove aborted field, replace with status bit. USB: uas: fix task management USB: uas: keep track of command urbs xhci: Intel Panther Point BEI quirk. powerpc/usb: remove checking PHY_CLK_VALID for UTMI PHY USB: ftdi_sio: add TIAO USB Multi-Protocol Adapter (TUMPA) support Revert "usb : Add sysfs files to control port power." USB: serial: remove vizzini driver usb: host: xhci: Fix Null pointer dereferencing with 71c731a for non-x86 systems Increase XHCI suspend timeout to 16ms USB: ohci-at91: fix null pointer in ohci_hcd_at91_overcurrent_irq USB: sierra_ms: don't keep unused variable fsl/usb: Add support for USB controller version 2.4 USB: qcaux: add Pantech vendor class match ...
Diffstat (limited to 'drivers/usb/serial/iuu_phoenix.c')
-rw-r--r--drivers/usb/serial/iuu_phoenix.c134
1 files changed, 58 insertions, 76 deletions
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index bf3864045c18..01da3ea36e89 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -32,13 +32,6 @@
32#include "iuu_phoenix.h" 32#include "iuu_phoenix.h"
33#include <linux/random.h> 33#include <linux/random.h>
34 34
35
36#ifdef CONFIG_USB_SERIAL_DEBUG
37static bool debug = 1;
38#else
39static bool debug;
40#endif
41
42/* 35/*
43 * Version Information 36 * Version Information
44 */ 37 */
@@ -72,7 +65,6 @@ struct iuu_private {
72 u8 *writebuf; /* buffer for writing to device */ 65 u8 *writebuf; /* buffer for writing to device */
73 int writelen; /* num of byte to write to device */ 66 int writelen; /* num of byte to write to device */
74 u8 *buf; /* used for initialize speed */ 67 u8 *buf; /* used for initialize speed */
75 u8 *dbgbuf; /* debug buffer */
76 u8 len; 68 u8 len;
77 int vcc; /* vcc (either 3 or 5 V) */ 69 int vcc; /* vcc (either 3 or 5 V) */
78 u32 baud; 70 u32 baud;
@@ -84,32 +76,31 @@ struct iuu_private {
84static void iuu_free_buf(struct iuu_private *priv) 76static void iuu_free_buf(struct iuu_private *priv)
85{ 77{
86 kfree(priv->buf); 78 kfree(priv->buf);
87 kfree(priv->dbgbuf);
88 kfree(priv->writebuf); 79 kfree(priv->writebuf);
89} 80}
90 81
91static int iuu_alloc_buf(struct iuu_private *priv) 82static int iuu_alloc_buf(struct usb_serial *serial, struct iuu_private *priv)
92{ 83{
93 priv->buf = kzalloc(256, GFP_KERNEL); 84 priv->buf = kzalloc(256, GFP_KERNEL);
94 priv->dbgbuf = kzalloc(256, GFP_KERNEL);
95 priv->writebuf = kzalloc(256, GFP_KERNEL); 85 priv->writebuf = kzalloc(256, GFP_KERNEL);
96 if (!priv->buf || !priv->dbgbuf || !priv->writebuf) { 86 if (!priv->buf || !priv->writebuf) {
97 iuu_free_buf(priv); 87 iuu_free_buf(priv);
98 dbg("%s problem allocation buffer", __func__); 88 dev_dbg(&serial->dev->dev, "%s problem allocation buffer\n", __func__);
99 return -ENOMEM; 89 return -ENOMEM;
100 } 90 }
101 dbg("%s - Privates buffers allocation success", __func__); 91 dev_dbg(&serial->dev->dev, "%s - Privates buffers allocation success\n", __func__);
102 return 0; 92 return 0;
103} 93}
104 94
105static int iuu_startup(struct usb_serial *serial) 95static int iuu_startup(struct usb_serial *serial)
106{ 96{
107 struct iuu_private *priv; 97 struct iuu_private *priv;
98
108 priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL); 99 priv = kzalloc(sizeof(struct iuu_private), GFP_KERNEL);
109 dbg("%s- priv allocation success", __func__); 100 dev_dbg(&serial->dev->dev, "%s- priv allocation success\n", __func__);
110 if (!priv) 101 if (!priv)
111 return -ENOMEM; 102 return -ENOMEM;
112 if (iuu_alloc_buf(priv)) { 103 if (iuu_alloc_buf(serial, priv)) {
113 kfree(priv); 104 kfree(priv);
114 return -ENOMEM; 105 return -ENOMEM;
115 } 106 }
@@ -130,13 +121,13 @@ static void iuu_release(struct usb_serial *serial)
130 121
131 if (priv) { 122 if (priv) {
132 iuu_free_buf(priv); 123 iuu_free_buf(priv);
133 dbg("%s - I will free all", __func__); 124 dev_dbg(&port->dev, "%s - I will free all\n", __func__);
134 usb_set_serial_port_data(port, NULL); 125 usb_set_serial_port_data(port, NULL);
135 126
136 dbg("%s - priv is not anymore in port structure", __func__); 127 dev_dbg(&port->dev, "%s - priv is not anymore in port structure\n", __func__);
137 kfree(priv); 128 kfree(priv);
138 129
139 dbg("%s priv is now kfree", __func__); 130 dev_dbg(&port->dev, "%s priv is now kfree\n", __func__);
140 } 131 }
141} 132}
142 133
@@ -148,13 +139,13 @@ static int iuu_tiocmset(struct tty_struct *tty,
148 unsigned long flags; 139 unsigned long flags;
149 140
150 /* FIXME: locking on tiomstatus */ 141 /* FIXME: locking on tiomstatus */
151 dbg("%s (%d) msg : SET = 0x%04x, CLEAR = 0x%04x ", __func__, 142 dev_dbg(&port->dev, "%s msg : SET = 0x%04x, CLEAR = 0x%04x\n",
152 port->number, set, clear); 143 __func__, set, clear);
153 144
154 spin_lock_irqsave(&priv->lock, flags); 145 spin_lock_irqsave(&priv->lock, flags);
155 146
156 if ((set & TIOCM_RTS) && !(priv->tiostatus == TIOCM_RTS)) { 147 if ((set & TIOCM_RTS) && !(priv->tiostatus == TIOCM_RTS)) {
157 dbg("%s TIOCMSET RESET called !!!", __func__); 148 dev_dbg(&port->dev, "%s TIOCMSET RESET called !!!\n", __func__);
158 priv->reset = 1; 149 priv->reset = 1;
159 } 150 }
160 if (set & TIOCM_RTS) 151 if (set & TIOCM_RTS)
@@ -190,7 +181,7 @@ static void iuu_rxcmd(struct urb *urb)
190 int status = urb->status; 181 int status = urb->status;
191 182
192 if (status) { 183 if (status) {
193 dbg("%s - status = %d", __func__, status); 184 dev_dbg(&port->dev, "%s - status = %d\n", __func__, status);
194 /* error stop all */ 185 /* error stop all */
195 return; 186 return;
196 } 187 }
@@ -244,13 +235,13 @@ static void iuu_update_status_callback(struct urb *urb)
244 int status = urb->status; 235 int status = urb->status;
245 236
246 if (status) { 237 if (status) {
247 dbg("%s - status = %d", __func__, status); 238 dev_dbg(&port->dev, "%s - status = %d\n", __func__, status);
248 /* error stop all */ 239 /* error stop all */
249 return; 240 return;
250 } 241 }
251 242
252 st = urb->transfer_buffer; 243 st = urb->transfer_buffer;
253 dbg("%s - enter", __func__); 244 dev_dbg(&port->dev, "%s - enter\n", __func__);
254 if (urb->actual_length == 1) { 245 if (urb->actual_length == 1) {
255 switch (st[0]) { 246 switch (st[0]) {
256 case 0x1: 247 case 0x1:
@@ -272,7 +263,7 @@ static void iuu_status_callback(struct urb *urb)
272 int result; 263 int result;
273 int status = urb->status; 264 int status = urb->status;
274 265
275 dbg("%s - status = %d", __func__, status); 266 dev_dbg(&port->dev, "%s - status = %d\n", __func__, status);
276 usb_fill_bulk_urb(port->read_urb, port->serial->dev, 267 usb_fill_bulk_urb(port->read_urb, port->serial->dev,
277 usb_rcvbulkpipe(port->serial->dev, 268 usb_rcvbulkpipe(port->serial->dev,
278 port->bulk_in_endpointAddress), 269 port->bulk_in_endpointAddress),
@@ -311,9 +302,9 @@ static int bulk_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
311 count, &actual, HZ * 1); 302 count, &actual, HZ * 1);
312 303
313 if (status != IUU_OPERATION_OK) 304 if (status != IUU_OPERATION_OK)
314 dbg("%s - error = %2x", __func__, status); 305 dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status);
315 else 306 else
316 dbg("%s - write OK !", __func__); 307 dev_dbg(&port->dev, "%s - write OK !\n", __func__);
317 return status; 308 return status;
318} 309}
319 310
@@ -331,9 +322,9 @@ static int read_immediate(struct usb_serial_port *port, u8 *buf, u8 count)
331 count, &actual, HZ * 1); 322 count, &actual, HZ * 1);
332 323
333 if (status != IUU_OPERATION_OK) 324 if (status != IUU_OPERATION_OK)
334 dbg("%s - error = %2x", __func__, status); 325 dev_dbg(&port->dev, "%s - error = %2x\n", __func__, status);
335 else 326 else
336 dbg("%s - read OK !", __func__); 327 dev_dbg(&port->dev, "%s - read OK !\n", __func__);
337 return status; 328 return status;
338} 329}
339 330
@@ -357,9 +348,9 @@ static int iuu_led(struct usb_serial_port *port, unsigned int R,
357 status = bulk_immediate(port, buf, 8); 348 status = bulk_immediate(port, buf, 8);
358 kfree(buf); 349 kfree(buf);
359 if (status != IUU_OPERATION_OK) 350 if (status != IUU_OPERATION_OK)
360 dbg("%s - led error status = %2x", __func__, status); 351 dev_dbg(&port->dev, "%s - led error status = %2x\n", __func__, status);
361 else 352 else
362 dbg("%s - led OK !", __func__); 353 dev_dbg(&port->dev, "%s - led OK !\n", __func__);
363 return IUU_OPERATION_OK; 354 return IUU_OPERATION_OK;
364} 355}
365 356
@@ -445,7 +436,7 @@ static int iuu_clk(struct usb_serial_port *port, int dwFrq)
445 436
446 status = bulk_immediate(port, (u8 *) priv->buf, Count); 437 status = bulk_immediate(port, (u8 *) priv->buf, Count);
447 if (status != 0) { 438 if (status != 0) {
448 dbg("%s - write error ", __func__); 439 dev_dbg(&port->dev, "%s - write error\n", __func__);
449 return status; 440 return status;
450 } 441 }
451 } else if (frq == 3579000) { 442 } else if (frq == 3579000) {
@@ -554,12 +545,13 @@ static int iuu_clk(struct usb_serial_port *port, int dwFrq)
554 545
555 status = bulk_immediate(port, (u8 *) priv->buf, Count); 546 status = bulk_immediate(port, (u8 *) priv->buf, Count);
556 if (status != IUU_OPERATION_OK) 547 if (status != IUU_OPERATION_OK)
557 dbg("%s - write error ", __func__); 548 dev_dbg(&port->dev, "%s - write error\n", __func__);
558 return status; 549 return status;
559} 550}
560 551
561static int iuu_uart_flush(struct usb_serial_port *port) 552static int iuu_uart_flush(struct usb_serial_port *port)
562{ 553{
554 struct device *dev = &port->dev;
563 int i; 555 int i;
564 int status; 556 int status;
565 u8 rxcmd = IUU_UART_RX; 557 u8 rxcmd = IUU_UART_RX;
@@ -571,27 +563,26 @@ static int iuu_uart_flush(struct usb_serial_port *port)
571 for (i = 0; i < 2; i++) { 563 for (i = 0; i < 2; i++) {
572 status = bulk_immediate(port, &rxcmd, 1); 564 status = bulk_immediate(port, &rxcmd, 1);
573 if (status != IUU_OPERATION_OK) { 565 if (status != IUU_OPERATION_OK) {
574 dbg("%s - uart_flush_write error", __func__); 566 dev_dbg(dev, "%s - uart_flush_write error\n", __func__);
575 return status; 567 return status;
576 } 568 }
577 569
578 status = read_immediate(port, &priv->len, 1); 570 status = read_immediate(port, &priv->len, 1);
579 if (status != IUU_OPERATION_OK) { 571 if (status != IUU_OPERATION_OK) {
580 dbg("%s - uart_flush_read error", __func__); 572 dev_dbg(dev, "%s - uart_flush_read error\n", __func__);
581 return status; 573 return status;
582 } 574 }
583 575
584 if (priv->len > 0) { 576 if (priv->len > 0) {
585 dbg("%s - uart_flush datalen is : %i ", __func__, 577 dev_dbg(dev, "%s - uart_flush datalen is : %i\n", __func__, priv->len);
586 priv->len);
587 status = read_immediate(port, priv->buf, priv->len); 578 status = read_immediate(port, priv->buf, priv->len);
588 if (status != IUU_OPERATION_OK) { 579 if (status != IUU_OPERATION_OK) {
589 dbg("%s - uart_flush_read error", __func__); 580 dev_dbg(dev, "%s - uart_flush_read error\n", __func__);
590 return status; 581 return status;
591 } 582 }
592 } 583 }
593 } 584 }
594 dbg("%s - uart_flush_read OK!", __func__); 585 dev_dbg(dev, "%s - uart_flush_read OK!\n", __func__);
595 iuu_led(port, 0, 0xF000, 0, 0xFF); 586 iuu_led(port, 0, 0xF000, 0, 0xFF);
596 return status; 587 return status;
597} 588}
@@ -610,10 +601,10 @@ static void read_buf_callback(struct urb *urb)
610 return; 601 return;
611 } 602 }
612 603
613 dbg("%s - %i chars to write", __func__, urb->actual_length); 604 dev_dbg(&port->dev, "%s - %i chars to write\n", __func__, urb->actual_length);
614 tty = tty_port_tty_get(&port->port); 605 tty = tty_port_tty_get(&port->port);
615 if (data == NULL) 606 if (data == NULL)
616 dbg("%s - data is NULL !!!", __func__); 607 dev_dbg(&port->dev, "%s - data is NULL !!!\n", __func__);
617 if (tty && urb->actual_length && data) { 608 if (tty && urb->actual_length && data) {
618 tty_insert_flip_string(tty, data, urb->actual_length); 609 tty_insert_flip_string(tty, data, urb->actual_length);
619 tty_flip_buffer_push(tty); 610 tty_flip_buffer_push(tty);
@@ -627,7 +618,6 @@ static int iuu_bulk_write(struct usb_serial_port *port)
627 struct iuu_private *priv = usb_get_serial_port_data(port); 618 struct iuu_private *priv = usb_get_serial_port_data(port);
628 unsigned long flags; 619 unsigned long flags;
629 int result; 620 int result;
630 int i;
631 int buf_len; 621 int buf_len;
632 char *buf_ptr = port->write_urb->transfer_buffer; 622 char *buf_ptr = port->write_urb->transfer_buffer;
633 623
@@ -640,14 +630,8 @@ static int iuu_bulk_write(struct usb_serial_port *port)
640 buf_len = priv->writelen; 630 buf_len = priv->writelen;
641 priv->writelen = 0; 631 priv->writelen = 0;
642 spin_unlock_irqrestore(&priv->lock, flags); 632 spin_unlock_irqrestore(&priv->lock, flags);
643 if (debug == 1) { 633 dev_dbg(&port->dev, "%s - writing %i chars : %*ph\n", __func__,
644 for (i = 0; i < buf_len; i++) 634 buf_len, buf_len, buf_ptr);
645 sprintf(priv->dbgbuf + i*2 ,
646 "%02X", priv->writebuf[i]);
647 priv->dbgbuf[buf_len+i*2] = 0;
648 dbg("%s - writing %i chars : %s", __func__,
649 buf_len, priv->dbgbuf);
650 }
651 usb_fill_bulk_urb(port->write_urb, port->serial->dev, 635 usb_fill_bulk_urb(port->write_urb, port->serial->dev,
652 usb_sndbulkpipe(port->serial->dev, 636 usb_sndbulkpipe(port->serial->dev,
653 port->bulk_out_endpointAddress), 637 port->bulk_out_endpointAddress),
@@ -683,18 +667,18 @@ static void iuu_uart_read_callback(struct urb *urb)
683 priv->poll++; 667 priv->poll++;
684 668
685 if (status) { 669 if (status) {
686 dbg("%s - status = %d", __func__, status); 670 dev_dbg(&port->dev, "%s - status = %d\n", __func__, status);
687 /* error stop all */ 671 /* error stop all */
688 return; 672 return;
689 } 673 }
690 if (data == NULL) 674 if (data == NULL)
691 dbg("%s - data is NULL !!!", __func__); 675 dev_dbg(&port->dev, "%s - data is NULL !!!\n", __func__);
692 676
693 if (urb->actual_length == 1 && data != NULL) 677 if (urb->actual_length == 1 && data != NULL)
694 len = (int) data[0]; 678 len = (int) data[0];
695 679
696 if (urb->actual_length > 1) { 680 if (urb->actual_length > 1) {
697 dbg("%s - urb->actual_length = %i", __func__, 681 dev_dbg(&port->dev, "%s - urb->actual_length = %i\n", __func__,
698 urb->actual_length); 682 urb->actual_length);
699 error = 1; 683 error = 1;
700 return; 684 return;
@@ -702,7 +686,7 @@ static void iuu_uart_read_callback(struct urb *urb)
702 /* if len > 0 call readbuf */ 686 /* if len > 0 call readbuf */
703 687
704 if (len > 0 && error == 0) { 688 if (len > 0 && error == 0) {
705 dbg("%s - call read buf - len to read is %i ", 689 dev_dbg(&port->dev, "%s - call read buf - len to read is %i\n",
706 __func__, len); 690 __func__, len);
707 status = iuu_read_buf(port, len); 691 status = iuu_read_buf(port, len);
708 return; 692 return;
@@ -729,7 +713,7 @@ static void iuu_uart_read_callback(struct urb *urb)
729 } 713 }
730 spin_unlock_irqrestore(&priv->lock, flags); 714 spin_unlock_irqrestore(&priv->lock, flags);
731 /* if nothing to write call again rxcmd */ 715 /* if nothing to write call again rxcmd */
732 dbg("%s - rxcmd recall", __func__); 716 dev_dbg(&port->dev, "%s - rxcmd recall\n", __func__);
733 iuu_led_activity_off(urb); 717 iuu_led_activity_off(urb);
734} 718}
735 719
@@ -769,7 +753,7 @@ static void read_rxcmd_callback(struct urb *urb)
769 port->read_urb->transfer_buffer, 256, 753 port->read_urb->transfer_buffer, 256,
770 iuu_uart_read_callback, port); 754 iuu_uart_read_callback, port);
771 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 755 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
772 dbg("%s - submit result = %d", __func__, result); 756 dev_dbg(&port->dev, "%s - submit result = %d\n", __func__, result);
773} 757}
774 758
775static int iuu_uart_on(struct usb_serial_port *port) 759static int iuu_uart_on(struct usb_serial_port *port)
@@ -789,13 +773,13 @@ static int iuu_uart_on(struct usb_serial_port *port)
789 773
790 status = bulk_immediate(port, buf, 4); 774 status = bulk_immediate(port, buf, 4);
791 if (status != IUU_OPERATION_OK) { 775 if (status != IUU_OPERATION_OK) {
792 dbg("%s - uart_on error", __func__); 776 dev_dbg(&port->dev, "%s - uart_on error\n", __func__);
793 goto uart_enable_failed; 777 goto uart_enable_failed;
794 } 778 }
795 /* iuu_reset() the card after iuu_uart_on() */ 779 /* iuu_reset() the card after iuu_uart_on() */
796 status = iuu_uart_flush(port); 780 status = iuu_uart_flush(port);
797 if (status != IUU_OPERATION_OK) 781 if (status != IUU_OPERATION_OK)
798 dbg("%s - uart_flush error", __func__); 782 dev_dbg(&port->dev, "%s - uart_flush error\n", __func__);
799uart_enable_failed: 783uart_enable_failed:
800 kfree(buf); 784 kfree(buf);
801 return status; 785 return status;
@@ -813,7 +797,7 @@ static int iuu_uart_off(struct usb_serial_port *port)
813 797
814 status = bulk_immediate(port, buf, 1); 798 status = bulk_immediate(port, buf, 1);
815 if (status != IUU_OPERATION_OK) 799 if (status != IUU_OPERATION_OK)
816 dbg("%s - uart_off error", __func__); 800 dev_dbg(&port->dev, "%s - uart_off error\n", __func__);
817 801
818 kfree(buf); 802 kfree(buf);
819 return status; 803 return status;
@@ -830,7 +814,7 @@ static int iuu_uart_baud(struct usb_serial_port *port, u32 baud_base,
830 u8 T1reload = 0; 814 u8 T1reload = 0;
831 unsigned int T1FrekvensHZ = 0; 815 unsigned int T1FrekvensHZ = 0;
832 816
833 dbg("%s - enter baud_base=%d", __func__, baud_base); 817 dev_dbg(&port->dev, "%s - enter baud_base=%d\n", __func__, baud_base);
834 dataout = kmalloc(sizeof(u8) * 5, GFP_KERNEL); 818 dataout = kmalloc(sizeof(u8) * 5, GFP_KERNEL);
835 819
836 if (!dataout) 820 if (!dataout)
@@ -911,7 +895,7 @@ static int iuu_uart_baud(struct usb_serial_port *port, u32 baud_base,
911 895
912 status = bulk_immediate(port, dataout, DataCount); 896 status = bulk_immediate(port, dataout, DataCount);
913 if (status != IUU_OPERATION_OK) 897 if (status != IUU_OPERATION_OK)
914 dbg("%s - uart_off error", __func__); 898 dev_dbg(&port->dev, "%s - uart_off error\n", __func__);
915 kfree(dataout); 899 kfree(dataout);
916 return status; 900 return status;
917} 901}
@@ -932,7 +916,7 @@ static void iuu_set_termios(struct tty_struct *tty,
932 /* Just use the ospeed. ispeed should be the same. */ 916 /* Just use the ospeed. ispeed should be the same. */
933 baud = tty->termios.c_ospeed; 917 baud = tty->termios.c_ospeed;
934 918
935 dbg("%s - enter c_ospeed or baud=%d", __func__, baud); 919 dev_dbg(&port->dev, "%s - enter c_ospeed or baud=%d\n", __func__, baud);
936 920
937 /* compute the parity parameter */ 921 /* compute the parity parameter */
938 parity = 0; 922 parity = 0;
@@ -983,7 +967,7 @@ static void iuu_close(struct usb_serial_port *port)
983 if (serial->dev) { 967 if (serial->dev) {
984 /* free writebuf */ 968 /* free writebuf */
985 /* shutdown our urbs */ 969 /* shutdown our urbs */
986 dbg("%s - shutting down urbs", __func__); 970 dev_dbg(&port->dev, "%s - shutting down urbs\n", __func__);
987 usb_kill_urb(port->write_urb); 971 usb_kill_urb(port->write_urb);
988 usb_kill_urb(port->read_urb); 972 usb_kill_urb(port->read_urb);
989 usb_kill_urb(port->interrupt_in_urb); 973 usb_kill_urb(port->interrupt_in_urb);
@@ -1006,6 +990,7 @@ static void iuu_init_termios(struct tty_struct *tty)
1006static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port) 990static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
1007{ 991{
1008 struct usb_serial *serial = port->serial; 992 struct usb_serial *serial = port->serial;
993 struct device *dev = &port->dev;
1009 u8 *buf; 994 u8 *buf;
1010 int result; 995 int result;
1011 int baud; 996 int baud;
@@ -1017,7 +1002,7 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
1017 /* Re-encode speed */ 1002 /* Re-encode speed */
1018 tty_encode_baud_rate(tty, baud, baud); 1003 tty_encode_baud_rate(tty, baud, baud);
1019 1004
1020 dbg("%s - port %d, baud %d", __func__, port->number, baud); 1005 dev_dbg(dev, "%s - baud %d\n", __func__, baud);
1021 usb_clear_halt(serial->dev, port->write_urb->pipe); 1006 usb_clear_halt(serial->dev, port->write_urb->pipe);
1022 usb_clear_halt(serial->dev, port->read_urb->pipe); 1007 usb_clear_halt(serial->dev, port->read_urb->pipe);
1023 1008
@@ -1032,14 +1017,14 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
1032 result = usb_control_msg(port->serial->dev, \ 1017 result = usb_control_msg(port->serial->dev, \
1033 usb_rcvctrlpipe(port->serial->dev, 0), \ 1018 usb_rcvctrlpipe(port->serial->dev, 0), \
1034 b, a, c, d, buf, 1, 1000); \ 1019 b, a, c, d, buf, 1, 1000); \
1035 dbg("0x%x:0x%x:0x%x:0x%x %d - %x", a, b, c, d, result, \ 1020 dev_dbg(dev, "0x%x:0x%x:0x%x:0x%x %d - %x\n", a, b, c, d, result, \
1036 buf[0]); } while (0); 1021 buf[0]); } while (0);
1037 1022
1038#define SOUP(a, b, c, d) do { \ 1023#define SOUP(a, b, c, d) do { \
1039 result = usb_control_msg(port->serial->dev, \ 1024 result = usb_control_msg(port->serial->dev, \
1040 usb_sndctrlpipe(port->serial->dev, 0), \ 1025 usb_sndctrlpipe(port->serial->dev, 0), \
1041 b, a, c, d, NULL, 0, 1000); \ 1026 b, a, c, d, NULL, 0, 1000); \
1042 dbg("0x%x:0x%x:0x%x:0x%x %d", a, b, c, d, result); } while (0) 1027 dev_dbg(dev, "0x%x:0x%x:0x%x:0x%x %d\n", a, b, c, d, result); } while (0)
1043 1028
1044 /* This is not UART related but IUU USB driver related or something */ 1029 /* This is not UART related but IUU USB driver related or something */
1045 /* like that. Basically no IUU will accept any commands from the USB */ 1030 /* like that. Basically no IUU will accept any commands from the USB */
@@ -1119,7 +1104,7 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
1119 1104
1120 iuu_uart_flush(port); 1105 iuu_uart_flush(port);
1121 1106
1122 dbg("%s - initialization done", __func__); 1107 dev_dbg(dev, "%s - initialization done\n", __func__);
1123 1108
1124 memset(port->write_urb->transfer_buffer, IUU_UART_RX, 1); 1109 memset(port->write_urb->transfer_buffer, IUU_UART_RX, 1);
1125 usb_fill_bulk_urb(port->write_urb, port->serial->dev, 1110 usb_fill_bulk_urb(port->write_urb, port->serial->dev,
@@ -1129,11 +1114,10 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
1129 read_rxcmd_callback, port); 1114 read_rxcmd_callback, port);
1130 result = usb_submit_urb(port->write_urb, GFP_KERNEL); 1115 result = usb_submit_urb(port->write_urb, GFP_KERNEL);
1131 if (result) { 1116 if (result) {
1132 dev_err(&port->dev, "%s - failed submitting read urb," 1117 dev_err(dev, "%s - failed submitting read urb, error %d\n", __func__, result);
1133 " error %d\n", __func__, result);
1134 iuu_close(port); 1118 iuu_close(port);
1135 } else { 1119 } else {
1136 dbg("%s - rxcmd OK", __func__); 1120 dev_dbg(dev, "%s - rxcmd OK\n", __func__);
1137 } 1121 }
1138 1122
1139 return result; 1123 return result;
@@ -1159,9 +1143,9 @@ static int iuu_vcc_set(struct usb_serial_port *port, unsigned int vcc)
1159 kfree(buf); 1143 kfree(buf);
1160 1144
1161 if (status != IUU_OPERATION_OK) 1145 if (status != IUU_OPERATION_OK)
1162 dbg("%s - vcc error status = %2x", __func__, status); 1146 dev_dbg(&port->dev, "%s - vcc error status = %2x\n", __func__, status);
1163 else 1147 else
1164 dbg("%s - vcc OK !", __func__); 1148 dev_dbg(&port->dev, "%s - vcc OK !\n", __func__);
1165 1149
1166 return status; 1150 return status;
1167} 1151}
@@ -1192,7 +1176,7 @@ static ssize_t store_vcc_mode(struct device *dev,
1192 goto fail_store_vcc_mode; 1176 goto fail_store_vcc_mode;
1193 } 1177 }
1194 1178
1195 dbg("%s: setting vcc_mode = %ld", __func__, v); 1179 dev_dbg(dev, "%s: setting vcc_mode = %ld", __func__, v);
1196 1180
1197 if ((v != 3) && (v != 5)) { 1181 if ((v != 3) && (v != 5)) {
1198 dev_err(dev, "%s - vcc_mode %ld is invalid\n", __func__, v); 1182 dev_err(dev, "%s - vcc_mode %ld is invalid\n", __func__, v);
@@ -1257,8 +1241,6 @@ MODULE_DESCRIPTION(DRIVER_DESC);
1257MODULE_LICENSE("GPL"); 1241MODULE_LICENSE("GPL");
1258 1242
1259MODULE_VERSION(DRIVER_VERSION); 1243MODULE_VERSION(DRIVER_VERSION);
1260module_param(debug, bool, S_IRUGO | S_IWUSR);
1261MODULE_PARM_DESC(debug, "Debug enabled or not");
1262 1244
1263module_param(xmas, bool, S_IRUGO | S_IWUSR); 1245module_param(xmas, bool, S_IRUGO | S_IWUSR);
1264MODULE_PARM_DESC(xmas, "Xmas colors enabled or not"); 1246MODULE_PARM_DESC(xmas, "Xmas colors enabled or not");