USB: serial: kobil_sct.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: Alan Stern <stern@rowland.harvard.edu> CC: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -164,13 +164,15 @@ static int kobil_startup(struct usb_serial *serial)
|
|||||||
for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {
|
for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {
|
||||||
endpoint = &altsetting->endpoint[i];
|
endpoint = &altsetting->endpoint[i];
|
||||||
if (usb_endpoint_is_int_out(&endpoint->desc)) {
|
if (usb_endpoint_is_int_out(&endpoint->desc)) {
|
||||||
dbg("%s Found interrupt out endpoint. Address: %d",
|
dev_dbg(&serial->dev->dev,
|
||||||
|
"%s Found interrupt out endpoint. Address: %d\n",
|
||||||
__func__, endpoint->desc.bEndpointAddress);
|
__func__, endpoint->desc.bEndpointAddress);
|
||||||
priv->write_int_endpoint_address =
|
priv->write_int_endpoint_address =
|
||||||
endpoint->desc.bEndpointAddress;
|
endpoint->desc.bEndpointAddress;
|
||||||
}
|
}
|
||||||
if (usb_endpoint_is_int_in(&endpoint->desc)) {
|
if (usb_endpoint_is_int_in(&endpoint->desc)) {
|
||||||
dbg("%s Found interrupt in endpoint. Address: %d",
|
dev_dbg(&serial->dev->dev,
|
||||||
|
"%s Found interrupt in endpoint. Address: %d\n",
|
||||||
__func__, endpoint->desc.bEndpointAddress);
|
__func__, endpoint->desc.bEndpointAddress);
|
||||||
priv->read_int_endpoint_address =
|
priv->read_int_endpoint_address =
|
||||||
endpoint->desc.bEndpointAddress;
|
endpoint->desc.bEndpointAddress;
|
||||||
@@ -200,6 +202,7 @@ static void kobil_init_termios(struct tty_struct *tty)
|
|||||||
|
|
||||||
static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
|
static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
|
||||||
{
|
{
|
||||||
|
struct device *dev = &port->dev;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
struct kobil_private *priv;
|
struct kobil_private *priv;
|
||||||
unsigned char *transfer_buffer;
|
unsigned char *transfer_buffer;
|
||||||
@@ -215,12 +218,10 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
|
|||||||
|
|
||||||
/* allocate write_urb */
|
/* allocate write_urb */
|
||||||
if (!port->write_urb) {
|
if (!port->write_urb) {
|
||||||
dbg("%s - port %d Allocating port->write_urb",
|
dev_dbg(dev, "%s - Allocating port->write_urb\n", __func__);
|
||||||
__func__, port->number);
|
|
||||||
port->write_urb = usb_alloc_urb(0, GFP_KERNEL);
|
port->write_urb = usb_alloc_urb(0, GFP_KERNEL);
|
||||||
if (!port->write_urb) {
|
if (!port->write_urb) {
|
||||||
dbg("%s - port %d usb_alloc_urb failed",
|
dev_dbg(dev, "%s - usb_alloc_urb failed\n", __func__);
|
||||||
__func__, port->number);
|
|
||||||
kfree(transfer_buffer);
|
kfree(transfer_buffer);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
@@ -247,10 +248,9 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
|
|||||||
transfer_buffer_length,
|
transfer_buffer_length,
|
||||||
KOBIL_TIMEOUT
|
KOBIL_TIMEOUT
|
||||||
);
|
);
|
||||||
dbg("%s - port %d Send get_HW_version URB returns: %i",
|
dev_dbg(dev, "%s - Send get_HW_version URB returns: %i\n", __func__, result);
|
||||||
__func__, port->number, result);
|
dev_dbg(dev, "Harware version: %i.%i.%i\n", transfer_buffer[0],
|
||||||
dbg("Harware version: %i.%i.%i",
|
transfer_buffer[1], transfer_buffer[2]);
|
||||||
transfer_buffer[0], transfer_buffer[1], transfer_buffer[2]);
|
|
||||||
|
|
||||||
/* get firmware version */
|
/* get firmware version */
|
||||||
result = usb_control_msg(port->serial->dev,
|
result = usb_control_msg(port->serial->dev,
|
||||||
@@ -263,10 +263,9 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
|
|||||||
transfer_buffer_length,
|
transfer_buffer_length,
|
||||||
KOBIL_TIMEOUT
|
KOBIL_TIMEOUT
|
||||||
);
|
);
|
||||||
dbg("%s - port %d Send get_FW_version URB returns: %i",
|
dev_dbg(dev, "%s - Send get_FW_version URB returns: %i\n", __func__, result);
|
||||||
__func__, port->number, result);
|
dev_dbg(dev, "Firmware version: %i.%i.%i\n", transfer_buffer[0],
|
||||||
dbg("Firmware version: %i.%i.%i",
|
transfer_buffer[1], transfer_buffer[2]);
|
||||||
transfer_buffer[0], transfer_buffer[1], transfer_buffer[2]);
|
|
||||||
|
|
||||||
if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
|
if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
|
||||||
priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
|
priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
|
||||||
@@ -282,8 +281,7 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
|
|||||||
0,
|
0,
|
||||||
KOBIL_TIMEOUT
|
KOBIL_TIMEOUT
|
||||||
);
|
);
|
||||||
dbg("%s - port %d Send set_baudrate URB returns: %i",
|
dev_dbg(dev, "%s - Send set_baudrate URB returns: %i\n", __func__, result);
|
||||||
__func__, port->number, result);
|
|
||||||
|
|
||||||
/* reset all queues */
|
/* reset all queues */
|
||||||
result = usb_control_msg(port->serial->dev,
|
result = usb_control_msg(port->serial->dev,
|
||||||
@@ -296,16 +294,14 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
|
|||||||
0,
|
0,
|
||||||
KOBIL_TIMEOUT
|
KOBIL_TIMEOUT
|
||||||
);
|
);
|
||||||
dbg("%s - port %d Send reset_all_queues URB returns: %i",
|
dev_dbg(dev, "%s - Send reset_all_queues URB returns: %i\n", __func__, result);
|
||||||
__func__, port->number, result);
|
|
||||||
}
|
}
|
||||||
if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
|
if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
|
||||||
priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
|
priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
|
||||||
priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
|
priv->device_type == KOBIL_KAAN_SIM_PRODUCT_ID) {
|
||||||
/* start reading (Adapter B 'cause PNP string) */
|
/* start reading (Adapter B 'cause PNP string) */
|
||||||
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
|
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
|
||||||
dbg("%s - port %d Send read URB returns: %i",
|
dev_dbg(dev, "%s - Send read URB returns: %i\n", __func__, result);
|
||||||
__func__, port->number, result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kfree(transfer_buffer);
|
kfree(transfer_buffer);
|
||||||
@@ -333,11 +329,9 @@ static void kobil_read_int_callback(struct urb *urb)
|
|||||||
struct tty_struct *tty;
|
struct tty_struct *tty;
|
||||||
unsigned char *data = urb->transfer_buffer;
|
unsigned char *data = urb->transfer_buffer;
|
||||||
int status = urb->status;
|
int status = urb->status;
|
||||||
/* char *dbg_data; */
|
|
||||||
|
|
||||||
if (status) {
|
if (status) {
|
||||||
dbg("%s - port %d Read int status not zero: %d",
|
dev_dbg(&port->dev, "%s - Read int status not zero: %d\n", __func__, status);
|
||||||
__func__, port->number, status);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,6 +340,8 @@ static void kobil_read_int_callback(struct urb *urb)
|
|||||||
|
|
||||||
/* BEGIN DEBUG */
|
/* BEGIN DEBUG */
|
||||||
/*
|
/*
|
||||||
|
char *dbg_data;
|
||||||
|
|
||||||
dbg_data = kzalloc((3 * purb->actual_length + 10)
|
dbg_data = kzalloc((3 * purb->actual_length + 10)
|
||||||
* sizeof(char), GFP_KERNEL);
|
* sizeof(char), GFP_KERNEL);
|
||||||
if (! dbg_data) {
|
if (! dbg_data) {
|
||||||
@@ -354,7 +350,7 @@ static void kobil_read_int_callback(struct urb *urb)
|
|||||||
for (i = 0; i < purb->actual_length; i++) {
|
for (i = 0; i < purb->actual_length; i++) {
|
||||||
sprintf(dbg_data +3*i, "%02X ", data[i]);
|
sprintf(dbg_data +3*i, "%02X ", data[i]);
|
||||||
}
|
}
|
||||||
dbg(" <-- %s", dbg_data);
|
dev_dbg(&port->dev, " <-- %s\n", dbg_data);
|
||||||
kfree(dbg_data);
|
kfree(dbg_data);
|
||||||
*/
|
*/
|
||||||
/* END DEBUG */
|
/* END DEBUG */
|
||||||
@@ -365,8 +361,7 @@ static void kobil_read_int_callback(struct urb *urb)
|
|||||||
tty_kref_put(tty);
|
tty_kref_put(tty);
|
||||||
|
|
||||||
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
|
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
|
||||||
dbg("%s - port %d Send read URB returns: %i",
|
dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result);
|
||||||
__func__, port->number, result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -384,15 +379,14 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
|
|||||||
struct kobil_private *priv;
|
struct kobil_private *priv;
|
||||||
|
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
dbg("%s - port %d write request of 0 bytes",
|
dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__);
|
||||||
__func__, port->number);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv = usb_get_serial_port_data(port);
|
priv = usb_get_serial_port_data(port);
|
||||||
|
|
||||||
if (count > (KOBIL_BUF_LENGTH - priv->filled)) {
|
if (count > (KOBIL_BUF_LENGTH - priv->filled)) {
|
||||||
dbg("%s - port %d Error: write request bigger than buffer size", __func__, port->number);
|
dev_dbg(&port->dev, "%s - Error: write request bigger than buffer size\n", __func__);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,8 +426,7 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
|
|||||||
|
|
||||||
priv->cur_pos = priv->cur_pos + length;
|
priv->cur_pos = priv->cur_pos + length;
|
||||||
result = usb_submit_urb(port->write_urb, GFP_NOIO);
|
result = usb_submit_urb(port->write_urb, GFP_NOIO);
|
||||||
dbg("%s - port %d Send write URB returns: %i",
|
dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result);
|
||||||
__func__, port->number, result);
|
|
||||||
todo = priv->filled - priv->cur_pos;
|
todo = priv->filled - priv->cur_pos;
|
||||||
|
|
||||||
if (todo > 0)
|
if (todo > 0)
|
||||||
@@ -448,8 +441,7 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port,
|
|||||||
priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
|
priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
|
||||||
result = usb_submit_urb(port->interrupt_in_urb,
|
result = usb_submit_urb(port->interrupt_in_urb,
|
||||||
GFP_NOIO);
|
GFP_NOIO);
|
||||||
dbg("%s - port %d Send read URB returns: %i",
|
dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result);
|
||||||
__func__, port->number, result);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
@@ -493,8 +485,8 @@ static int kobil_tiocmget(struct tty_struct *tty)
|
|||||||
transfer_buffer_length,
|
transfer_buffer_length,
|
||||||
KOBIL_TIMEOUT);
|
KOBIL_TIMEOUT);
|
||||||
|
|
||||||
dbg("%s - port %d Send get_status_line_state URB returns: %i. Statusline: %02x",
|
dev_dbg(&port->dev, "%s - Send get_status_line_state URB returns: %i. Statusline: %02x\n",
|
||||||
__func__, port->number, result, transfer_buffer[0]);
|
__func__, result, transfer_buffer[0]);
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0)
|
if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0)
|
||||||
@@ -507,6 +499,7 @@ static int kobil_tiocmset(struct tty_struct *tty,
|
|||||||
unsigned int set, unsigned int clear)
|
unsigned int set, unsigned int clear)
|
||||||
{
|
{
|
||||||
struct usb_serial_port *port = tty->driver_data;
|
struct usb_serial_port *port = tty->driver_data;
|
||||||
|
struct device *dev = &port->dev;
|
||||||
struct kobil_private *priv;
|
struct kobil_private *priv;
|
||||||
int result;
|
int result;
|
||||||
int dtr = 0;
|
int dtr = 0;
|
||||||
@@ -538,11 +531,9 @@ static int kobil_tiocmset(struct tty_struct *tty,
|
|||||||
|
|
||||||
if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) {
|
if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID) {
|
||||||
if (dtr != 0)
|
if (dtr != 0)
|
||||||
dbg("%s - port %d Setting DTR",
|
dev_dbg(dev, "%s - Setting DTR\n", __func__);
|
||||||
__func__, port->number);
|
|
||||||
else
|
else
|
||||||
dbg("%s - port %d Clearing DTR",
|
dev_dbg(dev, "%s - Clearing DTR\n", __func__);
|
||||||
__func__, port->number);
|
|
||||||
result = usb_control_msg(port->serial->dev,
|
result = usb_control_msg(port->serial->dev,
|
||||||
usb_rcvctrlpipe(port->serial->dev, 0),
|
usb_rcvctrlpipe(port->serial->dev, 0),
|
||||||
SUSBCRequest_SetStatusLinesOrQueues,
|
SUSBCRequest_SetStatusLinesOrQueues,
|
||||||
@@ -554,11 +545,9 @@ static int kobil_tiocmset(struct tty_struct *tty,
|
|||||||
KOBIL_TIMEOUT);
|
KOBIL_TIMEOUT);
|
||||||
} else {
|
} else {
|
||||||
if (rts != 0)
|
if (rts != 0)
|
||||||
dbg("%s - port %d Setting RTS",
|
dev_dbg(dev, "%s - Setting RTS\n", __func__);
|
||||||
__func__, port->number);
|
|
||||||
else
|
else
|
||||||
dbg("%s - port %d Clearing RTS",
|
dev_dbg(dev, "%s - Clearing RTS\n", __func__);
|
||||||
__func__, port->number);
|
|
||||||
result = usb_control_msg(port->serial->dev,
|
result = usb_control_msg(port->serial->dev,
|
||||||
usb_rcvctrlpipe(port->serial->dev, 0),
|
usb_rcvctrlpipe(port->serial->dev, 0),
|
||||||
SUSBCRequest_SetStatusLinesOrQueues,
|
SUSBCRequest_SetStatusLinesOrQueues,
|
||||||
@@ -569,8 +558,7 @@ static int kobil_tiocmset(struct tty_struct *tty,
|
|||||||
0,
|
0,
|
||||||
KOBIL_TIMEOUT);
|
KOBIL_TIMEOUT);
|
||||||
}
|
}
|
||||||
dbg("%s - port %d Send set_status_line URB returns: %i",
|
dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, result);
|
||||||
__func__, port->number, result);
|
|
||||||
kfree(transfer_buffer);
|
kfree(transfer_buffer);
|
||||||
return (result < 0) ? result : 0;
|
return (result < 0) ? result : 0;
|
||||||
}
|
}
|
||||||
@@ -658,7 +646,8 @@ static int kobil_ioctl(struct tty_struct *tty,
|
|||||||
KOBIL_TIMEOUT
|
KOBIL_TIMEOUT
|
||||||
);
|
);
|
||||||
|
|
||||||
dbg("%s - port %d Send reset_all_queues (FLUSH) URB returns: %i", __func__, port->number, result);
|
dev_dbg(&port->dev,
|
||||||
|
"%s - Send reset_all_queues (FLUSH) URB returns: %i", __func__, result);
|
||||||
kfree(transfer_buffer);
|
kfree(transfer_buffer);
|
||||||
return (result < 0) ? -EIO: 0;
|
return (result < 0) ? -EIO: 0;
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user