diff options
Diffstat (limited to 'drivers/usb/serial/mos7720.c')
-rw-r--r-- | drivers/usb/serial/mos7720.c | 241 |
1 files changed, 87 insertions, 154 deletions
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index a07dd3c8cfe..1bf1ad06666 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -71,8 +71,6 @@ struct moschip_port { struct urb *write_urb_pool[NUM_URBS]; }; -static bool debug; - static struct usb_serial_driver moschip7720_2port_driver; #define USB_VENDOR_ID_MOSCHIP 0x9710 @@ -281,16 +279,19 @@ static void send_deferred_urbs(unsigned long _mos_parport) int ret_val; unsigned long flags; struct mos7715_parport *mos_parport = (void *)_mos_parport; - struct urbtracker *urbtrack; + struct urbtracker *urbtrack, *tmp; struct list_head *cursor, *next; + struct device *dev; /* if release function ran, game over */ if (unlikely(mos_parport->serial == NULL)) return; + dev = &mos_parport->serial->dev->dev; + /* try again to get the mutex */ if (!mutex_trylock(&mos_parport->serial->disc_mutex)) { - dbg("%s: rescheduling tasklet", __func__); + dev_dbg(dev, "%s: rescheduling tasklet\n", __func__); tasklet_schedule(&mos_parport->urb_tasklet); return; } @@ -305,20 +306,19 @@ static void send_deferred_urbs(unsigned long _mos_parport) if (list_empty(&mos_parport->deferred_urbs)) { spin_unlock_irqrestore(&mos_parport->listlock, flags); mutex_unlock(&mos_parport->serial->disc_mutex); - dbg("%s: deferred_urbs list empty", __func__); + dev_dbg(dev, "%s: deferred_urbs list empty\n", __func__); return; } /* move contents of deferred_urbs list to active_urbs list and submit */ list_for_each_safe(cursor, next, &mos_parport->deferred_urbs) list_move_tail(cursor, &mos_parport->active_urbs); - list_for_each_entry(urbtrack, &mos_parport->active_urbs, + list_for_each_entry_safe(urbtrack, tmp, &mos_parport->active_urbs, urblist_entry) { ret_val = usb_submit_urb(urbtrack->urb, GFP_ATOMIC); - dbg("%s: urb submitted", __func__); + dev_dbg(dev, "%s: urb submitted\n", __func__); if (ret_val) { - dev_err(&mos_parport->serial->dev->dev, - "usb_submit_urb() failed: %d", ret_val); + dev_err(dev, "usb_submit_urb() failed: %d\n", ret_val); list_del(&urbtrack->urblist_entry); kref_put(&urbtrack->ref_count, destroy_urbtracker); } @@ -334,7 +334,7 @@ static void async_complete(struct urb *urb) int status = urb->status; if (unlikely(status)) - dbg("%s - nonzero urb status received: %d", __func__, status); + dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", __func__, status); /* remove the urbtracker from the active_urbs list */ spin_lock(&urbtrack->mos_parport->listlock); @@ -389,7 +389,7 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport, &mos_parport->deferred_urbs); spin_unlock_irqrestore(&mos_parport->listlock, flags); tasklet_schedule(&mos_parport->urb_tasklet); - dbg("tasklet scheduled"); + dev_dbg(&usbdev->dev, "tasklet scheduled"); return 0; } @@ -690,7 +690,7 @@ static int mos7715_parport_init(struct usb_serial *serial) /* allocate and initialize parallel port control struct */ mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL); if (mos_parport == NULL) { - dbg("mos7715_parport_init: kzalloc failed"); + dev_dbg(&serial->dev->dev, "%s: kzalloc failed\n", __func__); return -ENOMEM; } mos_parport->msg_pending = false; @@ -743,6 +743,7 @@ static void mos7720_interrupt_callback(struct urb *urb) int result; int length; int status = urb->status; + struct device *dev = &urb->dev->dev; __u8 *data; __u8 sp1; __u8 sp2; @@ -755,12 +756,10 @@ static void mos7720_interrupt_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __func__, - status); + dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", __func__, - status); + dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); goto exit; } @@ -777,7 +776,7 @@ static void mos7720_interrupt_callback(struct urb *urb) * oneukum 2007-03-14 */ if (unlikely(length != 4)) { - dbg("Wrong data !!!"); + dev_dbg(dev, "Wrong data !!!\n"); return; } @@ -786,31 +785,29 @@ static void mos7720_interrupt_callback(struct urb *urb) if ((sp1 | sp2) & 0x01) { /* No Interrupt Pending in both the ports */ - dbg("No Interrupt !!!"); + dev_dbg(dev, "No Interrupt !!!\n"); } else { switch (sp1 & 0x0f) { case SERIAL_IIR_RLS: - dbg("Serial Port 1: Receiver status error or address " - "bit detected in 9-bit mode\n"); + dev_dbg(dev, "Serial Port 1: Receiver status error or address bit detected in 9-bit mode\n"); break; case SERIAL_IIR_CTI: - dbg("Serial Port 1: Receiver time out"); + dev_dbg(dev, "Serial Port 1: Receiver time out\n"); break; case SERIAL_IIR_MS: - /* dbg("Serial Port 1: Modem status change"); */ + /* dev_dbg(dev, "Serial Port 1: Modem status change\n"); */ break; } switch (sp2 & 0x0f) { case SERIAL_IIR_RLS: - dbg("Serial Port 2: Receiver status error or address " - "bit detected in 9-bit mode"); + dev_dbg(dev, "Serial Port 2: Receiver status error or address bit detected in 9-bit mode\n"); break; case SERIAL_IIR_CTI: - dbg("Serial Port 2: Receiver time out"); + dev_dbg(dev, "Serial Port 2: Receiver time out\n"); break; case SERIAL_IIR_MS: - /* dbg("Serial Port 2: Modem status change"); */ + /* dev_dbg(dev, "Serial Port 2: Modem status change\n"); */ break; } } @@ -818,9 +815,7 @@ static void mos7720_interrupt_callback(struct urb *urb) exit: result = usb_submit_urb(urb, GFP_ATOMIC); if (result) - dev_err(&urb->dev->dev, - "%s - Error %d submitting control urb\n", - __func__, result); + dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result); } /* @@ -833,6 +828,7 @@ static void mos7715_interrupt_callback(struct urb *urb) int result; int length; int status = urb->status; + struct device *dev = &urb->dev->dev; __u8 *data; __u8 iir; @@ -845,12 +841,10 @@ static void mos7715_interrupt_callback(struct urb *urb) case -ESHUTDOWN: case -ENODEV: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __func__, - status); + dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", __func__, - status); + dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status); goto exit; } @@ -864,7 +858,7 @@ static void mos7715_interrupt_callback(struct urb *urb) * Byte 4: FIFO status for both */ if (unlikely(length != 4)) { - dbg("Wrong data !!!"); + dev_dbg(dev, "Wrong data !!!\n"); return; } @@ -872,14 +866,13 @@ static void mos7715_interrupt_callback(struct urb *urb) if (!(iir & 0x01)) { /* serial port interrupt pending */ switch (iir & 0x0f) { case SERIAL_IIR_RLS: - dbg("Serial Port: Receiver status error or address " - "bit detected in 9-bit mode\n"); + dev_dbg(dev, "Serial Port: Receiver status error or address bit detected in 9-bit mode\n\n"); break; case SERIAL_IIR_CTI: - dbg("Serial Port: Receiver time out"); + dev_dbg(dev, "Serial Port: Receiver time out\n"); break; case SERIAL_IIR_MS: - /* dbg("Serial Port: Modem status change"); */ + /* dev_dbg(dev, "Serial Port: Modem status change\n"); */ break; } } @@ -897,9 +890,7 @@ static void mos7715_interrupt_callback(struct urb *urb) exit: result = usb_submit_urb(urb, GFP_ATOMIC); if (result) - dev_err(&urb->dev->dev, - "%s - Error %d submitting control urb\n", - __func__, result); + dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result); } /* @@ -916,13 +907,13 @@ static void mos7720_bulk_in_callback(struct urb *urb) int status = urb->status; if (status) { - dbg("nonzero read bulk status received: %d", status); + dev_dbg(&urb->dev->dev, "nonzero read bulk status received: %d\n", status); return; } port = urb->context; - dbg("Entering...%s", __func__); + dev_dbg(&port->dev, "Entering...%s\n", __func__); data = urb->transfer_buffer; @@ -936,8 +927,7 @@ static void mos7720_bulk_in_callback(struct urb *urb) if (port->read_urb->status != -EINPROGRESS) { retval = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (retval) - dbg("usb_submit_urb(read bulk) failed, retval = %d", - retval); + dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, retval = %d\n", retval); } } @@ -953,13 +943,13 @@ static void mos7720_bulk_out_data_callback(struct urb *urb) int status = urb->status; if (status) { - dbg("nonzero write bulk status received:%d", status); + dev_dbg(&urb->dev->dev, "nonzero write bulk status received:%d\n", status); return; } mos7720_port = urb->context; if (!mos7720_port) { - dbg("NULL mos7720_port pointer"); + dev_dbg(&urb->dev->dev, "NULL mos7720_port pointer\n"); return ; } @@ -1061,9 +1051,7 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) port_number = port->number - port->serial->minor; read_mos_reg(serial, port_number, LSR, &data); - dbg("SS::%p LSR:%x", mos7720_port, data); - - dbg("Check:Sending Command .........."); + dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data); write_mos_reg(serial, dummy, SP1_REG, 0x02); write_mos_reg(serial, dummy, SP2_REG, 0x02); @@ -1122,20 +1110,16 @@ static int mos7720_chars_in_buffer(struct tty_struct *tty) int chars = 0; struct moschip_port *mos7720_port; - dbg("%s:entering ...........", __func__); - mos7720_port = usb_get_serial_port_data(port); - if (mos7720_port == NULL) { - dbg("%s:leaving ...........", __func__); + if (mos7720_port == NULL) return 0; - } for (i = 0; i < NUM_URBS; ++i) { if (mos7720_port->write_urb_pool[i] && mos7720_port->write_urb_pool[i]->status == -EINPROGRESS) chars += URB_TRANSFER_BUFFER_SIZE; } - dbg("%s - returns %d", __func__, chars); + dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); return chars; } @@ -1145,8 +1129,6 @@ static void mos7720_close(struct usb_serial_port *port) struct moschip_port *mos7720_port; int j; - dbg("mos7720_close:entering..."); - serial = port->serial; mos7720_port = usb_get_serial_port_data(port); @@ -1166,9 +1148,7 @@ static void mos7720_close(struct usb_serial_port *port) /* While closing port, shutdown all bulk read, write * * and interrupt read if they exists, otherwise nop */ - dbg("Shutdown bulk write"); usb_kill_urb(port->write_urb); - dbg("Shutdown bulk read"); usb_kill_urb(port->read_urb); mutex_lock(&serial->disc_mutex); @@ -1182,8 +1162,6 @@ static void mos7720_close(struct usb_serial_port *port) } mutex_unlock(&serial->disc_mutex); mos7720_port->open = 0; - - dbg("Leaving %s", __func__); } static void mos7720_break(struct tty_struct *tty, int break_state) @@ -1193,8 +1171,6 @@ static void mos7720_break(struct tty_struct *tty, int break_state) struct usb_serial *serial; struct moschip_port *mos7720_port; - dbg("Entering %s", __func__); - serial = port->serial; mos7720_port = usb_get_serial_port_data(port); @@ -1225,13 +1201,9 @@ static int mos7720_write_room(struct tty_struct *tty) int room = 0; int i; - dbg("%s:entering ...........", __func__); - mos7720_port = usb_get_serial_port_data(port); - if (mos7720_port == NULL) { - dbg("%s:leaving ...........", __func__); + if (mos7720_port == NULL) return -ENODEV; - } /* FIXME: Locking */ for (i = 0; i < NUM_URBS; ++i) { @@ -1240,7 +1212,7 @@ static int mos7720_write_room(struct tty_struct *tty) room += URB_TRANSFER_BUFFER_SIZE; } - dbg("%s - returns %d", __func__, room); + dev_dbg(&port->dev, "%s - returns %d\n", __func__, room); return room; } @@ -1257,15 +1229,11 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port, struct urb *urb; const unsigned char *current_position = data; - dbg("%s:entering ...........", __func__); - serial = port->serial; mos7720_port = usb_get_serial_port_data(port); - if (mos7720_port == NULL) { - dbg("mos7720_port is NULL"); + if (mos7720_port == NULL) return -ENODEV; - } /* try to find a free urb in the list */ urb = NULL; @@ -1274,13 +1242,13 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port, if (mos7720_port->write_urb_pool[i] && mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) { urb = mos7720_port->write_urb_pool[i]; - dbg("URB:%d", i); + dev_dbg(&port->dev, "URB:%d\n", i); break; } } if (urb == NULL) { - dbg("%s - no more free urbs", __func__); + dev_dbg(&port->dev, "%s - no more free urbs\n", __func__); goto exit; } @@ -1296,7 +1264,7 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port, transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE); memcpy(urb->transfer_buffer, current_position, transfer_size); - usb_serial_debug_data(debug, &port->dev, __func__, transfer_size, + usb_serial_debug_data(&port->dev, __func__, transfer_size, urb->transfer_buffer); /* fill urb with data and submit */ @@ -1326,20 +1294,16 @@ static void mos7720_throttle(struct tty_struct *tty) struct moschip_port *mos7720_port; int status; - dbg("%s- port %d", __func__, port->number); - mos7720_port = usb_get_serial_port_data(port); if (mos7720_port == NULL) return; if (!mos7720_port->open) { - dbg("port not opened"); + dev_dbg(&port->dev, "%s - port not opened\n", __func__); return; } - dbg("%s: Entering ..........", __func__); - /* if we are implementing XON/XOFF, send the stop character */ if (I_IXOFF(tty)) { unsigned char stop_char = STOP_CHAR(tty); @@ -1349,7 +1313,7 @@ static void mos7720_throttle(struct tty_struct *tty) } /* if we are implementing RTS/CTS, toggle that line */ - if (tty->termios->c_cflag & CRTSCTS) { + if (tty->termios.c_cflag & CRTSCTS) { mos7720_port->shadowMCR &= ~UART_MCR_RTS; write_mos_reg(port->serial, port->number - port->serial->minor, MCR, mos7720_port->shadowMCR); @@ -1368,12 +1332,10 @@ static void mos7720_unthrottle(struct tty_struct *tty) return; if (!mos7720_port->open) { - dbg("%s - port not opened", __func__); + dev_dbg(&port->dev, "%s - port not opened\n", __func__); return; } - dbg("%s: Entering ..........", __func__); - /* if we are implementing XON/XOFF, send the start character */ if (I_IXOFF(tty)) { unsigned char start_char = START_CHAR(tty); @@ -1383,7 +1345,7 @@ static void mos7720_unthrottle(struct tty_struct *tty) } /* if we are implementing RTS/CTS, toggle that line */ - if (tty->termios->c_cflag & CRTSCTS) { + if (tty->termios.c_cflag & CRTSCTS) { mos7720_port->shadowMCR |= UART_MCR_RTS; write_mos_reg(port->serial, port->number - port->serial->minor, MCR, mos7720_port->shadowMCR); @@ -1409,7 +1371,7 @@ static int set_higher_rates(struct moschip_port *mos7720_port, /*********************************************** * Init Sequence for higher rates ***********************************************/ - dbg("Sending Setting Commands .........."); + dev_dbg(&port->dev, "Sending Setting Commands ..........\n"); port_number = port->number - port->serial->minor; write_mos_reg(serial, port_number, IER, 0x00); @@ -1478,7 +1440,7 @@ static struct divisor_table_entry divisor_table[] = { * this function calculates the proper baud rate divisor for the specified * baud rate. *****************************************************************************/ -static int calc_baud_rate_divisor(int baudrate, int *divisor) +static int calc_baud_rate_divisor(struct usb_serial_port *port, int baudrate, int *divisor) { int i; __u16 custom; @@ -1486,7 +1448,7 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor) __u16 round; - dbg("%s - %d", __func__, baudrate); + dev_dbg(&port->dev, "%s - %d\n", __func__, baudrate); for (i = 0; i < ARRAY_SIZE(divisor_table); i++) { if (divisor_table[i].baudrate == baudrate) { @@ -1508,11 +1470,11 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor) custom++; *divisor = custom; - dbg("Baud %d = %d", baudrate, custom); + dev_dbg(&port->dev, "Baud %d = %d\n", baudrate, custom); return 0; } - dbg("Baud calculation Failed..."); + dev_dbg(&port->dev, "Baud calculation Failed...\n"); return -EINVAL; } @@ -1536,13 +1498,11 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port, port = mos7720_port->port; serial = port->serial; - dbg("%s: Entering ..........", __func__); - number = port->number - port->serial->minor; - dbg("%s - port = %d, baud = %d", __func__, port->number, baudrate); + dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudrate); /* Calculate the Divisor */ - status = calc_baud_rate_divisor(baudrate, &divisor); + status = calc_baud_rate_divisor(port, baudrate, &divisor); if (status) { dev_err(&port->dev, "%s - bad baud rate\n", __func__); return status; @@ -1591,21 +1551,17 @@ static void change_port_settings(struct tty_struct *tty, serial = port->serial; port_number = port->number - port->serial->minor; - dbg("%s - port %d", __func__, port->number); - if (!mos7720_port->open) { - dbg("%s - port not opened", __func__); + dev_dbg(&port->dev, "%s - port not opened\n", __func__); return; } - dbg("%s: Entering ..........", __func__); - lData = UART_LCR_WLEN8; lStop = 0x00; /* 1 stop bit */ lParity = 0x00; /* No parity */ - cflag = tty->termios->c_cflag; - iflag = tty->termios->c_iflag; + cflag = tty->termios.c_cflag; + iflag = tty->termios.c_iflag; /* Change the number of bits */ switch (cflag & CSIZE) { @@ -1633,14 +1589,14 @@ static void change_port_settings(struct tty_struct *tty, if (cflag & PARENB) { if (cflag & PARODD) { lParity = UART_LCR_PARITY; - dbg("%s - parity = odd", __func__); + dev_dbg(&port->dev, "%s - parity = odd\n", __func__); } else { lParity = (UART_LCR_EPAR | UART_LCR_PARITY); - dbg("%s - parity = even", __func__); + dev_dbg(&port->dev, "%s - parity = even\n", __func__); } } else { - dbg("%s - parity = none", __func__); + dev_dbg(&port->dev, "%s - parity = none\n", __func__); } if (cflag & CMSPAR) @@ -1649,10 +1605,10 @@ static void change_port_settings(struct tty_struct *tty, /* Change the Stop bit */ if (cflag & CSTOPB) { lStop = UART_LCR_STOP; - dbg("%s - stop bits = 2", __func__); + dev_dbg(&port->dev, "%s - stop bits = 2\n", __func__); } else { lStop = 0x00; - dbg("%s - stop bits = 1", __func__); + dev_dbg(&port->dev, "%s - stop bits = 1\n", __func__); } #define LCR_BITS_MASK 0x03 /* Mask for bits/char field */ @@ -1698,7 +1654,7 @@ static void change_port_settings(struct tty_struct *tty, baud = tty_get_baud_rate(tty); if (!baud) { /* pick a default, any default... */ - dbg("Picked default baud..."); + dev_dbg(&port->dev, "Picked default baud...\n"); baud = 9600; } @@ -1709,7 +1665,7 @@ static void change_port_settings(struct tty_struct *tty, return; } - dbg("%s - baud rate = %d", __func__, baud); + dev_dbg(&port->dev, "%s - baud rate = %d\n", __func__, baud); status = send_cmd_write_baud_rate(mos7720_port, baud); /* FIXME: needs to write actual resulting baud back not just blindly do so */ @@ -1721,8 +1677,7 @@ static void change_port_settings(struct tty_struct *tty, if (port->read_urb->status != -EINPROGRESS) { status = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (status) - dbg("usb_submit_urb(read bulk) failed, status = %d", - status); + dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status); } } @@ -1747,23 +1702,19 @@ static void mos7720_set_termios(struct tty_struct *tty, return; if (!mos7720_port->open) { - dbg("%s - port not opened", __func__); + dev_dbg(&port->dev, "%s - port not opened\n", __func__); return; } - dbg("%s\n", "setting termios - ASPIRE"); + dev_dbg(&port->dev, "setting termios - ASPIRE\n"); - cflag = tty->termios->c_cflag; + cflag = tty->termios.c_cflag; - dbg("%s - cflag %08x iflag %08x", __func__, - tty->termios->c_cflag, - RELEVANT_IFLAG(tty->termios->c_iflag)); + dev_dbg(&port->dev, "%s - cflag %08x iflag %08x\n", __func__, + tty->termios.c_cflag, RELEVANT_IFLAG(tty->termios.c_iflag)); - dbg("%s - old cflag %08x old iflag %08x", __func__, - old_termios->c_cflag, - RELEVANT_IFLAG(old_termios->c_iflag)); - - dbg("%s - port %d", __func__, port->number); + dev_dbg(&port->dev, "%s - old cflag %08x old iflag %08x\n", __func__, + old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag)); /* change the port settings to the new ones specified */ change_port_settings(tty, mos7720_port, old_termios); @@ -1771,8 +1722,7 @@ static void mos7720_set_termios(struct tty_struct *tty, if (port->read_urb->status != -EINPROGRESS) { status = usb_submit_urb(port->read_urb, GFP_ATOMIC); if (status) - dbg("usb_submit_urb(read bulk) failed, status = %d", - status); + dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status); } } @@ -1800,7 +1750,7 @@ static int get_lsr_info(struct tty_struct *tty, read_mos_reg(port->serial, port_number, LSR, &data); if ((data & (UART_LSR_TEMT | UART_LSR_THRE)) == (UART_LSR_TEMT | UART_LSR_THRE)) { - dbg("%s -- Empty", __func__); + dev_dbg(&port->dev, "%s -- Empty\n", __func__); result = TIOCSER_TEMT; } } @@ -1817,8 +1767,6 @@ static int mos7720_tiocmget(struct tty_struct *tty) unsigned int mcr ; unsigned int msr ; - dbg("%s - port %d", __func__, port->number); - mcr = mos7720_port->shadowMCR; msr = mos7720_port->shadowMSR; @@ -1829,8 +1777,6 @@ static int mos7720_tiocmget(struct tty_struct *tty) | ((msr & UART_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */ | ((msr & UART_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */ - dbg("%s -- %x", __func__, result); - return result; } @@ -1840,8 +1786,6 @@ static int mos7720_tiocmset(struct tty_struct *tty, struct usb_serial_port *port = tty->driver_data; struct moschip_port *mos7720_port = usb_get_serial_port_data(port); unsigned int mcr ; - dbg("%s - port %d", __func__, port->number); - dbg("he was at tiocmset"); mcr = mos7720_port->shadowMCR; @@ -1888,8 +1832,8 @@ static int mos7720_get_icount(struct tty_struct *tty, icount->brk = cnow.brk; icount->buf_overrun = cnow.buf_overrun; - dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, - port->number, icount->rx, icount->tx); + dev_dbg(&port->dev, "%s TIOCGICOUNT RX=%d, TX=%d\n", __func__, + icount->rx, icount->tx); return 0; } @@ -1975,29 +1919,28 @@ static int mos7720_ioctl(struct tty_struct *tty, if (mos7720_port == NULL) return -ENODEV; - dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); + dev_dbg(&port->dev, "%s - cmd = 0x%x", __func__, cmd); switch (cmd) { case TIOCSERGETLSR: - dbg("%s (%d) TIOCSERGETLSR", __func__, port->number); + dev_dbg(&port->dev, "%s TIOCSERGETLSR\n", __func__); return get_lsr_info(tty, mos7720_port, (unsigned int __user *)arg); /* FIXME: These should be using the mode methods */ case TIOCMBIS: case TIOCMBIC: - dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", - __func__, port->number); + dev_dbg(&port->dev, "%s TIOCMSET/TIOCMBIC/TIOCMSET\n", __func__); return set_modem_info(mos7720_port, cmd, (unsigned int __user *)arg); case TIOCGSERIAL: - dbg("%s (%d) TIOCGSERIAL", __func__, port->number); + dev_dbg(&port->dev, "%s TIOCGSERIAL\n", __func__); return get_serial_info(mos7720_port, (struct serial_struct __user *)arg); case TIOCMIWAIT: - dbg("%s (%d) TIOCMIWAIT", __func__, port->number); + dev_dbg(&port->dev, "%s TIOCMIWAIT\n", __func__); cprev = mos7720_port->icount; while (1) { if (signal_pending(current)) @@ -2030,13 +1973,6 @@ static int mos7720_startup(struct usb_serial *serial) u16 product; int ret_val; - dbg("%s: Entering ..........", __func__); - - if (!serial) { - dbg("Invalid Handler"); - return -ENODEV; - } - product = le16_to_cpu(serial->dev->descriptor.idProduct); dev = serial->dev; @@ -2081,8 +2017,8 @@ static int mos7720_startup(struct usb_serial *serial) mos7720_port->port = serial->port[i]; usb_set_serial_port_data(serial->port[i], mos7720_port); - dbg("port number is %d", serial->port[i]->number); - dbg("serial number is %d", serial->minor); + dev_dbg(&dev->dev, "port number is %d\n", serial->port[i]->number); + dev_dbg(&dev->dev, "serial number is %d\n", serial->minor); } @@ -2106,7 +2042,7 @@ static int mos7720_startup(struct usb_serial *serial) #endif /* LSR For Port 1 */ read_mos_reg(serial, 0, LSR, &data); - dbg("LSR:%x", data); + dev_dbg(&dev->dev, "LSR:%x\n", data); return 0; } @@ -2195,6 +2131,3 @@ module_usb_serial_driver(serial_drivers, id_table); MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); - -module_param(debug, bool, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(debug, "Debug enabled or not"); |