From: Greg Kroah-Hartman Date: Thu, 8 Mar 2012 22:16:12 +0000 (-0800) Subject: USB: serial: metro-usb: move to use dev_dbg() instead of dbg() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5db51b50c10f3bf56d5c636832c5556ead90562d;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git USB: serial: metro-usb: move to use dev_dbg() instead of dbg() This properly ties the driver into the dynamic debug system and provides the needed device identification when the messages are printed out. It also removes a ton of checkpatch warnings as well, which is always a nice validation that it's the correct thing to do. Cc: Aleksey Babahin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 6b7d2779148c..6e1622f2a297 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c @@ -66,7 +66,7 @@ static void metrousb_read_int_callback(struct urb *urb) int result = 0; unsigned long flags = 0; - dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); + dev_dbg(&port->dev, "%s\n", __func__); switch (urb->status) { case 0: @@ -76,12 +76,14 @@ static void metrousb_read_int_callback(struct urb *urb) case -ENOENT: case -ESHUTDOWN: /* urb has been terminated. */ - dbg("METRO-USB - %s - urb shutting down, port number=%d, error code=%d", - __FUNCTION__, port->number, result); + dev_dbg(&port->dev, + "%s - urb shutting down, error code=%d\n", + __func__, result); return; default: - dbg("METRO-USB - %s - non-zero urb received, port number=%d, error code=%d", - __FUNCTION__, port->number, result); + dev_dbg(&port->dev, + "%s - non-zero urb received, error code=%d\n", + __func__, result); goto exit; } @@ -89,7 +91,8 @@ static void metrousb_read_int_callback(struct urb *urb) /* Set the data read from the usb port into the serial port buffer. */ tty = tty_port_tty_get(&port->port); if (!tty) { - dbg("%s - bad tty pointer - exiting", __func__); + dev_dbg(&port->dev, "%s - bad tty pointer - exiting\n", + __func__); return; } @@ -117,25 +120,25 @@ static void metrousb_read_int_callback(struct urb *urb) result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); - if (result) { - dbg("METRO-USB - %s - failed submitting interrupt in urb for port number=%d, error code=%d", - __FUNCTION__, port->number, result); - } + if (result) + dev_dbg(&port->dev, + "%s - failed submitting interrupt in urb, error code=%d\n", + __func__, result); } return; exit: /* Try to resubmit the urb. */ result = usb_submit_urb(urb, GFP_ATOMIC); - if (result) { - dbg("METRO-USB - %s - failed submitting interrupt in urb for port number=%d, error code=%d", - __FUNCTION__, port->number, result); - } + if (result) + dev_dbg(&port->dev, + "%s - failed submitting interrupt in urb, error code=%d\n", + __func__, result); } static void metrousb_cleanup(struct usb_serial_port *port) { - dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); + dev_dbg(&port->dev, "%s\n", __func__); if (port->serial->dev) { /* Shutdown any interrupt in urbs. */ @@ -153,11 +156,12 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) unsigned long flags = 0; int result = 0; - dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); + dev_dbg(&port->dev, "%s\n", __func__); /* Make sure the urb is initialized. */ if (!port->interrupt_in_urb) { - dbg("METRO-USB - %s - interrupt urb not initialized for port number=%d", __FUNCTION__, port->number); + dev_dbg(&port->dev, "%s - interrupt urb not initialized\n", + __func__); return -ENODEV; } @@ -187,12 +191,13 @@ static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port) result = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); if (result) { - dbg("METRO-USB - %s - failed submitting interrupt in urb for port number=%d, error code=%d" - , __FUNCTION__, port->number, result); + dev_dbg(&port->dev, + "%s - failed submitting interrupt in urb, error code=%d\n", + __func__, result); goto exit; } - dbg("METRO-USB - %s - port open for port number=%d", __FUNCTION__, port->number); + dev_dbg(&port->dev, "%s - port open\n", __func__); exit: return result; } @@ -202,7 +207,8 @@ static int metrousb_set_modem_ctrl(struct usb_serial *serial, unsigned int contr int retval = 0; unsigned char mcr = METROUSB_MCR_NONE; - dbg("METRO-USB - %s - control state=%d", __FUNCTION__, control_state); + dev_dbg(&serial->dev->dev, "%s - control state = %d\n", + __func__, control_state); /* Set the modem control value. */ if (control_state & TIOCM_DTR) @@ -215,7 +221,9 @@ static int metrousb_set_modem_ctrl(struct usb_serial *serial, unsigned int contr METROUSB_SET_REQUEST_TYPE, METROUSB_SET_MODEM_CTRL_REQUEST, control_state, 0, NULL, 0, WDR_TIMEOUT); if (retval < 0) - dbg("METRO-USB - %s - set modem ctrl=0x%x failed, error code=%d", __FUNCTION__, mcr, retval); + dev_dbg(&serial->dev->dev, + "%s - set modem ctrl=0x%x failed, error code=%d\n", + __func__, mcr, retval); return retval; } @@ -224,7 +232,7 @@ static void metrousb_shutdown(struct usb_serial *serial) { int i = 0; - dbg("METRO-USB - %s", __FUNCTION__); + dev_dbg(&serial->dev->dev, "%s\n", __func__); /* Stop reading and writing on all ports. */ for (i = 0; i < serial->num_ports; ++i) { @@ -235,7 +243,8 @@ static void metrousb_shutdown(struct usb_serial *serial) kfree(usb_get_serial_port_data(serial->port[i])); usb_set_serial_port_data(serial->port[i], NULL); - dbg("METRO-USB - %s - freed port number=%d", __FUNCTION__, serial->port[i]->number); + dev_dbg(&serial->dev->dev, "%s - freed port number=%d\n", + __func__, serial->port[i]->number); } } @@ -245,7 +254,7 @@ static int metrousb_startup(struct usb_serial *serial) struct usb_serial_port *port; int i = 0; - dbg("METRO-USB - %s", __FUNCTION__); + dev_dbg(&serial->dev->dev, "%s\n", __func__); /* Loop through the serial ports setting up the private structures. * Currently we only use one port. */ @@ -261,7 +270,8 @@ static int metrousb_startup(struct usb_serial *serial) spin_lock_init(&metro_priv->lock); usb_set_serial_port_data(port, metro_priv); - dbg("METRO-USB - %s - port number=%d.", __FUNCTION__, port->number); + dev_dbg(&serial->dev->dev, "%s - port number=%d\n ", + __func__, port->number); } return 0; @@ -273,7 +283,7 @@ static void metrousb_throttle(struct tty_struct *tty) struct metrousb_private *metro_priv = usb_get_serial_port_data(port); unsigned long flags = 0; - dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); + dev_dbg(tty->dev, "%s\n", __func__); /* Set the private information for the port to stop reading data. */ spin_lock_irqsave(&metro_priv->lock, flags); @@ -288,7 +298,7 @@ static int metrousb_tiocmget(struct tty_struct *tty) struct metrousb_private *metro_priv = usb_get_serial_port_data(port); unsigned long flags = 0; - dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); + dev_dbg(tty->dev, "%s\n", __func__); spin_lock_irqsave(&metro_priv->lock, flags); control_state = metro_priv->control_state; @@ -306,7 +316,7 @@ static int metrousb_tiocmset(struct tty_struct *tty, unsigned long flags = 0; unsigned long control_state = 0; - dbg("METRO-USB - %s - port number=%d, set=%d, clear=%d", __FUNCTION__, port->number, set, clear); + dev_dbg(tty->dev, "%s - set=%d, clear=%d\n", __func__, set, clear); spin_lock_irqsave(&metro_priv->lock, flags); control_state = metro_priv->control_state; @@ -333,7 +343,7 @@ static void metrousb_unthrottle(struct tty_struct *tty) unsigned long flags = 0; int result = 0; - dbg("METRO-USB - %s - port number=%d", __FUNCTION__, port->number); + dev_dbg(tty->dev, "%s\n", __func__); /* Set the private information for the port to resume reading data. */ spin_lock_irqsave(&metro_priv->lock, flags); @@ -343,10 +353,10 @@ static void metrousb_unthrottle(struct tty_struct *tty) /* Submit the urb to read from the port. */ port->interrupt_in_urb->dev = port->serial->dev; result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); - if (result) { - dbg("METRO-USB - %s - failed submitting interrupt in urb for port number=%d, error code=%d", - __FUNCTION__, port->number, result); - } + if (result) + dev_dbg(tty->dev, + "failed submitting interrupt in urb error code=%d\n", + result); } static struct usb_driver metrousb_driver = {