Commit 9eecf808 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: serial: mos7720.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: Alan Stern <stern@rowland.harvard.edu>
CC: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4a770cca
...@@ -283,14 +283,17 @@ static void send_deferred_urbs(unsigned long _mos_parport) ...@@ -283,14 +283,17 @@ static void send_deferred_urbs(unsigned long _mos_parport)
struct mos7715_parport *mos_parport = (void *)_mos_parport; struct mos7715_parport *mos_parport = (void *)_mos_parport;
struct urbtracker *urbtrack, *tmp; struct urbtracker *urbtrack, *tmp;
struct list_head *cursor, *next; struct list_head *cursor, *next;
struct device *dev;
/* if release function ran, game over */ /* if release function ran, game over */
if (unlikely(mos_parport->serial == NULL)) if (unlikely(mos_parport->serial == NULL))
return; return;
dev = &mos_parport->serial->dev->dev;
/* try again to get the mutex */ /* try again to get the mutex */
if (!mutex_trylock(&mos_parport->serial->disc_mutex)) { if (!mutex_trylock(&mos_parport->serial->disc_mutex)) {
dbg("%s: rescheduling tasklet", __func__); dev_dbg(dev, "%s: rescheduling tasklet\n", __func__);
tasklet_schedule(&mos_parport->urb_tasklet); tasklet_schedule(&mos_parport->urb_tasklet);
return; return;
} }
...@@ -305,7 +308,7 @@ static void send_deferred_urbs(unsigned long _mos_parport) ...@@ -305,7 +308,7 @@ static void send_deferred_urbs(unsigned long _mos_parport)
if (list_empty(&mos_parport->deferred_urbs)) { if (list_empty(&mos_parport->deferred_urbs)) {
spin_unlock_irqrestore(&mos_parport->listlock, flags); spin_unlock_irqrestore(&mos_parport->listlock, flags);
mutex_unlock(&mos_parport->serial->disc_mutex); mutex_unlock(&mos_parport->serial->disc_mutex);
dbg("%s: deferred_urbs list empty", __func__); dev_dbg(dev, "%s: deferred_urbs list empty\n", __func__);
return; return;
} }
...@@ -315,10 +318,9 @@ static void send_deferred_urbs(unsigned long _mos_parport) ...@@ -315,10 +318,9 @@ static void send_deferred_urbs(unsigned long _mos_parport)
list_for_each_entry_safe(urbtrack, tmp, &mos_parport->active_urbs, list_for_each_entry_safe(urbtrack, tmp, &mos_parport->active_urbs,
urblist_entry) { urblist_entry) {
ret_val = usb_submit_urb(urbtrack->urb, GFP_ATOMIC); ret_val = usb_submit_urb(urbtrack->urb, GFP_ATOMIC);
dbg("%s: urb submitted", __func__); dev_dbg(dev, "%s: urb submitted\n", __func__);
if (ret_val) { if (ret_val) {
dev_err(&mos_parport->serial->dev->dev, dev_err(dev, "usb_submit_urb() failed: %d\n", ret_val);
"usb_submit_urb() failed: %d", ret_val);
list_del(&urbtrack->urblist_entry); list_del(&urbtrack->urblist_entry);
kref_put(&urbtrack->ref_count, destroy_urbtracker); kref_put(&urbtrack->ref_count, destroy_urbtracker);
} }
...@@ -334,7 +336,7 @@ static void async_complete(struct urb *urb) ...@@ -334,7 +336,7 @@ static void async_complete(struct urb *urb)
int status = urb->status; int status = urb->status;
if (unlikely(status)) if (unlikely(status))
dbg("%s - nonzero urb status received: %d", __func__, status); dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", __func__, status);
/* remove the urbtracker from the active_urbs list */ /* remove the urbtracker from the active_urbs list */
spin_lock(&urbtrack->mos_parport->listlock); spin_lock(&urbtrack->mos_parport->listlock);
...@@ -389,7 +391,7 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport, ...@@ -389,7 +391,7 @@ static int write_parport_reg_nonblock(struct mos7715_parport *mos_parport,
&mos_parport->deferred_urbs); &mos_parport->deferred_urbs);
spin_unlock_irqrestore(&mos_parport->listlock, flags); spin_unlock_irqrestore(&mos_parport->listlock, flags);
tasklet_schedule(&mos_parport->urb_tasklet); tasklet_schedule(&mos_parport->urb_tasklet);
dbg("tasklet scheduled"); dev_dbg(&usbdev->dev, "tasklet scheduled");
return 0; return 0;
} }
...@@ -690,7 +692,7 @@ static int mos7715_parport_init(struct usb_serial *serial) ...@@ -690,7 +692,7 @@ static int mos7715_parport_init(struct usb_serial *serial)
/* allocate and initialize parallel port control struct */ /* allocate and initialize parallel port control struct */
mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL); mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL);
if (mos_parport == NULL) { if (mos_parport == NULL) {
dbg("mos7715_parport_init: kzalloc failed"); dev_dbg(&serial->dev->dev, "%s: kzalloc failed\n", __func__);
return -ENOMEM; return -ENOMEM;
} }
mos_parport->msg_pending = false; mos_parport->msg_pending = false;
...@@ -743,6 +745,7 @@ static void mos7720_interrupt_callback(struct urb *urb) ...@@ -743,6 +745,7 @@ static void mos7720_interrupt_callback(struct urb *urb)
int result; int result;
int length; int length;
int status = urb->status; int status = urb->status;
struct device *dev = &urb->dev->dev;
__u8 *data; __u8 *data;
__u8 sp1; __u8 sp1;
__u8 sp2; __u8 sp2;
...@@ -755,12 +758,10 @@ static void mos7720_interrupt_callback(struct urb *urb) ...@@ -755,12 +758,10 @@ static void mos7720_interrupt_callback(struct urb *urb)
case -ENOENT: case -ENOENT:
case -ESHUTDOWN: case -ESHUTDOWN:
/* this urb is terminated, clean up */ /* this urb is terminated, clean up */
dbg("%s - urb shutting down with status: %d", __func__, dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status);
status);
return; return;
default: default:
dbg("%s - nonzero urb status received: %d", __func__, dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status);
status);
goto exit; goto exit;
} }
...@@ -777,7 +778,7 @@ static void mos7720_interrupt_callback(struct urb *urb) ...@@ -777,7 +778,7 @@ static void mos7720_interrupt_callback(struct urb *urb)
* oneukum 2007-03-14 */ * oneukum 2007-03-14 */
if (unlikely(length != 4)) { if (unlikely(length != 4)) {
dbg("Wrong data !!!"); dev_dbg(dev, "Wrong data !!!\n");
return; return;
} }
...@@ -786,31 +787,29 @@ static void mos7720_interrupt_callback(struct urb *urb) ...@@ -786,31 +787,29 @@ static void mos7720_interrupt_callback(struct urb *urb)
if ((sp1 | sp2) & 0x01) { if ((sp1 | sp2) & 0x01) {
/* No Interrupt Pending in both the ports */ /* No Interrupt Pending in both the ports */
dbg("No Interrupt !!!"); dev_dbg(dev, "No Interrupt !!!\n");
} else { } else {
switch (sp1 & 0x0f) { switch (sp1 & 0x0f) {
case SERIAL_IIR_RLS: case SERIAL_IIR_RLS:
dbg("Serial Port 1: Receiver status error or address " dev_dbg(dev, "Serial Port 1: Receiver status error or address bit detected in 9-bit mode\n");
"bit detected in 9-bit mode\n");
break; break;
case SERIAL_IIR_CTI: case SERIAL_IIR_CTI:
dbg("Serial Port 1: Receiver time out"); dev_dbg(dev, "Serial Port 1: Receiver time out\n");
break; break;
case SERIAL_IIR_MS: case SERIAL_IIR_MS:
/* dbg("Serial Port 1: Modem status change"); */ /* dev_dbg(dev, "Serial Port 1: Modem status change\n"); */
break; break;
} }
switch (sp2 & 0x0f) { switch (sp2 & 0x0f) {
case SERIAL_IIR_RLS: case SERIAL_IIR_RLS:
dbg("Serial Port 2: Receiver status error or address " dev_dbg(dev, "Serial Port 2: Receiver status error or address bit detected in 9-bit mode\n");
"bit detected in 9-bit mode");
break; break;
case SERIAL_IIR_CTI: case SERIAL_IIR_CTI:
dbg("Serial Port 2: Receiver time out"); dev_dbg(dev, "Serial Port 2: Receiver time out\n");
break; break;
case SERIAL_IIR_MS: case SERIAL_IIR_MS:
/* dbg("Serial Port 2: Modem status change"); */ /* dev_dbg(dev, "Serial Port 2: Modem status change\n"); */
break; break;
} }
} }
...@@ -818,9 +817,7 @@ static void mos7720_interrupt_callback(struct urb *urb) ...@@ -818,9 +817,7 @@ static void mos7720_interrupt_callback(struct urb *urb)
exit: exit:
result = usb_submit_urb(urb, GFP_ATOMIC); result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) if (result)
dev_err(&urb->dev->dev, dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result);
"%s - Error %d submitting control urb\n",
__func__, result);
} }
/* /*
...@@ -833,6 +830,7 @@ static void mos7715_interrupt_callback(struct urb *urb) ...@@ -833,6 +830,7 @@ static void mos7715_interrupt_callback(struct urb *urb)
int result; int result;
int length; int length;
int status = urb->status; int status = urb->status;
struct device *dev = &urb->dev->dev;
__u8 *data; __u8 *data;
__u8 iir; __u8 iir;
...@@ -845,12 +843,10 @@ static void mos7715_interrupt_callback(struct urb *urb) ...@@ -845,12 +843,10 @@ static void mos7715_interrupt_callback(struct urb *urb)
case -ESHUTDOWN: case -ESHUTDOWN:
case -ENODEV: case -ENODEV:
/* this urb is terminated, clean up */ /* this urb is terminated, clean up */
dbg("%s - urb shutting down with status: %d", __func__, dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status);
status);
return; return;
default: default:
dbg("%s - nonzero urb status received: %d", __func__, dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status);
status);
goto exit; goto exit;
} }
...@@ -864,7 +860,7 @@ static void mos7715_interrupt_callback(struct urb *urb) ...@@ -864,7 +860,7 @@ static void mos7715_interrupt_callback(struct urb *urb)
* Byte 4: FIFO status for both */ * Byte 4: FIFO status for both */
if (unlikely(length != 4)) { if (unlikely(length != 4)) {
dbg("Wrong data !!!"); dev_dbg(dev, "Wrong data !!!\n");
return; return;
} }
...@@ -872,14 +868,13 @@ static void mos7715_interrupt_callback(struct urb *urb) ...@@ -872,14 +868,13 @@ static void mos7715_interrupt_callback(struct urb *urb)
if (!(iir & 0x01)) { /* serial port interrupt pending */ if (!(iir & 0x01)) { /* serial port interrupt pending */
switch (iir & 0x0f) { switch (iir & 0x0f) {
case SERIAL_IIR_RLS: case SERIAL_IIR_RLS:
dbg("Serial Port: Receiver status error or address " dev_dbg(dev, "Serial Port: Receiver status error or address bit detected in 9-bit mode\n\n");
"bit detected in 9-bit mode\n");
break; break;
case SERIAL_IIR_CTI: case SERIAL_IIR_CTI:
dbg("Serial Port: Receiver time out"); dev_dbg(dev, "Serial Port: Receiver time out\n");
break; break;
case SERIAL_IIR_MS: case SERIAL_IIR_MS:
/* dbg("Serial Port: Modem status change"); */ /* dev_dbg(dev, "Serial Port: Modem status change\n"); */
break; break;
} }
} }
...@@ -897,9 +892,7 @@ static void mos7715_interrupt_callback(struct urb *urb) ...@@ -897,9 +892,7 @@ static void mos7715_interrupt_callback(struct urb *urb)
exit: exit:
result = usb_submit_urb(urb, GFP_ATOMIC); result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) if (result)
dev_err(&urb->dev->dev, dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result);
"%s - Error %d submitting control urb\n",
__func__, result);
} }
/* /*
...@@ -916,13 +909,13 @@ static void mos7720_bulk_in_callback(struct urb *urb) ...@@ -916,13 +909,13 @@ static void mos7720_bulk_in_callback(struct urb *urb)
int status = urb->status; int status = urb->status;
if (status) { if (status) {
dbg("nonzero read bulk status received: %d", status); dev_dbg(&urb->dev->dev, "nonzero read bulk status received: %d\n", status);
return; return;
} }
port = urb->context; port = urb->context;
dbg("Entering...%s", __func__); dev_dbg(&port->dev, "Entering...%s\n", __func__);
data = urb->transfer_buffer; data = urb->transfer_buffer;
...@@ -936,8 +929,7 @@ static void mos7720_bulk_in_callback(struct urb *urb) ...@@ -936,8 +929,7 @@ static void mos7720_bulk_in_callback(struct urb *urb)
if (port->read_urb->status != -EINPROGRESS) { if (port->read_urb->status != -EINPROGRESS) {
retval = usb_submit_urb(port->read_urb, GFP_ATOMIC); retval = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (retval) if (retval)
dbg("usb_submit_urb(read bulk) failed, retval = %d", dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, retval = %d\n", retval);
retval);
} }
} }
...@@ -953,13 +945,13 @@ static void mos7720_bulk_out_data_callback(struct urb *urb) ...@@ -953,13 +945,13 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
int status = urb->status; int status = urb->status;
if (status) { if (status) {
dbg("nonzero write bulk status received:%d", status); dev_dbg(&urb->dev->dev, "nonzero write bulk status received:%d\n", status);
return; return;
} }
mos7720_port = urb->context; mos7720_port = urb->context;
if (!mos7720_port) { if (!mos7720_port) {
dbg("NULL mos7720_port pointer"); dev_dbg(&urb->dev->dev, "NULL mos7720_port pointer\n");
return ; return ;
} }
...@@ -1061,9 +1053,7 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -1061,9 +1053,7 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port)
port_number = port->number - port->serial->minor; port_number = port->number - port->serial->minor;
read_mos_reg(serial, port_number, LSR, &data); read_mos_reg(serial, port_number, LSR, &data);
dbg("SS::%p LSR:%x", mos7720_port, data); dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data);
dbg("Check:Sending Command ..........");
write_mos_reg(serial, dummy, SP1_REG, 0x02); write_mos_reg(serial, dummy, SP1_REG, 0x02);
write_mos_reg(serial, dummy, SP2_REG, 0x02); write_mos_reg(serial, dummy, SP2_REG, 0x02);
...@@ -1122,20 +1112,16 @@ static int mos7720_chars_in_buffer(struct tty_struct *tty) ...@@ -1122,20 +1112,16 @@ static int mos7720_chars_in_buffer(struct tty_struct *tty)
int chars = 0; int chars = 0;
struct moschip_port *mos7720_port; struct moschip_port *mos7720_port;
dbg("%s:entering ...........", __func__);
mos7720_port = usb_get_serial_port_data(port); mos7720_port = usb_get_serial_port_data(port);
if (mos7720_port == NULL) { if (mos7720_port == NULL)
dbg("%s:leaving ...........", __func__);
return 0; return 0;
}
for (i = 0; i < NUM_URBS; ++i) { for (i = 0; i < NUM_URBS; ++i) {
if (mos7720_port->write_urb_pool[i] && if (mos7720_port->write_urb_pool[i] &&
mos7720_port->write_urb_pool[i]->status == -EINPROGRESS) mos7720_port->write_urb_pool[i]->status == -EINPROGRESS)
chars += URB_TRANSFER_BUFFER_SIZE; chars += URB_TRANSFER_BUFFER_SIZE;
} }
dbg("%s - returns %d", __func__, chars); dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
return chars; return chars;
} }
...@@ -1145,8 +1131,6 @@ static void mos7720_close(struct usb_serial_port *port) ...@@ -1145,8 +1131,6 @@ static void mos7720_close(struct usb_serial_port *port)
struct moschip_port *mos7720_port; struct moschip_port *mos7720_port;
int j; int j;
dbg("mos7720_close:entering...");
serial = port->serial; serial = port->serial;
mos7720_port = usb_get_serial_port_data(port); mos7720_port = usb_get_serial_port_data(port);
...@@ -1166,9 +1150,7 @@ static void mos7720_close(struct usb_serial_port *port) ...@@ -1166,9 +1150,7 @@ static void mos7720_close(struct usb_serial_port *port)
/* While closing port, shutdown all bulk read, write * /* While closing port, shutdown all bulk read, write *
* and interrupt read if they exists, otherwise nop */ * and interrupt read if they exists, otherwise nop */
dbg("Shutdown bulk write");
usb_kill_urb(port->write_urb); usb_kill_urb(port->write_urb);
dbg("Shutdown bulk read");
usb_kill_urb(port->read_urb); usb_kill_urb(port->read_urb);
mutex_lock(&serial->disc_mutex); mutex_lock(&serial->disc_mutex);
...@@ -1182,8 +1164,6 @@ static void mos7720_close(struct usb_serial_port *port) ...@@ -1182,8 +1164,6 @@ static void mos7720_close(struct usb_serial_port *port)
} }
mutex_unlock(&serial->disc_mutex); mutex_unlock(&serial->disc_mutex);
mos7720_port->open = 0; mos7720_port->open = 0;
dbg("Leaving %s", __func__);
} }
static void mos7720_break(struct tty_struct *tty, int break_state) static void mos7720_break(struct tty_struct *tty, int break_state)
...@@ -1193,8 +1173,6 @@ static void mos7720_break(struct tty_struct *tty, int break_state) ...@@ -1193,8 +1173,6 @@ static void mos7720_break(struct tty_struct *tty, int break_state)
struct usb_serial *serial; struct usb_serial *serial;
struct moschip_port *mos7720_port; struct moschip_port *mos7720_port;
dbg("Entering %s", __func__);
serial = port->serial; serial = port->serial;
mos7720_port = usb_get_serial_port_data(port); mos7720_port = usb_get_serial_port_data(port);
...@@ -1225,13 +1203,9 @@ static int mos7720_write_room(struct tty_struct *tty) ...@@ -1225,13 +1203,9 @@ static int mos7720_write_room(struct tty_struct *tty)
int room = 0; int room = 0;
int i; int i;
dbg("%s:entering ...........", __func__);
mos7720_port = usb_get_serial_port_data(port); mos7720_port = usb_get_serial_port_data(port);
if (mos7720_port == NULL) { if (mos7720_port == NULL)
dbg("%s:leaving ...........", __func__);
return -ENODEV; return -ENODEV;
}
/* FIXME: Locking */ /* FIXME: Locking */
for (i = 0; i < NUM_URBS; ++i) { for (i = 0; i < NUM_URBS; ++i) {
...@@ -1240,7 +1214,7 @@ static int mos7720_write_room(struct tty_struct *tty) ...@@ -1240,7 +1214,7 @@ static int mos7720_write_room(struct tty_struct *tty)
room += URB_TRANSFER_BUFFER_SIZE; room += URB_TRANSFER_BUFFER_SIZE;
} }
dbg("%s - returns %d", __func__, room); dev_dbg(&port->dev, "%s - returns %d\n", __func__, room);
return room; return room;
} }
...@@ -1257,15 +1231,11 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1257,15 +1231,11 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
struct urb *urb; struct urb *urb;
const unsigned char *current_position = data; const unsigned char *current_position = data;
dbg("%s:entering ...........", __func__);
serial = port->serial; serial = port->serial;
mos7720_port = usb_get_serial_port_data(port); mos7720_port = usb_get_serial_port_data(port);
if (mos7720_port == NULL) { if (mos7720_port == NULL)
dbg("mos7720_port is NULL");
return -ENODEV; return -ENODEV;
}
/* try to find a free urb in the list */ /* try to find a free urb in the list */
urb = NULL; urb = NULL;
...@@ -1274,13 +1244,13 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1274,13 +1244,13 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
if (mos7720_port->write_urb_pool[i] && if (mos7720_port->write_urb_pool[i] &&
mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) { mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) {
urb = mos7720_port->write_urb_pool[i]; urb = mos7720_port->write_urb_pool[i];
dbg("URB:%d", i); dev_dbg(&port->dev, "URB:%d\n", i);
break; break;
} }
} }
if (urb == NULL) { if (urb == NULL) {
dbg("%s - no more free urbs", __func__); dev_dbg(&port->dev, "%s - no more free urbs\n", __func__);
goto exit; goto exit;
} }
...@@ -1326,20 +1296,16 @@ static void mos7720_throttle(struct tty_struct *tty) ...@@ -1326,20 +1296,16 @@ static void mos7720_throttle(struct tty_struct *tty)
struct moschip_port *mos7720_port; struct moschip_port *mos7720_port;
int status; int status;
dbg("%s- port %d", __func__, port->number);
mos7720_port = usb_get_serial_port_data(port); mos7720_port = usb_get_serial_port_data(port);
if (mos7720_port == NULL) if (mos7720_port == NULL)
return; return;
if (!mos7720_port->open) { if (!mos7720_port->open) {
dbg("port not opened"); dev_dbg(&port->dev, "%s - port not opened\n", __func__);
return; return;
} }
dbg("%s: Entering ..........", __func__);
/* if we are implementing XON/XOFF, send the stop character */ /* if we are implementing XON/XOFF, send the stop character */
if (I_IXOFF(tty)) { if (I_IXOFF(tty)) {
unsigned char stop_char = STOP_CHAR(tty); unsigned char stop_char = STOP_CHAR(tty);
...@@ -1368,12 +1334,10 @@ static void mos7720_unthrottle(struct tty_struct *tty) ...@@ -1368,12 +1334,10 @@ static void mos7720_unthrottle(struct tty_struct *tty)
return; return;
if (!mos7720_port->open) { if (!mos7720_port->open) {
dbg("%s - port not opened", __func__); dev_dbg(&port->dev, "%s - port not opened\n", __func__);
return; return;
} }
dbg("%s: Entering ..........", __func__);
/* if we are implementing XON/XOFF, send the start character */ /* if we are implementing XON/XOFF, send the start character */
if (I_IXOFF(tty)) { if (I_IXOFF(tty)) {
unsigned char start_char = START_CHAR(tty); unsigned char start_char = START_CHAR(tty);
...@@ -1409,7 +1373,7 @@ static int set_higher_rates(struct moschip_port *mos7720_port, ...@@ -1409,7 +1373,7 @@ static int set_higher_rates(struct moschip_port *mos7720_port,
/*********************************************** /***********************************************
* Init Sequence for higher rates * Init Sequence for higher rates
***********************************************/ ***********************************************/
dbg("Sending Setting Commands .........."); dev_dbg(&port->dev, "Sending Setting Commands ..........\n");
port_number = port->number - port->serial->minor; port_number = port->number - port->serial->minor;
write_mos_reg(serial, port_number, IER, 0x00); write_mos_reg(serial, port_number, IER, 0x00);
...@@ -1478,7 +1442,7 @@ static struct divisor_table_entry divisor_table[] = { ...@@ -1478,7 +1442,7 @@ static struct divisor_table_entry divisor_table[] = {
* this function calculates the proper baud rate divisor for the specified * this function calculates the proper baud rate divisor for the specified
* baud rate. * baud rate.
*****************************************************************************/ *****************************************************************************/
static int calc_baud_rate_divisor(int baudrate, int *divisor) static int calc_baud_rate_divisor(struct usb_serial_port *port, int baudrate, int *divisor)
{ {
int i; int i;
__u16 custom; __u16 custom;
...@@ -1486,7 +1450,7 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor) ...@@ -1486,7 +1450,7 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor)
__u16 round; __u16 round;
dbg("%s - %d", __func__, baudrate); dev_dbg(&port->dev, "%s - %d\n", __func__, baudrate);
for (i = 0; i < ARRAY_SIZE(divisor_table); i++) { for (i = 0; i < ARRAY_SIZE(divisor_table); i++) {
if (divisor_table[i].baudrate == baudrate) { if (divisor_table[i].baudrate == baudrate) {
...@@ -1508,11 +1472,11 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor) ...@@ -1508,11 +1472,11 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor)
custom++; custom++;
*divisor = custom; *divisor = custom;
dbg("Baud %d = %d", baudrate, custom); dev_dbg(&port->dev, "Baud %d = %d\n", baudrate, custom);
return 0; return 0;
} }
dbg("Baud calculation Failed..."); dev_dbg(&port->dev, "Baud calculation Failed...\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1536,13 +1500,11 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port, ...@@ -1536,13 +1500,11 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port,
port = mos7720_port->port; port = mos7720_port->port;
serial = port->serial; serial = port->serial;
dbg("%s: Entering ..........", __func__);
number = port->number - port->serial->minor; number = port->number - port->serial->minor;
dbg("%s - port = %d, baud = %d", __func__, port->number, baudrate); dev_dbg(&port->dev, "%s - baud = %d\n", __func__, baudrate);
/* Calculate the Divisor */ /* Calculate the Divisor */
status = calc_baud_rate_divisor(baudrate, &divisor); status = calc_baud_rate_divisor(port, baudrate, &divisor);
if (status) { if (status) {
dev_err(&port->dev, "%s - bad baud rate\n", __func__); dev_err(&port->dev, "%s - bad baud rate\n", __func__);
return status; return status;
...@@ -1591,15 +1553,11 @@ static void change_port_settings(struct tty_struct *tty, ...@@ -1591,15 +1553,11 @@ static void change_port_settings(struct tty_struct *tty,
serial = port->serial; serial = port->serial;
port_number = port->number - port->serial->minor; port_number = port->number - port->serial->minor;
dbg("%s - port %d", __func__, port->number);
if (!mos7720_port->open) { if (!mos7720_port->open) {
dbg("%s - port not opened", __func__); dev_dbg(&port->dev, "%s - port not opened\n", __func__);
return; return;
} }
dbg("%s: Entering ..........", __func__);
lData = UART_LCR_WLEN8; lData = UART_LCR_WLEN8;
lStop = 0x00; /* 1 stop bit */ lStop = 0x00; /* 1 stop bit */
lParity = 0x00; /* No parity */ lParity = 0x00; /* No parity */
...@@ -1633,14 +1591,14 @@ static void change_port_settings(struct tty_struct *tty, ...@@ -1633,14 +1591,14 @@ static void change_port_settings(struct tty_struct *tty,
if (cflag & PARENB) { if (cflag & PARENB) {
if (cflag & PARODD) { if (cflag & PARODD) {
lParity = UART_LCR_PARITY; lParity = UART_LCR_PARITY;
dbg("%s - parity = odd", __func__); dev_dbg(&port->dev, "%s - parity = odd\n", __func__);
} else { } else {
lParity = (UART_LCR_EPAR | UART_LCR_PARITY); lParity = (UART_LCR_EPAR | UART_LCR_PARITY);
dbg("%s - parity = even", __func__); dev_dbg(&port->dev, "%s - parity = even\n", __func__);
} }
} else { } else {
dbg("%s - parity = none", __func__); dev_dbg(&port->dev, "%s - parity = none\n", __func__);
} }
if (cflag & CMSPAR) if (cflag & CMSPAR)
...@@ -1649,10 +1607,10 @@ static void change_port_settings(struct tty_struct *tty, ...@@ -1649,10 +1607,10 @@ static void change_port_settings(struct tty_struct *tty,
/* Change the Stop bit */ /* Change the Stop bit */
if (cflag & CSTOPB) { if (cflag & CSTOPB) {
lStop = UART_LCR_STOP; lStop = UART_LCR_STOP;
dbg("%s - stop bits = 2", __func__); dev_dbg(&port->dev, "%s - stop bits = 2\n", __func__);
} else { } else {
lStop = 0x00; lStop = 0x00;
dbg("%s - stop bits = 1", __func__); dev_dbg(&port->dev, "%s - stop bits = 1\n", __func__);
} }
#define LCR_BITS_MASK 0x03 /* Mask for bits/char field */ #define LCR_BITS_MASK 0x03 /* Mask for bits/char field */
...@@ -1698,7 +1656,7 @@ static void change_port_settings(struct tty_struct *tty, ...@@ -1698,7 +1656,7 @@ static void change_port_settings(struct tty_struct *tty,
baud = tty_get_baud_rate(tty); baud = tty_get_baud_rate(tty);
if (!baud) { if (!baud) {
/* pick a default, any default... */ /* pick a default, any default... */
dbg("Picked default baud..."); dev_dbg(&port->dev, "Picked default baud...\n");
baud = 9600; baud = 9600;
} }
...@@ -1709,7 +1667,7 @@ static void change_port_settings(struct tty_struct *tty, ...@@ -1709,7 +1667,7 @@ static void change_port_settings(struct tty_struct *tty,
return; return;
} }
dbg("%s - baud rate = %d", __func__, baud); dev_dbg(&port->dev, "%s - baud rate = %d\n", __func__, baud);
status = send_cmd_write_baud_rate(mos7720_port, baud); status = send_cmd_write_baud_rate(mos7720_port, baud);
/* FIXME: needs to write actual resulting baud back not just /* FIXME: needs to write actual resulting baud back not just
blindly do so */ blindly do so */
...@@ -1721,8 +1679,7 @@ static void change_port_settings(struct tty_struct *tty, ...@@ -1721,8 +1679,7 @@ static void change_port_settings(struct tty_struct *tty,
if (port->read_urb->status != -EINPROGRESS) { if (port->read_urb->status != -EINPROGRESS) {
status = usb_submit_urb(port->read_urb, GFP_ATOMIC); status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (status) if (status)
dbg("usb_submit_urb(read bulk) failed, status = %d", dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status);
status);
} }
} }
...@@ -1747,23 +1704,19 @@ static void mos7720_set_termios(struct tty_struct *tty, ...@@ -1747,23 +1704,19 @@ static void mos7720_set_termios(struct tty_struct *tty,
return; return;
if (!mos7720_port->open) { if (!mos7720_port->open) {
dbg("%s - port not opened", __func__); dev_dbg(&port->dev, "%s - port not opened\n", __func__);
return; return;
} }
dbg("%s\n", "setting termios - ASPIRE"); dev_dbg(&port->dev, "setting termios - ASPIRE\n");
cflag = tty->termios->c_cflag; cflag = tty->termios->c_cflag;
dbg("%s - cflag %08x iflag %08x", __func__, dev_dbg(&port->dev, "%s - cflag %08x iflag %08x\n", __func__,
tty->termios->c_cflag, tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag));
RELEVANT_IFLAG(tty->termios->c_iflag));
dbg("%s - old cflag %08x old iflag %08x", __func__, dev_dbg(&port->dev, "%s - old cflag %08x old iflag %08x\n", __func__,
old_termios->c_cflag, old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
RELEVANT_IFLAG(old_termios->c_iflag));
dbg("%s - port %d", __func__, port->number);
/* change the port settings to the new ones specified */ /* change the port settings to the new ones specified */
change_port_settings(tty, mos7720_port, old_termios); change_port_settings(tty, mos7720_port, old_termios);
...@@ -1771,8 +1724,7 @@ static void mos7720_set_termios(struct tty_struct *tty, ...@@ -1771,8 +1724,7 @@ static void mos7720_set_termios(struct tty_struct *tty,
if (port->read_urb->status != -EINPROGRESS) { if (port->read_urb->status != -EINPROGRESS) {
status = usb_submit_urb(port->read_urb, GFP_ATOMIC); status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (status) if (status)
dbg("usb_submit_urb(read bulk) failed, status = %d", dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status);
status);
} }
} }
...@@ -1800,7 +1752,7 @@ static int get_lsr_info(struct tty_struct *tty, ...@@ -1800,7 +1752,7 @@ static int get_lsr_info(struct tty_struct *tty,
read_mos_reg(port->serial, port_number, LSR, &data); read_mos_reg(port->serial, port_number, LSR, &data);
if ((data & (UART_LSR_TEMT | UART_LSR_THRE)) if ((data & (UART_LSR_TEMT | UART_LSR_THRE))
== (UART_LSR_TEMT | UART_LSR_THRE)) { == (UART_LSR_TEMT | UART_LSR_THRE)) {
dbg("%s -- Empty", __func__); dev_dbg(&port->dev, "%s -- Empty\n", __func__);
result = TIOCSER_TEMT; result = TIOCSER_TEMT;
} }
} }
...@@ -1817,8 +1769,6 @@ static int mos7720_tiocmget(struct tty_struct *tty) ...@@ -1817,8 +1769,6 @@ static int mos7720_tiocmget(struct tty_struct *tty)
unsigned int mcr ; unsigned int mcr ;
unsigned int msr ; unsigned int msr ;
dbg("%s - port %d", __func__, port->number);
mcr = mos7720_port->shadowMCR; mcr = mos7720_port->shadowMCR;
msr = mos7720_port->shadowMSR; msr = mos7720_port->shadowMSR;
...@@ -1829,8 +1779,6 @@ static int mos7720_tiocmget(struct tty_struct *tty) ...@@ -1829,8 +1779,6 @@ static int mos7720_tiocmget(struct tty_struct *tty)
| ((msr & UART_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */ | ((msr & UART_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */
| ((msr & UART_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */ | ((msr & UART_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */
dbg("%s -- %x", __func__, result);
return result; return result;
} }
...@@ -1840,8 +1788,6 @@ static int mos7720_tiocmset(struct tty_struct *tty, ...@@ -1840,8 +1788,6 @@ static int mos7720_tiocmset(struct tty_struct *tty,
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct moschip_port *mos7720_port = usb_get_serial_port_data(port); struct moschip_port *mos7720_port = usb_get_serial_port_data(port);
unsigned int mcr ; unsigned int mcr ;
dbg("%s - port %d", __func__, port->number);
dbg("he was at tiocmset");
mcr = mos7720_port->shadowMCR; mcr = mos7720_port->shadowMCR;
...@@ -1888,8 +1834,8 @@ static int mos7720_get_icount(struct tty_struct *tty, ...@@ -1888,8 +1834,8 @@ static int mos7720_get_icount(struct tty_struct *tty,
icount->brk = cnow.brk; icount->brk = cnow.brk;
icount->buf_overrun = cnow.buf_overrun; icount->buf_overrun = cnow.buf_overrun;
dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, dev_dbg(&port->dev, "%s TIOCGICOUNT RX=%d, TX=%d\n", __func__,
port->number, icount->rx, icount->tx); icount->rx, icount->tx);
return 0; return 0;
} }
...@@ -1975,29 +1921,28 @@ static int mos7720_ioctl(struct tty_struct *tty, ...@@ -1975,29 +1921,28 @@ static int mos7720_ioctl(struct tty_struct *tty,
if (mos7720_port == NULL) if (mos7720_port == NULL)
return -ENODEV; return -ENODEV;
dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); dev_dbg(&port->dev, "%s - cmd = 0x%x", __func__, cmd);
switch (cmd) { switch (cmd) {
case TIOCSERGETLSR: case TIOCSERGETLSR:
dbg("%s (%d) TIOCSERGETLSR", __func__, port->number); dev_dbg(&port->dev, "%s TIOCSERGETLSR\n", __func__);
return get_lsr_info(tty, mos7720_port, return get_lsr_info(tty, mos7720_port,
(unsigned int __user *)arg); (unsigned int __user *)arg);
/* FIXME: These should be using the mode methods */ /* FIXME: These should be using the mode methods */
case TIOCMBIS: case TIOCMBIS:
case TIOCMBIC: case TIOCMBIC:
dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET", dev_dbg(&port->dev, "%s TIOCMSET/TIOCMBIC/TIOCMSET\n", __func__);
__func__, port->number);
return set_modem_info(mos7720_port, cmd, return set_modem_info(mos7720_port, cmd,
(unsigned int __user *)arg); (unsigned int __user *)arg);
case TIOCGSERIAL: case TIOCGSERIAL:
dbg("%s (%d) TIOCGSERIAL", __func__, port->number); dev_dbg(&port->dev, "%s TIOCGSERIAL\n", __func__);
return get_serial_info(mos7720_port, return get_serial_info(mos7720_port,
(struct serial_struct __user *)arg); (struct serial_struct __user *)arg);
case TIOCMIWAIT: case TIOCMIWAIT:
dbg("%s (%d) TIOCMIWAIT", __func__, port->number); dev_dbg(&port->dev, "%s TIOCMIWAIT\n", __func__);
cprev = mos7720_port->icount; cprev = mos7720_port->icount;
while (1) { while (1) {
if (signal_pending(current)) if (signal_pending(current))
...@@ -2030,13 +1975,6 @@ static int mos7720_startup(struct usb_serial *serial) ...@@ -2030,13 +1975,6 @@ static int mos7720_startup(struct usb_serial *serial)
u16 product; u16 product;
int ret_val; int ret_val;
dbg("%s: Entering ..........", __func__);
if (!serial) {
dbg("Invalid Handler");
return -ENODEV;
}
product = le16_to_cpu(serial->dev->descriptor.idProduct); product = le16_to_cpu(serial->dev->descriptor.idProduct);
dev = serial->dev; dev = serial->dev;
...@@ -2081,8 +2019,8 @@ static int mos7720_startup(struct usb_serial *serial) ...@@ -2081,8 +2019,8 @@ static int mos7720_startup(struct usb_serial *serial)
mos7720_port->port = serial->port[i]; mos7720_port->port = serial->port[i];
usb_set_serial_port_data(serial->port[i], mos7720_port); usb_set_serial_port_data(serial->port[i], mos7720_port);
dbg("port number is %d", serial->port[i]->number); dev_dbg(&dev->dev, "port number is %d\n", serial->port[i]->number);
dbg("serial number is %d", serial->minor); dev_dbg(&dev->dev, "serial number is %d\n", serial->minor);
} }
...@@ -2106,7 +2044,7 @@ static int mos7720_startup(struct usb_serial *serial) ...@@ -2106,7 +2044,7 @@ static int mos7720_startup(struct usb_serial *serial)
#endif #endif
/* LSR For Port 1 */ /* LSR For Port 1 */
read_mos_reg(serial, 0, LSR, &data); read_mos_reg(serial, 0, LSR, &data);
dbg("LSR:%x", data); dev_dbg(&dev->dev, "LSR:%x\n", data);
return 0; return 0;
} }
......
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