Commit 049c6b4e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: serial: keyspan: remove dbg() usage

dbg() was a very old USB-serial-specific macro.
This patch removes it from being used in the keyspan
driver and uses dev_dbg() instead.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9c134a14
...@@ -165,7 +165,7 @@ static void keyspan_set_termios(struct tty_struct *tty, ...@@ -165,7 +165,7 @@ static void keyspan_set_termios(struct tty_struct *tty,
so other rates can be generated if desired. */ so other rates can be generated if desired. */
baud_rate = tty_get_baud_rate(tty); baud_rate = tty_get_baud_rate(tty);
/* If no match or invalid, don't change */ /* If no match or invalid, don't change */
if (d_details->calculate_baud_rate(baud_rate, d_details->baudclk, if (d_details->calculate_baud_rate(port, baud_rate, d_details->baudclk,
NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
/* FIXME - more to do here to ensure rate changes cleanly */ /* FIXME - more to do here to ensure rate changes cleanly */
/* FIXME - calcuate exact rate from divisor ? */ /* FIXME - calcuate exact rate from divisor ? */
...@@ -241,7 +241,7 @@ static int keyspan_write(struct tty_struct *tty, ...@@ -241,7 +241,7 @@ static int keyspan_write(struct tty_struct *tty,
dataOffset = 1; dataOffset = 1;
} }
dbg("%s - for port %d (%d chars), flip=%d", dev_dbg(&port->dev, "%s - for port %d (%d chars), flip=%d\n",
__func__, port->number, count, p_priv->out_flip); __func__, port->number, count, p_priv->out_flip);
for (left = count; left > 0; left -= todo) { for (left = count; left > 0; left -= todo) {
...@@ -255,11 +255,11 @@ static int keyspan_write(struct tty_struct *tty, ...@@ -255,11 +255,11 @@ static int keyspan_write(struct tty_struct *tty,
this_urb = p_priv->out_urbs[flip]; this_urb = p_priv->out_urbs[flip];
if (this_urb == NULL) { if (this_urb == NULL) {
/* no bulk out, so return 0 bytes written */ /* no bulk out, so return 0 bytes written */
dbg("%s - no output urb :(", __func__); dev_dbg(&port->dev, "%s - no output urb :(\n", __func__);
return count; return count;
} }
dbg("%s - endpoint %d flip %d", dev_dbg(&port->dev, "%s - endpoint %d flip %d\n",
__func__, usb_pipeendpoint(this_urb->pipe), flip); __func__, usb_pipeendpoint(this_urb->pipe), flip);
if (this_urb->status == -EINPROGRESS) { if (this_urb->status == -EINPROGRESS) {
...@@ -282,7 +282,7 @@ static int keyspan_write(struct tty_struct *tty, ...@@ -282,7 +282,7 @@ static int keyspan_write(struct tty_struct *tty,
err = usb_submit_urb(this_urb, GFP_ATOMIC); err = usb_submit_urb(this_urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("usb_submit_urb(write bulk) failed (%d)", err); dev_dbg(&port->dev, "usb_submit_urb(write bulk) failed (%d)\n", err);
p_priv->tx_start_time[flip] = jiffies; p_priv->tx_start_time[flip] = jiffies;
/* Flip for next time if usa26 or usa28 interface /* Flip for next time if usa26 or usa28 interface
...@@ -305,7 +305,7 @@ static void usa26_indat_callback(struct urb *urb) ...@@ -305,7 +305,7 @@ static void usa26_indat_callback(struct urb *urb)
endpoint = usb_pipeendpoint(urb->pipe); endpoint = usb_pipeendpoint(urb->pipe);
if (status) { if (status) {
dbg("%s - nonzero status: %x on endpoint %d.", dev_dbg(&urb->dev->dev,"%s - nonzero status: %x on endpoint %d.\n",
__func__, status, endpoint); __func__, status, endpoint);
return; return;
} }
...@@ -325,7 +325,7 @@ static void usa26_indat_callback(struct urb *urb) ...@@ -325,7 +325,7 @@ static void usa26_indat_callback(struct urb *urb)
tty_insert_flip_char(tty, data[i], err); tty_insert_flip_char(tty, data[i], err);
} else { } else {
/* some bytes had errors, every byte has status */ /* some bytes had errors, every byte has status */
dbg("%s - RX error!!!!", __func__); dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
for (i = 0; i + 1 < urb->actual_length; i += 2) { for (i = 0; i + 1 < urb->actual_length; i += 2) {
int stat = data[i], flag = 0; int stat = data[i], flag = 0;
if (stat & RXERROR_OVERRUN) if (stat & RXERROR_OVERRUN)
...@@ -345,7 +345,7 @@ static void usa26_indat_callback(struct urb *urb) ...@@ -345,7 +345,7 @@ static void usa26_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - resubmit read urb failed. (%d)", __func__, err); dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
} }
/* Outdat handling is common for all devices */ /* Outdat handling is common for all devices */
...@@ -356,7 +356,7 @@ static void usa2x_outdat_callback(struct urb *urb) ...@@ -356,7 +356,7 @@ static void usa2x_outdat_callback(struct urb *urb)
port = urb->context; port = urb->context;
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
dbg("%s - urb %d", __func__, urb == p_priv->out_urbs[1]); dev_dbg(&port->dev, "%s - urb %d\n", __func__, urb == p_priv->out_urbs[1]);
usb_serial_port_softint(port); usb_serial_port_softint(port);
} }
...@@ -374,7 +374,7 @@ static void usa26_outcont_callback(struct urb *urb) ...@@ -374,7 +374,7 @@ static void usa26_outcont_callback(struct urb *urb)
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
if (p_priv->resend_cont) { if (p_priv->resend_cont) {
dbg("%s - sending setup", __func__); dev_dbg(&port->dev, "%s - sending setup\n", __func__);
keyspan_usa26_send_setup(port->serial, port, keyspan_usa26_send_setup(port->serial, port,
p_priv->resend_cont - 1); p_priv->resend_cont - 1);
} }
...@@ -394,20 +394,22 @@ static void usa26_instat_callback(struct urb *urb) ...@@ -394,20 +394,22 @@ static void usa26_instat_callback(struct urb *urb)
serial = urb->context; serial = urb->context;
if (status) { if (status) {
dbg("%s - nonzero status: %x", __func__, status); dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
return; return;
} }
if (urb->actual_length != 9) { if (urb->actual_length != 9) {
dbg("%s - %d byte report??", __func__, urb->actual_length); dev_dbg(&urb->dev->dev, "%s - %d byte report??\n", __func__, urb->actual_length);
goto exit; goto exit;
} }
msg = (struct keyspan_usa26_portStatusMessage *)data; msg = (struct keyspan_usa26_portStatusMessage *)data;
#if 0 #if 0
dbg("%s - port status: port %d cts %d dcd %d dsr %d ri %d toff %d txoff %d rxen %d cr %d", dev_dbg(&urb->dev->dev,
__func__, msg->port, msg->hskia_cts, msg->gpia_dcd, msg->dsr, msg->ri, msg->_txOff, "%s - port status: port %d cts %d dcd %d dsr %d ri %d toff %d txoff %d rxen %d cr %d",
msg->_txXoff, msg->rxEnabled, msg->controlResponse); __func__, msg->port, msg->hskia_cts, msg->gpia_dcd, msg->dsr,
msg->ri, msg->_txOff, msg->_txXoff, msg->rxEnabled,
msg->controlResponse);
#endif #endif
/* Now do something useful with the data */ /* Now do something useful with the data */
...@@ -415,7 +417,7 @@ static void usa26_instat_callback(struct urb *urb) ...@@ -415,7 +417,7 @@ static void usa26_instat_callback(struct urb *urb)
/* Check port number from message and retrieve private data */ /* Check port number from message and retrieve private data */
if (msg->port >= serial->num_ports) { if (msg->port >= serial->num_ports) {
dbg("%s - Unexpected port number %d", __func__, msg->port); dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n", __func__, msg->port);
goto exit; goto exit;
} }
port = serial->port[msg->port]; port = serial->port[msg->port];
...@@ -438,7 +440,7 @@ static void usa26_instat_callback(struct urb *urb) ...@@ -438,7 +440,7 @@ static void usa26_instat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - resubmit read urb failed. (%d)", __func__, err); dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
exit: ; exit: ;
} }
...@@ -465,7 +467,7 @@ static void usa28_indat_callback(struct urb *urb) ...@@ -465,7 +467,7 @@ static void usa28_indat_callback(struct urb *urb)
do { do {
if (status) { if (status) {
dbg("%s - nonzero status: %x on endpoint %d.", dev_dbg(&urb->dev->dev, "%s - nonzero status: %x on endpoint %d.\n",
__func__, status, usb_pipeendpoint(urb->pipe)); __func__, status, usb_pipeendpoint(urb->pipe));
return; return;
} }
...@@ -484,7 +486,7 @@ static void usa28_indat_callback(struct urb *urb) ...@@ -484,7 +486,7 @@ static void usa28_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - resubmit read urb failed. (%d)", dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n",
__func__, err); __func__, err);
p_priv->in_flip ^= 1; p_priv->in_flip ^= 1;
...@@ -505,7 +507,7 @@ static void usa28_outcont_callback(struct urb *urb) ...@@ -505,7 +507,7 @@ static void usa28_outcont_callback(struct urb *urb)
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
if (p_priv->resend_cont) { if (p_priv->resend_cont) {
dbg("%s - sending setup", __func__); dev_dbg(&port->dev, "%s - sending setup\n", __func__);
keyspan_usa28_send_setup(port->serial, port, keyspan_usa28_send_setup(port->serial, port,
p_priv->resend_cont - 1); p_priv->resend_cont - 1);
} }
...@@ -526,25 +528,28 @@ static void usa28_instat_callback(struct urb *urb) ...@@ -526,25 +528,28 @@ static void usa28_instat_callback(struct urb *urb)
serial = urb->context; serial = urb->context;
if (status) { if (status) {
dbg("%s - nonzero status: %x", __func__, status); dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
return; return;
} }
if (urb->actual_length != sizeof(struct keyspan_usa28_portStatusMessage)) { if (urb->actual_length != sizeof(struct keyspan_usa28_portStatusMessage)) {
dbg("%s - bad length %d", __func__, urb->actual_length); dev_dbg(&urb->dev->dev, "%s - bad length %d\n", __func__, urb->actual_length);
goto exit; goto exit;
} }
/*dbg("%s %x %x %x %x %x %x %x %x %x %x %x %x", __func__ /*
dev_dbg(&urb->dev->dev,
"%s %x %x %x %x %x %x %x %x %x %x %x %x", __func__,
data[0], data[1], data[2], data[3], data[4], data[5], data[0], data[1], data[2], data[3], data[4], data[5],
data[6], data[7], data[8], data[9], data[10], data[11]);*/ data[6], data[7], data[8], data[9], data[10], data[11]);
*/
/* Now do something useful with the data */ /* Now do something useful with the data */
msg = (struct keyspan_usa28_portStatusMessage *)data; msg = (struct keyspan_usa28_portStatusMessage *)data;
/* Check port number from message and retrieve private data */ /* Check port number from message and retrieve private data */
if (msg->port >= serial->num_ports) { if (msg->port >= serial->num_ports) {
dbg("%s - Unexpected port number %d", __func__, msg->port); dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n", __func__, msg->port);
goto exit; goto exit;
} }
port = serial->port[msg->port]; port = serial->port[msg->port];
...@@ -567,7 +572,7 @@ static void usa28_instat_callback(struct urb *urb) ...@@ -567,7 +572,7 @@ static void usa28_instat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - resubmit read urb failed. (%d)", __func__, err); dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
exit: ; exit: ;
} }
...@@ -589,7 +594,7 @@ static void usa49_glocont_callback(struct urb *urb) ...@@ -589,7 +594,7 @@ static void usa49_glocont_callback(struct urb *urb)
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
if (p_priv->resend_cont) { if (p_priv->resend_cont) {
dbg("%s - sending setup", __func__); dev_dbg(&port->dev, "%s - sending setup\n", __func__);
keyspan_usa49_send_setup(serial, port, keyspan_usa49_send_setup(serial, port,
p_priv->resend_cont - 1); p_priv->resend_cont - 1);
break; break;
...@@ -613,26 +618,28 @@ static void usa49_instat_callback(struct urb *urb) ...@@ -613,26 +618,28 @@ static void usa49_instat_callback(struct urb *urb)
serial = urb->context; serial = urb->context;
if (status) { if (status) {
dbg("%s - nonzero status: %x", __func__, status); dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
return; return;
} }
if (urb->actual_length != if (urb->actual_length !=
sizeof(struct keyspan_usa49_portStatusMessage)) { sizeof(struct keyspan_usa49_portStatusMessage)) {
dbg("%s - bad length %d", __func__, urb->actual_length); dev_dbg(&urb->dev->dev, "%s - bad length %d\n", __func__, urb->actual_length);
goto exit; goto exit;
} }
/*dbg(" %x %x %x %x %x %x %x %x %x %x %x", __func__, /*
data[0], data[1], data[2], data[3], data[4], data[5], dev_dbg(&urb->dev->dev, "%s: %x %x %x %x %x %x %x %x %x %x %x",
data[6], data[7], data[8], data[9], data[10]);*/ __func__, data[0], data[1], data[2], data[3], data[4],
data[5], data[6], data[7], data[8], data[9], data[10]);
*/
/* Now do something useful with the data */ /* Now do something useful with the data */
msg = (struct keyspan_usa49_portStatusMessage *)data; msg = (struct keyspan_usa49_portStatusMessage *)data;
/* Check port number from message and retrieve private data */ /* Check port number from message and retrieve private data */
if (msg->portNumber >= serial->num_ports) { if (msg->portNumber >= serial->num_ports) {
dbg("%s - Unexpected port number %d", dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n",
__func__, msg->portNumber); __func__, msg->portNumber);
goto exit; goto exit;
} }
...@@ -656,7 +663,7 @@ static void usa49_instat_callback(struct urb *urb) ...@@ -656,7 +663,7 @@ static void usa49_instat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - resubmit read urb failed. (%d)", __func__, err); dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
exit: ; exit: ;
} }
...@@ -676,8 +683,8 @@ static void usa49_indat_callback(struct urb *urb) ...@@ -676,8 +683,8 @@ static void usa49_indat_callback(struct urb *urb)
endpoint = usb_pipeendpoint(urb->pipe); endpoint = usb_pipeendpoint(urb->pipe);
if (status) { if (status) {
dbg("%s - nonzero status: %x on endpoint %d.", __func__, dev_dbg(&urb->dev->dev, "%s - nonzero status: %x on endpoint %d.\n",
status, endpoint); __func__, status, endpoint);
return; return;
} }
...@@ -710,7 +717,7 @@ static void usa49_indat_callback(struct urb *urb) ...@@ -710,7 +717,7 @@ static void usa49_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - resubmit read urb failed. (%d)", __func__, err); dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
} }
static void usa49wg_indat_callback(struct urb *urb) static void usa49wg_indat_callback(struct urb *urb)
...@@ -725,7 +732,7 @@ static void usa49wg_indat_callback(struct urb *urb) ...@@ -725,7 +732,7 @@ static void usa49wg_indat_callback(struct urb *urb)
serial = urb->context; serial = urb->context;
if (status) { if (status) {
dbg("%s - nonzero status: %x", __func__, status); dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
return; return;
} }
...@@ -738,7 +745,7 @@ static void usa49wg_indat_callback(struct urb *urb) ...@@ -738,7 +745,7 @@ static void usa49wg_indat_callback(struct urb *urb)
/* Check port number from message*/ /* Check port number from message*/
if (data[i] >= serial->num_ports) { if (data[i] >= serial->num_ports) {
dbg("%s - Unexpected port number %d", dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n",
__func__, data[i]); __func__, data[i]);
return; return;
} }
...@@ -778,7 +785,7 @@ static void usa49wg_indat_callback(struct urb *urb) ...@@ -778,7 +785,7 @@ static void usa49wg_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - resubmit read urb failed. (%d)", __func__, err); dev_dbg(&urb->dev->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
} }
/* not used, usa-49 doesn't have per-port control endpoints */ /* not used, usa-49 doesn't have per-port control endpoints */
...@@ -799,7 +806,7 @@ static void usa90_indat_callback(struct urb *urb) ...@@ -799,7 +806,7 @@ static void usa90_indat_callback(struct urb *urb)
endpoint = usb_pipeendpoint(urb->pipe); endpoint = usb_pipeendpoint(urb->pipe);
if (status) { if (status) {
dbg("%s - nonzero status: %x on endpoint %d.", dev_dbg(&urb->dev->dev, "%s - nonzero status: %x on endpoint %d.\n",
__func__, status, endpoint); __func__, status, endpoint);
return; return;
} }
...@@ -828,7 +835,7 @@ static void usa90_indat_callback(struct urb *urb) ...@@ -828,7 +835,7 @@ static void usa90_indat_callback(struct urb *urb)
err); err);
} else { } else {
/* some bytes had errors, every byte has status */ /* some bytes had errors, every byte has status */
dbg("%s - RX error!!!!", __func__); dev_dbg(&port->dev, "%s - RX error!!!!\n", __func__);
for (i = 0; i + 1 < urb->actual_length; i += 2) { for (i = 0; i + 1 < urb->actual_length; i += 2) {
int stat = data[i], flag = 0; int stat = data[i], flag = 0;
if (stat & RXERROR_OVERRUN) if (stat & RXERROR_OVERRUN)
...@@ -850,7 +857,7 @@ static void usa90_indat_callback(struct urb *urb) ...@@ -850,7 +857,7 @@ static void usa90_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - resubmit read urb failed. (%d)", __func__, err); dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
} }
...@@ -868,11 +875,11 @@ static void usa90_instat_callback(struct urb *urb) ...@@ -868,11 +875,11 @@ static void usa90_instat_callback(struct urb *urb)
serial = urb->context; serial = urb->context;
if (status) { if (status) {
dbg("%s - nonzero status: %x", __func__, status); dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
return; return;
} }
if (urb->actual_length < 14) { if (urb->actual_length < 14) {
dbg("%s - %d byte report??", __func__, urb->actual_length); dev_dbg(&urb->dev->dev, "%s - %d byte report??\n", __func__, urb->actual_length);
goto exit; goto exit;
} }
...@@ -900,7 +907,7 @@ static void usa90_instat_callback(struct urb *urb) ...@@ -900,7 +907,7 @@ static void usa90_instat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - resubmit read urb failed. (%d)", __func__, err); dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
exit: exit:
; ;
} }
...@@ -914,7 +921,7 @@ static void usa90_outcont_callback(struct urb *urb) ...@@ -914,7 +921,7 @@ static void usa90_outcont_callback(struct urb *urb)
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
if (p_priv->resend_cont) { if (p_priv->resend_cont) {
dbg("%s - sending setup", __func__); dev_dbg(&urb->dev->dev, "%s - sending setup\n", __func__);
keyspan_usa90_send_setup(port->serial, port, keyspan_usa90_send_setup(port->serial, port,
p_priv->resend_cont - 1); p_priv->resend_cont - 1);
} }
...@@ -935,13 +942,13 @@ static void usa67_instat_callback(struct urb *urb) ...@@ -935,13 +942,13 @@ static void usa67_instat_callback(struct urb *urb)
serial = urb->context; serial = urb->context;
if (status) { if (status) {
dbg("%s - nonzero status: %x", __func__, status); dev_dbg(&urb->dev->dev, "%s - nonzero status: %x\n", __func__, status);
return; return;
} }
if (urb->actual_length != if (urb->actual_length !=
sizeof(struct keyspan_usa67_portStatusMessage)) { sizeof(struct keyspan_usa67_portStatusMessage)) {
dbg("%s - bad length %d", __func__, urb->actual_length); dev_dbg(&urb->dev->dev, "%s - bad length %d\n", __func__, urb->actual_length);
return; return;
} }
...@@ -951,7 +958,7 @@ static void usa67_instat_callback(struct urb *urb) ...@@ -951,7 +958,7 @@ static void usa67_instat_callback(struct urb *urb)
/* Check port number from message and retrieve private data */ /* Check port number from message and retrieve private data */
if (msg->port >= serial->num_ports) { if (msg->port >= serial->num_ports) {
dbg("%s - Unexpected port number %d", __func__, msg->port); dev_dbg(&urb->dev->dev, "%s - Unexpected port number %d\n", __func__, msg->port);
return; return;
} }
...@@ -973,7 +980,7 @@ static void usa67_instat_callback(struct urb *urb) ...@@ -973,7 +980,7 @@ static void usa67_instat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - resubmit read urb failed. (%d)", __func__, err); dev_dbg(&port->dev, "%s - resubmit read urb failed. (%d)\n", __func__, err);
} }
static void usa67_glocont_callback(struct urb *urb) static void usa67_glocont_callback(struct urb *urb)
...@@ -989,7 +996,7 @@ static void usa67_glocont_callback(struct urb *urb) ...@@ -989,7 +996,7 @@ static void usa67_glocont_callback(struct urb *urb)
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
if (p_priv->resend_cont) { if (p_priv->resend_cont) {
dbg("%s - sending setup", __func__); dev_dbg(&port->dev, "%s - sending setup\n", __func__);
keyspan_usa67_send_setup(serial, port, keyspan_usa67_send_setup(serial, port,
p_priv->resend_cont - 1); p_priv->resend_cont - 1);
break; break;
...@@ -1068,8 +1075,7 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -1068,8 +1075,7 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)
usb_clear_halt(urb->dev, urb->pipe); usb_clear_halt(urb->dev, urb->pipe);
err = usb_submit_urb(urb, GFP_KERNEL); err = usb_submit_urb(urb, GFP_KERNEL);
if (err != 0) if (err != 0)
dbg("%s - submit urb %d failed (%d)", dev_dbg(&port->dev, "%s - submit urb %d failed (%d)\n", __func__, i, err);
__func__, i, err);
} }
/* Reset low level data toggle on out endpoints */ /* Reset low level data toggle on out endpoints */
...@@ -1092,7 +1098,7 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -1092,7 +1098,7 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)
baud_rate = tty_get_baud_rate(tty); baud_rate = tty_get_baud_rate(tty);
/* If no match or invalid, leave as default */ /* If no match or invalid, leave as default */
if (baud_rate >= 0 if (baud_rate >= 0
&& d_details->calculate_baud_rate(baud_rate, d_details->baudclk, && d_details->calculate_baud_rate(port, baud_rate, d_details->baudclk,
NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
p_priv->baud = baud_rate; p_priv->baud = baud_rate;
} }
...@@ -1142,7 +1148,7 @@ static void keyspan_close(struct usb_serial_port *port) ...@@ -1142,7 +1148,7 @@ static void keyspan_close(struct usb_serial_port *port)
} }
/*while (p_priv->outcont_urb->status == -EINPROGRESS) { /*while (p_priv->outcont_urb->status == -EINPROGRESS) {
dbg("%s - urb in progress", __func__); dev_dbg(&port->dev, "%s - urb in progress\n", __func__);
}*/ }*/
p_priv->out_flip = 0; p_priv->out_flip = 0;
...@@ -1167,13 +1173,13 @@ static int keyspan_fake_startup(struct usb_serial *serial) ...@@ -1167,13 +1173,13 @@ static int keyspan_fake_startup(struct usb_serial *serial)
char *fw_name; char *fw_name;
const struct firmware *fw; const struct firmware *fw;
dbg("Keyspan startup version %04x product %04x", dev_dbg(&serial->dev->dev, "Keyspan startup version %04x product %04x\n",
le16_to_cpu(serial->dev->descriptor.bcdDevice), le16_to_cpu(serial->dev->descriptor.bcdDevice),
le16_to_cpu(serial->dev->descriptor.idProduct)); le16_to_cpu(serial->dev->descriptor.idProduct));
if ((le16_to_cpu(serial->dev->descriptor.bcdDevice) & 0x8000) if ((le16_to_cpu(serial->dev->descriptor.bcdDevice) & 0x8000)
!= 0x8000) { != 0x8000) {
dbg("Firmware already loaded. Quitting."); dev_dbg(&serial->dev->dev, "Firmware already loaded. Quitting.\n");
return 1; return 1;
} }
...@@ -1238,7 +1244,7 @@ static int keyspan_fake_startup(struct usb_serial *serial) ...@@ -1238,7 +1244,7 @@ static int keyspan_fake_startup(struct usb_serial *serial)
return 1; return 1;
} }
dbg("Uploading Keyspan %s firmware.", fw_name); dev_dbg(&serial->dev->dev, "Uploading Keyspan %s firmware.\n", fw_name);
/* download the firmware image */ /* download the firmware image */
response = ezusb_set_reset(serial->dev, 1); response = ezusb_set_reset(serial->dev, 1);
...@@ -1296,10 +1302,10 @@ static struct urb *keyspan_setup_urb(struct usb_serial *serial, int endpoint, ...@@ -1296,10 +1302,10 @@ static struct urb *keyspan_setup_urb(struct usb_serial *serial, int endpoint,
if (endpoint == -1) if (endpoint == -1)
return NULL; /* endpoint not needed */ return NULL; /* endpoint not needed */
dbg("%s - alloc for endpoint %d.", __func__, endpoint); dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d.\n", __func__, endpoint);
urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */ urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
if (urb == NULL) { if (urb == NULL) {
dbg("%s - alloc for endpoint %d failed.", __func__, endpoint); dev_dbg(&serial->interface->dev, "%s - alloc for endpoint %d failed.\n", __func__, endpoint);
return NULL; return NULL;
} }
...@@ -1332,7 +1338,7 @@ static struct urb *keyspan_setup_urb(struct usb_serial *serial, int endpoint, ...@@ -1332,7 +1338,7 @@ static struct urb *keyspan_setup_urb(struct usb_serial *serial, int endpoint,
return NULL; return NULL;
} }
dbg("%s - using urb %p for %s endpoint %x", dev_dbg(&serial->interface->dev, "%s - using urb %p for %s endpoint %x\n",
__func__, urb, ep_type_name, endpoint); __func__, urb, ep_type_name, endpoint);
return urb; return urb;
} }
...@@ -1464,14 +1470,15 @@ static void keyspan_setup_urbs(struct usb_serial *serial) ...@@ -1464,14 +1470,15 @@ static void keyspan_setup_urbs(struct usb_serial *serial)
} }
/* usa19 function doesn't require prescaler */ /* usa19 function doesn't require prescaler */
static int keyspan_usa19_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, static int keyspan_usa19_calc_baud(struct usb_serial_port *port,
u32 baud_rate, u32 baudclk, u8 *rate_hi,
u8 *rate_low, u8 *prescaler, int portnum) u8 *rate_low, u8 *prescaler, int portnum)
{ {
u32 b16, /* baud rate times 16 (actual rate used internally) */ u32 b16, /* baud rate times 16 (actual rate used internally) */
div, /* divisor */ div, /* divisor */
cnt; /* inverse of divisor (programmed into 8051) */ cnt; /* inverse of divisor (programmed into 8051) */
dbg("%s - %d.", __func__, baud_rate); dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
/* prevent divide by zero... */ /* prevent divide by zero... */
b16 = baud_rate * 16L; b16 = baud_rate * 16L;
...@@ -1498,19 +1505,20 @@ static int keyspan_usa19_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, ...@@ -1498,19 +1505,20 @@ static int keyspan_usa19_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
if (rate_hi) if (rate_hi)
*rate_hi = (u8) ((cnt >> 8) & 0xff); *rate_hi = (u8) ((cnt >> 8) & 0xff);
if (rate_low && rate_hi) if (rate_low && rate_hi)
dbg("%s - %d %02x %02x.", dev_dbg(&port->dev, "%s - %d %02x %02x.\n",
__func__, baud_rate, *rate_hi, *rate_low); __func__, baud_rate, *rate_hi, *rate_low);
return KEYSPAN_BAUD_RATE_OK; return KEYSPAN_BAUD_RATE_OK;
} }
/* usa19hs function doesn't require prescaler */ /* usa19hs function doesn't require prescaler */
static int keyspan_usa19hs_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, static int keyspan_usa19hs_calc_baud(struct usb_serial_port *port,
u32 baud_rate, u32 baudclk, u8 *rate_hi,
u8 *rate_low, u8 *prescaler, int portnum) u8 *rate_low, u8 *prescaler, int portnum)
{ {
u32 b16, /* baud rate times 16 (actual rate used internally) */ u32 b16, /* baud rate times 16 (actual rate used internally) */
div; /* divisor */ div; /* divisor */
dbg("%s - %d.", __func__, baud_rate); dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
/* prevent divide by zero... */ /* prevent divide by zero... */
b16 = baud_rate * 16L; b16 = baud_rate * 16L;
...@@ -1533,13 +1541,14 @@ static int keyspan_usa19hs_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, ...@@ -1533,13 +1541,14 @@ static int keyspan_usa19hs_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
*rate_hi = (u8) ((div >> 8) & 0xff); *rate_hi = (u8) ((div >> 8) & 0xff);
if (rate_low && rate_hi) if (rate_low && rate_hi)
dbg("%s - %d %02x %02x.", dev_dbg(&port->dev, "%s - %d %02x %02x.\n",
__func__, baud_rate, *rate_hi, *rate_low); __func__, baud_rate, *rate_hi, *rate_low);
return KEYSPAN_BAUD_RATE_OK; return KEYSPAN_BAUD_RATE_OK;
} }
static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, static int keyspan_usa19w_calc_baud(struct usb_serial_port *port,
u32 baud_rate, u32 baudclk, u8 *rate_hi,
u8 *rate_low, u8 *prescaler, int portnum) u8 *rate_low, u8 *prescaler, int portnum)
{ {
u32 b16, /* baud rate times 16 (actual rate used internally) */ u32 b16, /* baud rate times 16 (actual rate used internally) */
...@@ -1551,7 +1560,7 @@ static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, ...@@ -1551,7 +1560,7 @@ static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
u8 best_prescaler; u8 best_prescaler;
int i; int i;
dbg("%s - %d.", __func__, baud_rate); dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
/* prevent divide by zero */ /* prevent divide by zero */
b16 = baud_rate * 16L; b16 = baud_rate * 16L;
...@@ -1596,20 +1605,21 @@ static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, ...@@ -1596,20 +1605,21 @@ static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
*rate_hi = (u8) ((div >> 8) & 0xff); *rate_hi = (u8) ((div >> 8) & 0xff);
if (prescaler) { if (prescaler) {
*prescaler = best_prescaler; *prescaler = best_prescaler;
/* dbg("%s - %d %d", __func__, *prescaler, div); */ /* dev_dbg(&port->dev, "%s - %d %d\n", __func__, *prescaler, div); */
} }
return KEYSPAN_BAUD_RATE_OK; return KEYSPAN_BAUD_RATE_OK;
} }
/* USA-28 supports different maximum baud rates on each port */ /* USA-28 supports different maximum baud rates on each port */
static int keyspan_usa28_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, static int keyspan_usa28_calc_baud(struct usb_serial_port *port,
u32 baud_rate, u32 baudclk, u8 *rate_hi,
u8 *rate_low, u8 *prescaler, int portnum) u8 *rate_low, u8 *prescaler, int portnum)
{ {
u32 b16, /* baud rate times 16 (actual rate used internally) */ u32 b16, /* baud rate times 16 (actual rate used internally) */
div, /* divisor */ div, /* divisor */
cnt; /* inverse of divisor (programmed into 8051) */ cnt; /* inverse of divisor (programmed into 8051) */
dbg("%s - %d.", __func__, baud_rate); dev_dbg(&port->dev, "%s - %d.\n", __func__, baud_rate);
/* prevent divide by zero */ /* prevent divide by zero */
b16 = baud_rate * 16L; b16 = baud_rate * 16L;
...@@ -1642,7 +1652,7 @@ static int keyspan_usa28_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, ...@@ -1642,7 +1652,7 @@ static int keyspan_usa28_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
*rate_low = (u8) (cnt & 0xff); *rate_low = (u8) (cnt & 0xff);
if (rate_hi) if (rate_hi)
*rate_hi = (u8) ((cnt >> 8) & 0xff); *rate_hi = (u8) ((cnt >> 8) & 0xff);
dbg("%s - %d OK.", __func__, baud_rate); dev_dbg(&port->dev, "%s - %d OK.\n", __func__, baud_rate);
return KEYSPAN_BAUD_RATE_OK; return KEYSPAN_BAUD_RATE_OK;
} }
...@@ -1658,7 +1668,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, ...@@ -1658,7 +1668,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
struct urb *this_urb; struct urb *this_urb;
int device_port, err; int device_port, err;
dbg("%s reset=%d", __func__, reset_port); dev_dbg(&port->dev, "%s reset=%d\n", __func__, reset_port);
s_priv = usb_get_serial_data(serial); s_priv = usb_get_serial_data(serial);
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
...@@ -1668,11 +1678,11 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, ...@@ -1668,11 +1678,11 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
outcont_urb = d_details->outcont_endpoints[port->number]; outcont_urb = d_details->outcont_endpoints[port->number];
this_urb = p_priv->outcont_urb; this_urb = p_priv->outcont_urb;
dbg("%s - endpoint %d", __func__, usb_pipeendpoint(this_urb->pipe)); dev_dbg(&port->dev, "%s - endpoint %d\n", __func__, usb_pipeendpoint(this_urb->pipe));
/* Make sure we have an urb then send the message */ /* Make sure we have an urb then send the message */
if (this_urb == NULL) { if (this_urb == NULL) {
dbg("%s - oops no urb.", __func__); dev_dbg(&port->dev, "%s - oops no urb.\n", __func__);
return -1; return -1;
} }
...@@ -1681,7 +1691,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, ...@@ -1681,7 +1691,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
if ((reset_port + 1) > p_priv->resend_cont) if ((reset_port + 1) > p_priv->resend_cont)
p_priv->resend_cont = reset_port + 1; p_priv->resend_cont = reset_port + 1;
if (this_urb->status == -EINPROGRESS) { if (this_urb->status == -EINPROGRESS) {
/* dbg("%s - already writing", __func__); */ /* dev_dbg(&port->dev, "%s - already writing\n", __func__); */
mdelay(5); mdelay(5);
return -1; return -1;
} }
...@@ -1692,10 +1702,10 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, ...@@ -1692,10 +1702,10 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
if (p_priv->old_baud != p_priv->baud) { if (p_priv->old_baud != p_priv->baud) {
p_priv->old_baud = p_priv->baud; p_priv->old_baud = p_priv->baud;
msg.setClocking = 0xff; msg.setClocking = 0xff;
if (d_details->calculate_baud_rate if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
(p_priv->baud, d_details->baudclk, &msg.baudHi, &msg.baudHi, &msg.baudLo, &msg.prescaler,
&msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE) { device_port) == KEYSPAN_INVALID_BAUD_RATE) {
dbg("%s - Invalid baud rate %d requested, using 9600.", dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
__func__, p_priv->baud); __func__, p_priv->baud);
msg.baudLo = 0; msg.baudLo = 0;
msg.baudHi = 125; /* Values for 9600 baud */ msg.baudHi = 125; /* Values for 9600 baud */
...@@ -1790,10 +1800,10 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, ...@@ -1790,10 +1800,10 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
err = usb_submit_urb(this_urb, GFP_ATOMIC); err = usb_submit_urb(this_urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
#if 0 #if 0
else { else {
dbg("%s - usb_submit_urb(%d) OK %d bytes (end %d)", __func__ dev_dbg(&port->dev, "%s - usb_submit_urb(%d) OK %d bytes (end %d)\n", __func__
outcont_urb, this_urb->transfer_buffer_length, outcont_urb, this_urb->transfer_buffer_length,
usb_pipeendpoint(this_urb->pipe)); usb_pipeendpoint(this_urb->pipe));
} }
...@@ -1821,7 +1831,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, ...@@ -1821,7 +1831,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
/* only do something if we have a bulk out endpoint */ /* only do something if we have a bulk out endpoint */
this_urb = p_priv->outcont_urb; this_urb = p_priv->outcont_urb;
if (this_urb == NULL) { if (this_urb == NULL) {
dbg("%s - oops no urb.", __func__); dev_dbg(&port->dev, "%s - oops no urb.\n", __func__);
return -1; return -1;
} }
...@@ -1830,7 +1840,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, ...@@ -1830,7 +1840,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
if ((reset_port + 1) > p_priv->resend_cont) if ((reset_port + 1) > p_priv->resend_cont)
p_priv->resend_cont = reset_port + 1; p_priv->resend_cont = reset_port + 1;
if (this_urb->status == -EINPROGRESS) { if (this_urb->status == -EINPROGRESS) {
dbg("%s already writing", __func__); dev_dbg(&port->dev, "%s already writing\n", __func__);
mdelay(5); mdelay(5);
return -1; return -1;
} }
...@@ -1838,9 +1848,10 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, ...@@ -1838,9 +1848,10 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
memset(&msg, 0, sizeof(struct keyspan_usa28_portControlMessage)); memset(&msg, 0, sizeof(struct keyspan_usa28_portControlMessage));
msg.setBaudRate = 1; msg.setBaudRate = 1;
if (d_details->calculate_baud_rate(p_priv->baud, d_details->baudclk, if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
&msg.baudHi, &msg.baudLo, NULL, device_port) == KEYSPAN_INVALID_BAUD_RATE) { &msg.baudHi, &msg.baudLo, NULL,
dbg("%s - Invalid baud rate requested %d.", device_port) == KEYSPAN_INVALID_BAUD_RATE) {
dev_dbg(&port->dev, "%s - Invalid baud rate requested %d.\n",
__func__, p_priv->baud); __func__, p_priv->baud);
msg.baudLo = 0xff; msg.baudLo = 0xff;
msg.baudHi = 0xb2; /* Values for 9600 baud */ msg.baudHi = 0xb2; /* Values for 9600 baud */
...@@ -1915,10 +1926,10 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, ...@@ -1915,10 +1926,10 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
err = usb_submit_urb(this_urb, GFP_ATOMIC); err = usb_submit_urb(this_urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - usb_submit_urb(setup) failed", __func__); dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed\n", __func__);
#if 0 #if 0
else { else {
dbg("%s - usb_submit_urb(setup) OK %d bytes", __func__, dev_dbg(&port->dev, "%s - usb_submit_urb(setup) OK %d bytes\n", __func__,
this_urb->transfer_buffer_length); this_urb->transfer_buffer_length);
} }
#endif #endif
...@@ -1949,11 +1960,11 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, ...@@ -1949,11 +1960,11 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
/* Make sure we have an urb then send the message */ /* Make sure we have an urb then send the message */
if (this_urb == NULL) { if (this_urb == NULL) {
dbg("%s - oops no urb for port %d.", __func__, port->number); dev_dbg(&port->dev, "%s - oops no urb for port %d.\n", __func__, port->number);
return -1; return -1;
} }
dbg("%s - endpoint %d port %d (%d)", dev_dbg(&port->dev, "%s - endpoint %d port %d (%d)\n",
__func__, usb_pipeendpoint(this_urb->pipe), __func__, usb_pipeendpoint(this_urb->pipe),
port->number, device_port); port->number, device_port);
...@@ -1963,7 +1974,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, ...@@ -1963,7 +1974,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
p_priv->resend_cont = reset_port + 1; p_priv->resend_cont = reset_port + 1;
if (this_urb->status == -EINPROGRESS) { if (this_urb->status == -EINPROGRESS) {
/* dbg("%s - already writing", __func__); */ /* dev_dbg(&port->dev, "%s - already writing\n", __func__); */
mdelay(5); mdelay(5);
return -1; return -1;
} }
...@@ -1977,10 +1988,10 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, ...@@ -1977,10 +1988,10 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
if (p_priv->old_baud != p_priv->baud) { if (p_priv->old_baud != p_priv->baud) {
p_priv->old_baud = p_priv->baud; p_priv->old_baud = p_priv->baud;
msg.setClocking = 0xff; msg.setClocking = 0xff;
if (d_details->calculate_baud_rate if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
(p_priv->baud, d_details->baudclk, &msg.baudHi, &msg.baudHi, &msg.baudLo, &msg.prescaler,
&msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE) { device_port) == KEYSPAN_INVALID_BAUD_RATE) {
dbg("%s - Invalid baud rate %d requested, using 9600.", dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
__func__, p_priv->baud); __func__, p_priv->baud);
msg.baudLo = 0; msg.baudLo = 0;
msg.baudHi = 125; /* Values for 9600 baud */ msg.baudHi = 125; /* Values for 9600 baud */
...@@ -2100,10 +2111,10 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, ...@@ -2100,10 +2111,10 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
} }
err = usb_submit_urb(this_urb, GFP_ATOMIC); err = usb_submit_urb(this_urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
#if 0 #if 0
else { else {
dbg("%s - usb_submit_urb(%d) OK %d bytes (end %d)", __func__, dev_dbg(&port->dev, "%s - usb_submit_urb(%d) OK %d bytes (end %d)\n", __func__,
outcont_urb, this_urb->transfer_buffer_length, outcont_urb, this_urb->transfer_buffer_length,
usb_pipeendpoint(this_urb->pipe)); usb_pipeendpoint(this_urb->pipe));
} }
...@@ -2131,7 +2142,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, ...@@ -2131,7 +2142,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
/* only do something if we have a bulk out endpoint */ /* only do something if we have a bulk out endpoint */
this_urb = p_priv->outcont_urb; this_urb = p_priv->outcont_urb;
if (this_urb == NULL) { if (this_urb == NULL) {
dbg("%s - oops no urb.", __func__); dev_dbg(&port->dev, "%s - oops no urb.\n", __func__);
return -1; return -1;
} }
...@@ -2140,7 +2151,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, ...@@ -2140,7 +2151,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
if ((reset_port + 1) > p_priv->resend_cont) if ((reset_port + 1) > p_priv->resend_cont)
p_priv->resend_cont = reset_port + 1; p_priv->resend_cont = reset_port + 1;
if (this_urb->status == -EINPROGRESS) { if (this_urb->status == -EINPROGRESS) {
dbg("%s already writing", __func__); dev_dbg(&port->dev, "%s already writing\n", __func__);
mdelay(5); mdelay(5);
return -1; return -1;
} }
...@@ -2151,13 +2162,12 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, ...@@ -2151,13 +2162,12 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
if (p_priv->old_baud != p_priv->baud) { if (p_priv->old_baud != p_priv->baud) {
p_priv->old_baud = p_priv->baud; p_priv->old_baud = p_priv->baud;
msg.setClocking = 0x01; msg.setClocking = 0x01;
if (d_details->calculate_baud_rate if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
(p_priv->baud, d_details->baudclk, &msg.baudHi, &msg.baudHi, &msg.baudLo, &prescaler, 0) == KEYSPAN_INVALID_BAUD_RATE) {
&msg.baudLo, &prescaler, 0) == KEYSPAN_INVALID_BAUD_RATE) { dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
dbg("%s - Invalid baud rate %d requested, using 9600.",
__func__, p_priv->baud); __func__, p_priv->baud);
p_priv->baud = 9600; p_priv->baud = 9600;
d_details->calculate_baud_rate(p_priv->baud, d_details->baudclk, d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
&msg.baudHi, &msg.baudLo, &prescaler, 0); &msg.baudHi, &msg.baudLo, &prescaler, 0);
} }
msg.setRxMode = 1; msg.setRxMode = 1;
...@@ -2239,7 +2249,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial, ...@@ -2239,7 +2249,7 @@ static int keyspan_usa90_send_setup(struct usb_serial *serial,
err = usb_submit_urb(this_urb, GFP_ATOMIC); err = usb_submit_urb(this_urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, err); dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
return 0; return 0;
} }
...@@ -2265,7 +2275,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, ...@@ -2265,7 +2275,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
/* Make sure we have an urb then send the message */ /* Make sure we have an urb then send the message */
if (this_urb == NULL) { if (this_urb == NULL) {
dbg("%s - oops no urb for port %d.", __func__, dev_dbg(&port->dev, "%s - oops no urb for port %d.\n", __func__,
port->number); port->number);
return -1; return -1;
} }
...@@ -2275,7 +2285,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, ...@@ -2275,7 +2285,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
if ((reset_port + 1) > p_priv->resend_cont) if ((reset_port + 1) > p_priv->resend_cont)
p_priv->resend_cont = reset_port + 1; p_priv->resend_cont = reset_port + 1;
if (this_urb->status == -EINPROGRESS) { if (this_urb->status == -EINPROGRESS) {
/* dbg("%s - already writing", __func__); */ /* dev_dbg(&port->dev, "%s - already writing\n", __func__); */
mdelay(5); mdelay(5);
return -1; return -1;
} }
...@@ -2288,10 +2298,10 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, ...@@ -2288,10 +2298,10 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
if (p_priv->old_baud != p_priv->baud) { if (p_priv->old_baud != p_priv->baud) {
p_priv->old_baud = p_priv->baud; p_priv->old_baud = p_priv->baud;
msg.setClocking = 0xff; msg.setClocking = 0xff;
if (d_details->calculate_baud_rate if (d_details->calculate_baud_rate(port, p_priv->baud, d_details->baudclk,
(p_priv->baud, d_details->baudclk, &msg.baudHi, &msg.baudHi, &msg.baudLo, &msg.prescaler,
&msg.baudLo, &msg.prescaler, device_port) == KEYSPAN_INVALID_BAUD_RATE) { device_port) == KEYSPAN_INVALID_BAUD_RATE) {
dbg("%s - Invalid baud rate %d requested, using 9600.", dev_dbg(&port->dev, "%s - Invalid baud rate %d requested, using 9600.\n",
__func__, p_priv->baud); __func__, p_priv->baud);
msg.baudLo = 0; msg.baudLo = 0;
msg.baudHi = 125; /* Values for 9600 baud */ msg.baudHi = 125; /* Values for 9600 baud */
...@@ -2383,8 +2393,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial, ...@@ -2383,8 +2393,7 @@ static int keyspan_usa67_send_setup(struct usb_serial *serial,
err = usb_submit_urb(this_urb, GFP_ATOMIC); err = usb_submit_urb(this_urb, GFP_ATOMIC);
if (err != 0) if (err != 0)
dbg("%s - usb_submit_urb(setup) failed (%d)", __func__, dev_dbg(&port->dev, "%s - usb_submit_urb(setup) failed (%d)\n", __func__, err);
err);
return 0; return 0;
} }
...@@ -2440,8 +2449,7 @@ static int keyspan_startup(struct usb_serial *serial) ...@@ -2440,8 +2449,7 @@ static int keyspan_startup(struct usb_serial *serial)
/* Setup private data for serial driver */ /* Setup private data for serial driver */
s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL); s_priv = kzalloc(sizeof(struct keyspan_serial_private), GFP_KERNEL);
if (!s_priv) { if (!s_priv) {
dbg("%s - kmalloc for keyspan_serial_private failed.", dev_dbg(&serial->dev->dev, "%s - kmalloc for keyspan_serial_private failed.\n", __func__);
__func__);
return -ENOMEM; return -ENOMEM;
} }
...@@ -2454,7 +2462,7 @@ static int keyspan_startup(struct usb_serial *serial) ...@@ -2454,7 +2462,7 @@ static int keyspan_startup(struct usb_serial *serial)
p_priv = kzalloc(sizeof(struct keyspan_port_private), p_priv = kzalloc(sizeof(struct keyspan_port_private),
GFP_KERNEL); GFP_KERNEL);
if (!p_priv) { if (!p_priv) {
dbg("%s - kmalloc for keyspan_port_private (%d) failed!.", __func__, i); dev_dbg(&port->dev, "%s - kmalloc for keyspan_port_private (%d) failed!.\n", __func__, i);
return 1; return 1;
} }
p_priv->device_details = d_details; p_priv->device_details = d_details;
...@@ -2466,13 +2474,13 @@ static int keyspan_startup(struct usb_serial *serial) ...@@ -2466,13 +2474,13 @@ static int keyspan_startup(struct usb_serial *serial)
if (s_priv->instat_urb != NULL) { if (s_priv->instat_urb != NULL) {
err = usb_submit_urb(s_priv->instat_urb, GFP_KERNEL); err = usb_submit_urb(s_priv->instat_urb, GFP_KERNEL);
if (err != 0) if (err != 0)
dbg("%s - submit instat urb failed %d", __func__, dev_dbg(&port->dev, "%s - submit instat urb failed %d\n", __func__,
err); err);
} }
if (s_priv->indat_urb != NULL) { if (s_priv->indat_urb != NULL) {
err = usb_submit_urb(s_priv->indat_urb, GFP_KERNEL); err = usb_submit_urb(s_priv->indat_urb, GFP_KERNEL);
if (err != 0) if (err != 0)
dbg("%s - submit indat urb failed %d", __func__, dev_dbg(&port->dev, "%s - submit indat urb failed %d\n", __func__,
err); err);
} }
...@@ -2527,10 +2535,8 @@ static void keyspan_release(struct usb_serial *serial) ...@@ -2527,10 +2535,8 @@ static void keyspan_release(struct usb_serial *serial)
s_priv = usb_get_serial_data(serial); s_priv = usb_get_serial_data(serial);
/* dbg("Freeing serial->private."); */
kfree(s_priv); kfree(s_priv);
/* dbg("Freeing port->private."); */
/* Now free per port private data */ /* Now free per port private data */
for (i = 0; i < serial->num_ports; i++) { for (i = 0; i < serial->num_ports; i++) {
port = serial->port[i]; port = serial->port[i];
......
...@@ -64,19 +64,23 @@ static int keyspan_tiocmset (struct tty_struct *tty, ...@@ -64,19 +64,23 @@ static int keyspan_tiocmset (struct tty_struct *tty,
unsigned int clear); unsigned int clear);
static int keyspan_fake_startup (struct usb_serial *serial); static int keyspan_fake_startup (struct usb_serial *serial);
static int keyspan_usa19_calc_baud (u32 baud_rate, u32 baudclk, static int keyspan_usa19_calc_baud (struct usb_serial_port *port,
u32 baud_rate, u32 baudclk,
u8 *rate_hi, u8 *rate_low, u8 *rate_hi, u8 *rate_low,
u8 *prescaler, int portnum); u8 *prescaler, int portnum);
static int keyspan_usa19w_calc_baud (u32 baud_rate, u32 baudclk, static int keyspan_usa19w_calc_baud (struct usb_serial_port *port,
u32 baud_rate, u32 baudclk,
u8 *rate_hi, u8 *rate_low, u8 *rate_hi, u8 *rate_low,
u8 *prescaler, int portnum); u8 *prescaler, int portnum);
static int keyspan_usa28_calc_baud (u32 baud_rate, u32 baudclk, static int keyspan_usa28_calc_baud (struct usb_serial_port *port,
u32 baud_rate, u32 baudclk,
u8 *rate_hi, u8 *rate_low, u8 *rate_hi, u8 *rate_low,
u8 *prescaler, int portnum); u8 *prescaler, int portnum);
static int keyspan_usa19hs_calc_baud (u32 baud_rate, u32 baudclk, static int keyspan_usa19hs_calc_baud (struct usb_serial_port *port,
u32 baud_rate, u32 baudclk,
u8 *rate_hi, u8 *rate_low, u8 *rate_hi, u8 *rate_low,
u8 *prescaler, int portnum); u8 *prescaler, int portnum);
...@@ -188,7 +192,8 @@ struct keyspan_device_details { ...@@ -188,7 +192,8 @@ struct keyspan_device_details {
/* Endpoint used for global control functions */ /* Endpoint used for global control functions */
int glocont_endpoint; int glocont_endpoint;
int (*calculate_baud_rate) (u32 baud_rate, u32 baudclk, int (*calculate_baud_rate) (struct usb_serial_port *port,
u32 baud_rate, u32 baudclk,
u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum); u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum);
u32 baudclk; u32 baudclk;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment