diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-14 15:08:36 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-14 15:08:36 -0700 |
commit | d53839cf446c93dddea92d83e9a0c8afc1a8dbba (patch) | |
tree | 1e1b0bc87fcfb10381fdbb4896a48b2d4b9d15a3 /drivers/usb/serial/ti_usb_3410_5052.c | |
parent | 9eecf8085473c9bbe77d35ee84928696185cceed (diff) | |
download | lwn-d53839cf446c93dddea92d83e9a0c8afc1a8dbba.tar.gz lwn-d53839cf446c93dddea92d83e9a0c8afc1a8dbba.zip |
USB: serial: ti_usb_3410_5052.c: remove dbg() usage
dbg() was a very old USB-serial-specific macro.
This patch removes it from being used in the
driver and uses dev_dbg() instead.
CC: Johan Hovold <jhovold@gmail.com>
CC: Rusty Russell <rusty@rustcorp.com.au>
CC: Adhir Ramjiawan <adhirramjiawan0@gmail.com>
CC: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/ti_usb_3410_5052.c')
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 129 |
1 files changed, 64 insertions, 65 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index a4404f5ad68e..0b113fa48eed 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -141,8 +141,8 @@ static int ti_command_out_sync(struct ti_device *tdev, __u8 command, static int ti_command_in_sync(struct ti_device *tdev, __u8 command, __u16 moduleid, __u16 value, __u8 *data, int size); -static int ti_write_byte(struct ti_device *tdev, unsigned long addr, - __u8 mask, __u8 byte); +static int ti_write_byte(struct usb_serial_port *port, struct ti_device *tdev, + unsigned long addr, __u8 mask, __u8 byte); static int ti_download_firmware(struct ti_device *tdev); @@ -364,10 +364,11 @@ static int ti_startup(struct usb_serial *serial) int i; - dbg("%s - product 0x%4X, num configurations %d, configuration value %d", - __func__, le16_to_cpu(dev->descriptor.idProduct), - dev->descriptor.bNumConfigurations, - dev->actconfig->desc.bConfigurationValue); + dev_dbg(&dev->dev, + "%s - product 0x%4X, num configurations %d, configuration value %d", + __func__, le16_to_cpu(dev->descriptor.idProduct), + dev->descriptor.bNumConfigurations, + dev->actconfig->desc.bConfigurationValue); /* create device structure */ tdev = kzalloc(sizeof(struct ti_device), GFP_KERNEL); @@ -382,8 +383,8 @@ static int ti_startup(struct usb_serial *serial) /* determine device type */ if (usb_match_id(serial->interface, ti_id_table_3410)) tdev->td_is_3410 = 1; - dbg("%s - device type is %s", __func__, - tdev->td_is_3410 ? "3410" : "5052"); + dev_dbg(&dev->dev, "%s - device type is %s\n", __func__, + tdev->td_is_3410 ? "3410" : "5052"); /* if we have only 1 configuration, download firmware */ if (dev->descriptor.bNumConfigurations == 1) { @@ -501,20 +502,17 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) /* start interrupt urb the first time a port is opened on this device */ if (tdev->td_open_port_count == 0) { - dbg("%s - start interrupt in urb", __func__); + dev_dbg(&port->dev, "%s - start interrupt in urb\n", __func__); urb = tdev->td_serial->port[0]->interrupt_in_urb; if (!urb) { - dev_err(&port->dev, "%s - no interrupt urb\n", - __func__); + dev_err(&port->dev, "%s - no interrupt urb\n", __func__); status = -EINVAL; goto release_lock; } urb->context = tdev; status = usb_submit_urb(urb, GFP_KERNEL); if (status) { - dev_err(&port->dev, - "%s - submit interrupt urb failed, %d\n", - __func__, status); + dev_err(&port->dev, "%s - submit interrupt urb failed, %d\n", __func__, status); goto release_lock; } } @@ -522,16 +520,16 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) if (tty) ti_set_termios(tty, port, tty->termios); - dbg("%s - sending TI_OPEN_PORT", __func__); + dev_dbg(&port->dev, "%s - sending TI_OPEN_PORT\n", __func__); status = ti_command_out_sync(tdev, TI_OPEN_PORT, (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); if (status) { dev_err(&port->dev, "%s - cannot send open command, %d\n", - __func__, status); + __func__, status); goto unlink_int_urb; } - dbg("%s - sending TI_START_PORT", __func__); + dev_dbg(&port->dev, "%s - sending TI_START_PORT\n", __func__); status = ti_command_out_sync(tdev, TI_START_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) { @@ -540,7 +538,7 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) goto unlink_int_urb; } - dbg("%s - sending TI_PURGE_PORT", __func__); + dev_dbg(&port->dev, "%s - sending TI_PURGE_PORT\n", __func__); status = ti_command_out_sync(tdev, TI_PURGE_PORT, (__u8)(TI_UART1_PORT + port_number), TI_PURGE_INPUT, NULL, 0); if (status) { @@ -564,7 +562,7 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) if (tty) ti_set_termios(tty, port, tty->termios); - dbg("%s - sending TI_OPEN_PORT (2)", __func__); + dev_dbg(&port->dev, "%s - sending TI_OPEN_PORT (2)\n", __func__); status = ti_command_out_sync(tdev, TI_OPEN_PORT, (__u8)(TI_UART1_PORT + port_number), open_settings, NULL, 0); if (status) { @@ -573,7 +571,7 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) goto unlink_int_urb; } - dbg("%s - sending TI_START_PORT (2)", __func__); + dev_dbg(&port->dev, "%s - sending TI_START_PORT (2)\n", __func__); status = ti_command_out_sync(tdev, TI_START_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) { @@ -583,7 +581,7 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) } /* start read urb */ - dbg("%s - start read urb", __func__); + dev_dbg(&port->dev, "%s - start read urb\n", __func__); urb = port->read_urb; if (!urb) { dev_err(&port->dev, "%s - no read urb\n", __func__); @@ -609,7 +607,7 @@ unlink_int_urb: usb_kill_urb(port->serial->port[0]->interrupt_in_urb); release_lock: mutex_unlock(&tdev->td_open_close_lock); - dbg("%s - exit %d", __func__, status); + dev_dbg(&port->dev, "%s - exit %d\n", __func__, status); return status; } @@ -637,7 +635,7 @@ static void ti_close(struct usb_serial_port *port) port_number = port->number - port->serial->minor; - dbg("%s - sending TI_CLOSE_PORT", __func__); + dev_dbg(&port->dev, "%s - sending TI_CLOSE_PORT\n", __func__); status = ti_command_out_sync(tdev, TI_CLOSE_PORT, (__u8)(TI_UART1_PORT + port_number), 0, NULL, 0); if (status) @@ -664,7 +662,7 @@ static int ti_write(struct tty_struct *tty, struct usb_serial_port *port, struct ti_port *tport = usb_get_serial_port_data(port); if (count == 0) { - dbg("%s - write request of 0 bytes", __func__); + dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__); return 0; } @@ -693,7 +691,7 @@ static int ti_write_room(struct tty_struct *tty) room = kfifo_avail(&tport->write_fifo); spin_unlock_irqrestore(&tport->tp_lock, flags); - dbg("%s - returns %d", __func__, room); + dev_dbg(&port->dev, "%s - returns %d\n", __func__, room); return room; } @@ -712,7 +710,7 @@ static int ti_chars_in_buffer(struct tty_struct *tty) chars = kfifo_len(&tport->write_fifo); spin_unlock_irqrestore(&tport->tp_lock, flags); - dbg("%s - returns %d", __func__, chars); + dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); return chars; } @@ -755,8 +753,7 @@ static int ti_get_icount(struct tty_struct *tty, struct ti_port *tport = usb_get_serial_port_data(port); struct async_icount cnow = tport->tp_icount; - dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", - __func__, port->number, + dev_dbg(&port->dev, "%s - TIOCGICOUNT RX=%d, TX=%d\n", __func__, cnow.rx, cnow.tx); icount->cts = cnow.cts; @@ -782,22 +779,22 @@ static int ti_ioctl(struct tty_struct *tty, struct async_icount cnow; struct async_icount cprev; - dbg("%s - port %d, cmd = 0x%04X", __func__, port->number, cmd); + dev_dbg(&port->dev, "%s - cmd = 0x%04X\n", __func__, cmd); if (tport == NULL) return -ENODEV; switch (cmd) { case TIOCGSERIAL: - dbg("%s - (%d) TIOCGSERIAL", __func__, port->number); + dev_dbg(&port->dev, "%s - TIOCGSERIAL\n", __func__); return ti_get_serial_info(tport, (struct serial_struct __user *)arg); case TIOCSSERIAL: - dbg("%s - (%d) TIOCSSERIAL", __func__, port->number); + dev_dbg(&port->dev, "%s - TIOCSSERIAL\n", __func__); return ti_set_serial_info(tty, tport, (struct serial_struct __user *)arg); case TIOCMIWAIT: - dbg("%s - (%d) TIOCMIWAIT", __func__, port->number); + dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); cprev = tport->tp_icount; while (1) { interruptible_sleep_on(&tport->tp_msr_wait); @@ -834,9 +831,9 @@ static void ti_set_termios(struct tty_struct *tty, cflag = tty->termios->c_cflag; iflag = tty->termios->c_iflag; - dbg("%s - cflag %08x, iflag %08x", __func__, cflag, iflag); - dbg("%s - old clfag %08x, old iflag %08x", __func__, - old_termios->c_cflag, old_termios->c_iflag); + dev_dbg(&port->dev, "%s - cflag %08x, iflag %08x\n", __func__, cflag, iflag); + dev_dbg(&port->dev, "%s - old clfag %08x, old iflag %08x\n", __func__, + old_termios->c_cflag, old_termios->c_iflag); if (tport == NULL) return; @@ -926,8 +923,11 @@ static void ti_set_termios(struct tty_struct *tty, if ((cflag & CBAUD) != B0) tty_encode_baud_rate(tty, baud, baud); - dbg("%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d", - __func__, baud, config->wBaudRate, config->wFlags, config->bDataBits, config->bParity, config->bStopBits, config->cXon, config->cXoff, config->bUartMode); + dev_dbg(&port->dev, + "%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d", + __func__, baud, config->wBaudRate, config->wFlags, + config->bDataBits, config->bParity, config->bStopBits, + config->cXon, config->cXoff, config->bUartMode); cpu_to_be16s(&config->wBaudRate); cpu_to_be16s(&config->wFlags); @@ -979,7 +979,7 @@ static int ti_tiocmget(struct tty_struct *tty) | ((msr & TI_MSR_RI) ? TIOCM_RI : 0) | ((msr & TI_MSR_DSR) ? TIOCM_DSR : 0); - dbg("%s - 0x%04X", __func__, result); + dev_dbg(&port->dev, "%s - 0x%04X\n", __func__, result); return result; } @@ -1024,19 +1024,19 @@ static void ti_break(struct tty_struct *tty, int break_state) struct ti_port *tport = usb_get_serial_port_data(port); int status; - dbg("%s - state = %d", __func__, break_state); + dev_dbg(&port->dev, "%s - state = %d\n", __func__, break_state); if (tport == NULL) return; ti_drain(tport, (tport->tp_closing_wait*HZ)/100, 0); - status = ti_write_byte(tport->tp_tdev, + status = ti_write_byte(port, tport->tp_tdev, tport->tp_uart_base_addr + TI_UART_OFFSET_LCR, TI_LCR_BREAK, break_state == -1 ? TI_LCR_BREAK : 0); if (status) - dbg("%s - error setting break, %d", __func__, status); + dev_dbg(&port->dev, "%s - error setting break, %d\n", __func__, status); } @@ -1061,18 +1061,17 @@ static void ti_interrupt_callback(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dbg("%s - urb shutting down, %d", __func__, status); + dev_dbg(dev, "%s - urb shutting down, %d\n", __func__, status); tdev->td_urb_error = 1; return; default: - dev_err(dev, "%s - nonzero urb status, %d\n", - __func__, status); + dev_err(dev, "%s - nonzero urb status, %d\n", __func__, status); tdev->td_urb_error = 1; goto exit; } if (length != 2) { - dbg("%s - bad packet size, %d", __func__, length); + dev_dbg(dev, "%s - bad packet size, %d\n", __func__, length); goto exit; } @@ -1084,8 +1083,8 @@ static void ti_interrupt_callback(struct urb *urb) port_number = TI_GET_PORT_FROM_CODE(data[0]); function = TI_GET_FUNC_FROM_CODE(data[0]); - dbg("%s - port_number %d, function %d, data 0x%02X", - __func__, port_number, function, data[1]); + dev_dbg(dev, "%s - port_number %d, function %d, data 0x%02X\n", + __func__, port_number, function, data[1]); if (port_number >= serial->num_ports) { dev_err(dev, "%s - bad port number, %d\n", @@ -1102,12 +1101,12 @@ static void ti_interrupt_callback(struct urb *urb) switch (function) { case TI_CODE_DATA_ERROR: dev_err(dev, "%s - DATA ERROR, port %d, data 0x%02X\n", - __func__, port_number, data[1]); + __func__, port_number, data[1]); break; case TI_CODE_MODEM_STATUS: msr = data[1]; - dbg("%s - port %d, msr 0x%02X", __func__, port_number, msr); + dev_dbg(dev, "%s - port %d, msr 0x%02X\n", __func__, port_number, msr); ti_handle_new_msr(tport, msr); break; @@ -1140,7 +1139,7 @@ static void ti_bulk_in_callback(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dbg("%s - urb shutting down, %d", __func__, status); + dev_dbg(dev, "%s - urb shutting down, %d\n", __func__, status); tport->tp_tdev->td_urb_error = 1; wake_up_interruptible(&tport->tp_write_wait); return; @@ -1166,7 +1165,7 @@ static void ti_bulk_in_callback(struct urb *urb) urb->actual_length, urb->transfer_buffer); if (!tport->tp_is_open) - dbg("%s - port closed, dropping data", + dev_dbg(dev, "%s - port closed, dropping data\n", __func__); else ti_recv(&urb->dev->dev, tty, @@ -1208,7 +1207,7 @@ static void ti_bulk_out_callback(struct urb *urb) case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: - dbg("%s - urb shutting down, %d", __func__, status); + dev_dbg(&port->dev, "%s - urb shutting down, %d\n", __func__, status); tport->tp_tdev->td_urb_error = 1; wake_up_interruptible(&tport->tp_write_wait); return; @@ -1307,7 +1306,7 @@ static int ti_set_mcr(struct ti_port *tport, unsigned int mcr) unsigned long flags; int status; - status = ti_write_byte(tport->tp_tdev, + status = ti_write_byte(tport->tp_port, tport->tp_tdev, tport->tp_uart_base_addr + TI_UART_OFFSET_MCR, TI_MCR_RTS | TI_MCR_DTR | TI_MCR_LOOP, mcr); @@ -1344,7 +1343,7 @@ static int ti_get_lsr(struct ti_port *tport) goto free_data; } - dbg("%s - lsr 0x%02X", __func__, data->bLSR); + dev_dbg(&port->dev, "%s - lsr 0x%02X\n", __func__, data->bLSR); tport->tp_lsr = data->bLSR; @@ -1401,7 +1400,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr) struct tty_struct *tty; unsigned long flags; - dbg("%s - msr 0x%02X", __func__, msr); + dev_dbg(&tport->tp_port->dev, "%s - msr 0x%02X\n", __func__, msr); if (msr & TI_MSR_DELTA_MASK) { spin_lock_irqsave(&tport->tp_lock, flags); @@ -1560,21 +1559,21 @@ static int ti_command_in_sync(struct ti_device *tdev, __u8 command, } -static int ti_write_byte(struct ti_device *tdev, unsigned long addr, - __u8 mask, __u8 byte) +static int ti_write_byte(struct usb_serial_port *port, + struct ti_device *tdev, unsigned long addr, + __u8 mask, __u8 byte) { int status; unsigned int size; struct ti_write_data_bytes *data; - struct device *dev = &tdev->td_serial->dev->dev; - dbg("%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X", - __func__, addr, mask, byte); + dev_dbg(&port->dev, "%s - addr 0x%08lX, mask 0x%02X, byte 0x%02X\n", __func__, + addr, mask, byte); size = sizeof(struct ti_write_data_bytes) + 2; data = kmalloc(size, GFP_KERNEL); if (!data) { - dev_err(dev, "%s - out of memory\n", __func__); + dev_err(&port->dev, "%s - out of memory\n", __func__); return -ENOMEM; } @@ -1590,7 +1589,7 @@ static int ti_write_byte(struct ti_device *tdev, unsigned long addr, (__u8 *)data, size); if (status < 0) - dev_err(dev, "%s - failed, %d\n", __func__, status); + dev_err(&port->dev, "%s - failed, %d\n", __func__, status); kfree(data); @@ -1615,7 +1614,7 @@ static int ti_do_download(struct usb_device *dev, int pipe, - sizeof(struct ti_firmware_header))); header->bCheckSum = cs; - dbg("%s - downloading firmware", __func__); + dev_dbg(&dev->dev, "%s - downloading firmware\n", __func__); for (pos = 0; pos < size; pos += done) { len = min(size - pos, TI_DOWNLOAD_MAX_PACKET_SIZE); status = usb_bulk_msg(dev, pipe, buffer + pos, len, @@ -1691,7 +1690,7 @@ static int ti_download_firmware(struct ti_device *tdev) status = ti_do_download(dev, pipe, buffer, fw_p->size); kfree(buffer); } else { - dbg("%s ENOMEM\n", __func__); + dev_dbg(&dev->dev, "%s ENOMEM\n", __func__); status = -ENOMEM; } release_firmware(fw_p); @@ -1701,7 +1700,7 @@ static int ti_download_firmware(struct ti_device *tdev) return status; } - dbg("%s - download successful", __func__); + dev_dbg(&dev->dev, "%s - download successful\n", __func__); return 0; } |