USB: serial: ftdi_sio.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: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> CC: Simon Arlott <simon@fire.lp0.eu> CC: Andrew Worsley <amworsley@gmail.com> CC: "Michał Wróbel" <michal.wrobel@flytronic.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
f9dfbebb8b
commit
bfc51614b3
1 changed files with 60 additions and 59 deletions
|
@ -1043,11 +1043,12 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set,
|
|||
unsigned int clear)
|
||||
{
|
||||
struct ftdi_private *priv = usb_get_serial_port_data(port);
|
||||
struct device *dev = &port->dev;
|
||||
unsigned urb_value;
|
||||
int rv;
|
||||
|
||||
if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) {
|
||||
dbg("%s - DTR|RTS not being set|cleared", __func__);
|
||||
dev_dbg(dev, "%s - DTR|RTS not being set|cleared\n", __func__);
|
||||
return 0; /* no change */
|
||||
}
|
||||
|
||||
|
@ -1068,18 +1069,14 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set,
|
|||
urb_value, priv->interface,
|
||||
NULL, 0, WDR_TIMEOUT);
|
||||
if (rv < 0) {
|
||||
dbg("%s Error from MODEM_CTRL urb: DTR %s, RTS %s",
|
||||
__func__,
|
||||
(set & TIOCM_DTR) ? "HIGH" :
|
||||
(clear & TIOCM_DTR) ? "LOW" : "unchanged",
|
||||
(set & TIOCM_RTS) ? "HIGH" :
|
||||
(clear & TIOCM_RTS) ? "LOW" : "unchanged");
|
||||
dev_dbg(dev, "%s Error from MODEM_CTRL urb: DTR %s, RTS %s\n",
|
||||
__func__,
|
||||
(set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged",
|
||||
(set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged");
|
||||
} else {
|
||||
dbg("%s - DTR %s, RTS %s", __func__,
|
||||
(set & TIOCM_DTR) ? "HIGH" :
|
||||
(clear & TIOCM_DTR) ? "LOW" : "unchanged",
|
||||
(set & TIOCM_RTS) ? "HIGH" :
|
||||
(clear & TIOCM_RTS) ? "LOW" : "unchanged");
|
||||
dev_dbg(dev, "%s - DTR %s, RTS %s\n", __func__,
|
||||
(set & TIOCM_DTR) ? "HIGH" : (clear & TIOCM_DTR) ? "LOW" : "unchanged",
|
||||
(set & TIOCM_RTS) ? "HIGH" : (clear & TIOCM_RTS) ? "LOW" : "unchanged");
|
||||
/* FIXME: locking on last_dtr_rts */
|
||||
priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set;
|
||||
}
|
||||
|
@ -1091,6 +1088,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
|
|||
struct usb_serial_port *port)
|
||||
{
|
||||
struct ftdi_private *priv = usb_get_serial_port_data(port);
|
||||
struct device *dev = &port->dev;
|
||||
__u32 div_value = 0;
|
||||
int div_okay = 1;
|
||||
int baud;
|
||||
|
@ -1126,7 +1124,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
|
|||
alt_speed hack */
|
||||
|
||||
baud = tty_get_baud_rate(tty);
|
||||
dbg("%s - tty_get_baud_rate reports speed %d", __func__, baud);
|
||||
dev_dbg(dev, "%s - tty_get_baud_rate reports speed %d\n", __func__, baud);
|
||||
|
||||
/* 2. Observe async-compatible custom_divisor hack, update baudrate
|
||||
if needed */
|
||||
|
@ -1135,8 +1133,8 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
|
|||
((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) &&
|
||||
(priv->custom_divisor)) {
|
||||
baud = priv->baud_base / priv->custom_divisor;
|
||||
dbg("%s - custom divisor %d sets baud rate to %d",
|
||||
__func__, priv->custom_divisor, baud);
|
||||
dev_dbg(dev, "%s - custom divisor %d sets baud rate to %d\n",
|
||||
__func__, priv->custom_divisor, baud);
|
||||
}
|
||||
|
||||
/* 3. Convert baudrate to device-specific divisor */
|
||||
|
@ -1158,8 +1156,8 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
|
|||
case 115200: div_value = ftdi_sio_b115200; break;
|
||||
} /* baud */
|
||||
if (div_value == 0) {
|
||||
dbg("%s - Baudrate (%d) requested is not supported",
|
||||
__func__, baud);
|
||||
dev_dbg(dev, "%s - Baudrate (%d) requested is not supported\n",
|
||||
__func__, baud);
|
||||
div_value = ftdi_sio_b9600;
|
||||
baud = 9600;
|
||||
div_okay = 0;
|
||||
|
@ -1169,7 +1167,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
|
|||
if (baud <= 3000000) {
|
||||
div_value = ftdi_232am_baud_to_divisor(baud);
|
||||
} else {
|
||||
dbg("%s - Baud rate too high!", __func__);
|
||||
dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
|
||||
baud = 9600;
|
||||
div_value = ftdi_232am_baud_to_divisor(9600);
|
||||
div_okay = 0;
|
||||
|
@ -1192,7 +1190,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
|
|||
}
|
||||
div_value = ftdi_232bm_baud_to_divisor(baud);
|
||||
} else {
|
||||
dbg("%s - Baud rate too high!", __func__);
|
||||
dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
|
||||
div_value = ftdi_232bm_baud_to_divisor(9600);
|
||||
div_okay = 0;
|
||||
baud = 9600;
|
||||
|
@ -1206,7 +1204,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
|
|||
} else if (baud < 1200) {
|
||||
div_value = ftdi_232bm_baud_to_divisor(baud);
|
||||
} else {
|
||||
dbg("%s - Baud rate too high!", __func__);
|
||||
dev_dbg(dev, "%s - Baud rate too high!\n", __func__);
|
||||
div_value = ftdi_232bm_baud_to_divisor(9600);
|
||||
div_okay = 0;
|
||||
baud = 9600;
|
||||
|
@ -1215,7 +1213,7 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty,
|
|||
} /* priv->chip_type */
|
||||
|
||||
if (div_okay) {
|
||||
dbg("%s - Baud rate set to %d (divisor 0x%lX) on chip %s",
|
||||
dev_dbg(dev, "%s - Baud rate set to %d (divisor 0x%lX) on chip %s\n",
|
||||
__func__, baud, (unsigned long)div_value,
|
||||
ftdi_chip_name[priv->chip_type]);
|
||||
}
|
||||
|
@ -1261,7 +1259,7 @@ static int write_latency_timer(struct usb_serial_port *port)
|
|||
if (priv->flags & ASYNC_LOW_LATENCY)
|
||||
l = 1;
|
||||
|
||||
dbg("%s: setting latency timer = %i", __func__, l);
|
||||
dev_dbg(&port->dev, "%s: setting latency timer = %i\n", __func__, l);
|
||||
|
||||
rv = usb_control_msg(udev,
|
||||
usb_sndctrlpipe(udev, 0),
|
||||
|
@ -1416,8 +1414,8 @@ static void ftdi_determine_type(struct usb_serial_port *port)
|
|||
|
||||
version = le16_to_cpu(udev->descriptor.bcdDevice);
|
||||
interfaces = udev->actconfig->desc.bNumInterfaces;
|
||||
dbg("%s: bcdDevice = 0x%x, bNumInterfaces = %u", __func__,
|
||||
version, interfaces);
|
||||
dev_dbg(&port->dev, "%s: bcdDevice = 0x%x, bNumInterfaces = %u\n", __func__,
|
||||
version, interfaces);
|
||||
if (interfaces > 1) {
|
||||
int inter;
|
||||
|
||||
|
@ -1447,8 +1445,9 @@ static void ftdi_determine_type(struct usb_serial_port *port)
|
|||
/* BM-type devices have a bug where bcdDevice gets set
|
||||
* to 0x200 when iSerialNumber is 0. */
|
||||
if (version < 0x500) {
|
||||
dbg("%s: something fishy - bcdDevice too low for multi-interface device",
|
||||
__func__);
|
||||
dev_dbg(&port->dev,
|
||||
"%s: something fishy - bcdDevice too low for multi-interface device\n",
|
||||
__func__);
|
||||
}
|
||||
} else if (version < 0x200) {
|
||||
/* Old device. Assume it's the original SIO. */
|
||||
|
@ -1562,7 +1561,7 @@ static ssize_t store_event_char(struct device *dev,
|
|||
int v = simple_strtoul(valbuf, NULL, 10);
|
||||
int rv;
|
||||
|
||||
dbg("%s: setting event char = %i", __func__, v);
|
||||
dev_dbg(&port->dev, "%s: setting event char = %i\n", __func__, v);
|
||||
|
||||
rv = usb_control_msg(udev,
|
||||
usb_sndctrlpipe(udev, 0),
|
||||
|
@ -1571,7 +1570,7 @@ static ssize_t store_event_char(struct device *dev,
|
|||
v, priv->interface,
|
||||
NULL, 0, WDR_TIMEOUT);
|
||||
if (rv < 0) {
|
||||
dbg("Unable to write event character: %i", rv);
|
||||
dev_dbg(&port->dev, "Unable to write event character: %i\n", rv);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -1590,7 +1589,7 @@ static int create_sysfs_attrs(struct usb_serial_port *port)
|
|||
/* XXX I've no idea if the original SIO supports the event_char
|
||||
* sysfs parameter, so I'm playing it safe. */
|
||||
if (priv->chip_type != SIO) {
|
||||
dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]);
|
||||
dev_dbg(&port->dev, "sysfs attributes for %s\n", ftdi_chip_name[priv->chip_type]);
|
||||
retval = device_create_file(&port->dev, &dev_attr_event_char);
|
||||
if ((!retval) &&
|
||||
(priv->chip_type == FT232BM ||
|
||||
|
@ -1730,8 +1729,8 @@ static int ftdi_NDI_device_setup(struct usb_serial *serial)
|
|||
if (latency > 99)
|
||||
latency = 99;
|
||||
|
||||
dbg("%s setting NDI device latency to %d", __func__, latency);
|
||||
dev_info(&udev->dev, "NDI device with a latency value of %d", latency);
|
||||
dev_dbg(&udev->dev, "%s setting NDI device latency to %d\n", __func__, latency);
|
||||
dev_info(&udev->dev, "NDI device with a latency value of %d\n", latency);
|
||||
|
||||
/* FIXME: errors are not returned */
|
||||
usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
|
||||
|
@ -1949,7 +1948,7 @@ static int ftdi_process_packet(struct tty_struct *tty,
|
|||
char *ch;
|
||||
|
||||
if (len < 2) {
|
||||
dbg("malformed packet");
|
||||
dev_dbg(&port->dev, "malformed packet\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2064,12 +2063,12 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
|
|||
FTDI_SIO_SET_DATA_REQUEST_TYPE,
|
||||
urb_value , priv->interface,
|
||||
NULL, 0, WDR_TIMEOUT) < 0) {
|
||||
dev_err(&port->dev, "%s FAILED to enable/disable break state "
|
||||
"(state was %d)\n", __func__, break_state);
|
||||
dev_err(&port->dev, "%s FAILED to enable/disable break state (state was %d)\n",
|
||||
__func__, break_state);
|
||||
}
|
||||
|
||||
dbg("%s break state is %d - urb is %d", __func__,
|
||||
break_state, urb_value);
|
||||
dev_dbg(&port->dev, "%s break state is %d - urb is %d\n", __func__,
|
||||
break_state, urb_value);
|
||||
|
||||
}
|
||||
|
||||
|
@ -2081,6 +2080,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
|
|||
struct usb_serial_port *port, struct ktermios *old_termios)
|
||||
{
|
||||
struct usb_device *dev = port->serial->dev;
|
||||
struct device *ddev = &port->dev;
|
||||
struct ftdi_private *priv = usb_get_serial_port_data(port);
|
||||
struct ktermios *termios = tty->termios;
|
||||
unsigned int cflag = termios->c_cflag;
|
||||
|
@ -2094,14 +2094,14 @@ static void ftdi_set_termios(struct tty_struct *tty,
|
|||
/* Force baud rate if this device requires it, unless it is set to
|
||||
B0. */
|
||||
if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) {
|
||||
dbg("%s: forcing baud rate for this device", __func__);
|
||||
dev_dbg(ddev, "%s: forcing baud rate for this device\n", __func__);
|
||||
tty_encode_baud_rate(tty, priv->force_baud,
|
||||
priv->force_baud);
|
||||
}
|
||||
|
||||
/* Force RTS-CTS if this device requires it. */
|
||||
if (priv->force_rtscts) {
|
||||
dbg("%s: forcing rtscts for this device", __func__);
|
||||
dev_dbg(ddev, "%s: forcing rtscts for this device\n", __func__);
|
||||
termios->c_cflag |= CRTSCTS;
|
||||
}
|
||||
|
||||
|
@ -2143,10 +2143,16 @@ static void ftdi_set_termios(struct tty_struct *tty,
|
|||
}
|
||||
if (cflag & CSIZE) {
|
||||
switch (cflag & CSIZE) {
|
||||
case CS7: urb_value |= 7; dbg("Setting CS7"); break;
|
||||
case CS8: urb_value |= 8; dbg("Setting CS8"); break;
|
||||
case CS7:
|
||||
urb_value |= 7;
|
||||
dev_dbg(ddev, "Setting CS7\n");
|
||||
break;
|
||||
case CS8:
|
||||
urb_value |= 8;
|
||||
dev_dbg(ddev, "Setting CS8\n");
|
||||
break;
|
||||
default:
|
||||
dev_err(&port->dev, "CSIZE was set but not CS7-CS8\n");
|
||||
dev_err(ddev, "CSIZE was set but not CS7-CS8\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2159,8 +2165,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
|
|||
FTDI_SIO_SET_DATA_REQUEST_TYPE,
|
||||
urb_value , priv->interface,
|
||||
NULL, 0, WDR_SHORT_TIMEOUT) < 0) {
|
||||
dev_err(&port->dev, "%s FAILED to set "
|
||||
"databits/stopbits/parity\n", __func__);
|
||||
dev_err(ddev, "%s FAILED to set databits/stopbits/parity\n",
|
||||
__func__);
|
||||
}
|
||||
|
||||
/* Now do the baudrate */
|
||||
|
@ -2172,8 +2178,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
|
|||
FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
|
||||
0, priv->interface,
|
||||
NULL, 0, WDR_TIMEOUT) < 0) {
|
||||
dev_err(&port->dev,
|
||||
"%s error from disable flowcontrol urb\n",
|
||||
dev_err(ddev, "%s error from disable flowcontrol urb\n",
|
||||
__func__);
|
||||
}
|
||||
/* Drop RTS and DTR */
|
||||
|
@ -2182,8 +2187,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
|
|||
/* set the baudrate determined before */
|
||||
mutex_lock(&priv->cfg_lock);
|
||||
if (change_speed(tty, port))
|
||||
dev_err(&port->dev, "%s urb failed to set baudrate\n",
|
||||
__func__);
|
||||
dev_err(ddev, "%s urb failed to set baudrate\n", __func__);
|
||||
mutex_unlock(&priv->cfg_lock);
|
||||
/* Ensure RTS and DTR are raised when baudrate changed from 0 */
|
||||
if (!old_termios || (old_termios->c_cflag & CBAUD) == B0)
|
||||
|
@ -2194,17 +2198,15 @@ static void ftdi_set_termios(struct tty_struct *tty,
|
|||
/* Note device also supports DTR/CD (ugh) and Xon/Xoff in hardware */
|
||||
no_c_cflag_changes:
|
||||
if (cflag & CRTSCTS) {
|
||||
dbg("%s Setting to CRTSCTS flow control", __func__);
|
||||
dev_dbg(ddev, "%s Setting to CRTSCTS flow control\n", __func__);
|
||||
if (usb_control_msg(dev,
|
||||
usb_sndctrlpipe(dev, 0),
|
||||
FTDI_SIO_SET_FLOW_CTRL_REQUEST,
|
||||
FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
|
||||
0 , (FTDI_SIO_RTS_CTS_HS | priv->interface),
|
||||
NULL, 0, WDR_TIMEOUT) < 0) {
|
||||
dev_err(&port->dev,
|
||||
"urb failed to set to rts/cts flow control\n");
|
||||
dev_err(ddev, "urb failed to set to rts/cts flow control\n");
|
||||
}
|
||||
|
||||
} else {
|
||||
/*
|
||||
* Xon/Xoff code
|
||||
|
@ -2214,8 +2216,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
|
|||
* code is executed.
|
||||
*/
|
||||
if (iflag & IXOFF) {
|
||||
dbg("%s request to enable xonxoff iflag=%04x",
|
||||
__func__, iflag);
|
||||
dev_dbg(ddev, "%s request to enable xonxoff iflag=%04x\n",
|
||||
__func__, iflag);
|
||||
/* Try to enable the XON/XOFF on the ftdi_sio
|
||||
* Set the vstart and vstop -- could have been done up
|
||||
* above where a lot of other dereferencing is done but
|
||||
|
@ -2240,18 +2242,16 @@ static void ftdi_set_termios(struct tty_struct *tty,
|
|||
/* else clause to only run if cflag ! CRTSCTS and iflag
|
||||
* ! XOFF. CHECKME Assuming XON/XOFF handled by tty
|
||||
* stack - not by device */
|
||||
dbg("%s Turning off hardware flow control", __func__);
|
||||
dev_dbg(ddev, "%s Turning off hardware flow control\n", __func__);
|
||||
if (usb_control_msg(dev,
|
||||
usb_sndctrlpipe(dev, 0),
|
||||
FTDI_SIO_SET_FLOW_CTRL_REQUEST,
|
||||
FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
|
||||
0, priv->interface,
|
||||
NULL, 0, WDR_TIMEOUT) < 0) {
|
||||
dev_err(&port->dev,
|
||||
"urb failed to clear flow control\n");
|
||||
dev_err(ddev, "urb failed to clear flow control\n");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2345,7 +2345,7 @@ static int ftdi_ioctl(struct tty_struct *tty,
|
|||
struct async_icount cnow;
|
||||
struct async_icount cprev;
|
||||
|
||||
dbg("%s cmd 0x%04x", __func__, cmd);
|
||||
dev_dbg(&port->dev, "%s cmd 0x%04x\n", __func__, cmd);
|
||||
|
||||
/* Based on code from acm.c and others */
|
||||
switch (cmd) {
|
||||
|
@ -2393,7 +2393,8 @@ static int ftdi_ioctl(struct tty_struct *tty,
|
|||
/* This is not necessarily an error - turns out the higher layers
|
||||
* will do some ioctls themselves (see comment above)
|
||||
*/
|
||||
dbg("%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h", __func__, cmd);
|
||||
dev_dbg(&port->dev, "%s arg not supported - it was 0x%04x - check /usr/include/asm/ioctls.h\n",
|
||||
__func__, cmd);
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue