struct mos7715_parport *mos_parport = (void *)_mos_parport;
struct urbtracker *urbtrack, *tmp;
struct list_head *cursor, *next;
+ struct device *dev;
/* if release function ran, game over */
if (unlikely(mos_parport->serial == NULL))
return;
+ dev = &mos_parport->serial->dev->dev;
+
/* try again to get the 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);
return;
}
if (list_empty(&mos_parport->deferred_urbs)) {
spin_unlock_irqrestore(&mos_parport->listlock, flags);
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;
}
list_for_each_entry_safe(urbtrack, tmp, &mos_parport->active_urbs,
urblist_entry) {
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) {
- dev_err(&mos_parport->serial->dev->dev,
- "usb_submit_urb() failed: %d", ret_val);
+ dev_err(dev, "usb_submit_urb() failed: %d\n", ret_val);
list_del(&urbtrack->urblist_entry);
kref_put(&urbtrack->ref_count, destroy_urbtracker);
}
int status = urb->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 */
spin_lock(&urbtrack->mos_parport->listlock);
&mos_parport->deferred_urbs);
spin_unlock_irqrestore(&mos_parport->listlock, flags);
tasklet_schedule(&mos_parport->urb_tasklet);
- dbg("tasklet scheduled");
+ dev_dbg(&usbdev->dev, "tasklet scheduled");
return 0;
}
/* allocate and initialize parallel port control struct */
mos_parport = kzalloc(sizeof(struct mos7715_parport), GFP_KERNEL);
if (mos_parport == NULL) {
- dbg("mos7715_parport_init: kzalloc failed");
+ dev_dbg(&serial->dev->dev, "%s: kzalloc failed\n", __func__);
return -ENOMEM;
}
mos_parport->msg_pending = false;
int result;
int length;
int status = urb->status;
+ struct device *dev = &urb->dev->dev;
__u8 *data;
__u8 sp1;
__u8 sp2;
case -ENOENT:
case -ESHUTDOWN:
/* this urb is terminated, clean up */
- dbg("%s - urb shutting down with status: %d", __func__,
- status);
+ dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status);
return;
default:
- dbg("%s - nonzero urb status received: %d", __func__,
- status);
+ dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status);
goto exit;
}
* oneukum 2007-03-14 */
if (unlikely(length != 4)) {
- dbg("Wrong data !!!");
+ dev_dbg(dev, "Wrong data !!!\n");
return;
}
if ((sp1 | sp2) & 0x01) {
/* No Interrupt Pending in both the ports */
- dbg("No Interrupt !!!");
+ dev_dbg(dev, "No Interrupt !!!\n");
} else {
switch (sp1 & 0x0f) {
case SERIAL_IIR_RLS:
- dbg("Serial Port 1: Receiver status error or address "
- "bit detected in 9-bit mode\n");
+ dev_dbg(dev, "Serial Port 1: Receiver status error or address bit detected in 9-bit mode\n");
break;
case SERIAL_IIR_CTI:
- dbg("Serial Port 1: Receiver time out");
+ dev_dbg(dev, "Serial Port 1: Receiver time out\n");
break;
case SERIAL_IIR_MS:
- /* dbg("Serial Port 1: Modem status change"); */
+ /* dev_dbg(dev, "Serial Port 1: Modem status change\n"); */
break;
}
switch (sp2 & 0x0f) {
case SERIAL_IIR_RLS:
- dbg("Serial Port 2: Receiver status error or address "
- "bit detected in 9-bit mode");
+ dev_dbg(dev, "Serial Port 2: Receiver status error or address bit detected in 9-bit mode\n");
break;
case SERIAL_IIR_CTI:
- dbg("Serial Port 2: Receiver time out");
+ dev_dbg(dev, "Serial Port 2: Receiver time out\n");
break;
case SERIAL_IIR_MS:
- /* dbg("Serial Port 2: Modem status change"); */
+ /* dev_dbg(dev, "Serial Port 2: Modem status change\n"); */
break;
}
}
exit:
result = usb_submit_urb(urb, GFP_ATOMIC);
if (result)
- dev_err(&urb->dev->dev,
- "%s - Error %d submitting control urb\n",
- __func__, result);
+ dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result);
}
/*
int result;
int length;
int status = urb->status;
+ struct device *dev = &urb->dev->dev;
__u8 *data;
__u8 iir;
case -ESHUTDOWN:
case -ENODEV:
/* this urb is terminated, clean up */
- dbg("%s - urb shutting down with status: %d", __func__,
- status);
+ dev_dbg(dev, "%s - urb shutting down with status: %d\n", __func__, status);
return;
default:
- dbg("%s - nonzero urb status received: %d", __func__,
- status);
+ dev_dbg(dev, "%s - nonzero urb status received: %d\n", __func__, status);
goto exit;
}
* Byte 4: FIFO status for both */
if (unlikely(length != 4)) {
- dbg("Wrong data !!!");
+ dev_dbg(dev, "Wrong data !!!\n");
return;
}
if (!(iir & 0x01)) { /* serial port interrupt pending */
switch (iir & 0x0f) {
case SERIAL_IIR_RLS:
- dbg("Serial Port: Receiver status error or address "
- "bit detected in 9-bit mode\n");
+ dev_dbg(dev, "Serial Port: Receiver status error or address bit detected in 9-bit mode\n\n");
break;
case SERIAL_IIR_CTI:
- dbg("Serial Port: Receiver time out");
+ dev_dbg(dev, "Serial Port: Receiver time out\n");
break;
case SERIAL_IIR_MS:
- /* dbg("Serial Port: Modem status change"); */
+ /* dev_dbg(dev, "Serial Port: Modem status change\n"); */
break;
}
}
exit:
result = usb_submit_urb(urb, GFP_ATOMIC);
if (result)
- dev_err(&urb->dev->dev,
- "%s - Error %d submitting control urb\n",
- __func__, result);
+ dev_err(dev, "%s - Error %d submitting control urb\n", __func__, result);
}
/*
int status = urb->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;
}
port = urb->context;
- dbg("Entering...%s", __func__);
+ dev_dbg(&port->dev, "Entering...%s\n", __func__);
data = urb->transfer_buffer;
if (port->read_urb->status != -EINPROGRESS) {
retval = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (retval)
- dbg("usb_submit_urb(read bulk) failed, retval = %d",
- retval);
+ dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, retval = %d\n", retval);
}
}
int status = urb->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;
}
mos7720_port = urb->context;
if (!mos7720_port) {
- dbg("NULL mos7720_port pointer");
+ dev_dbg(&urb->dev->dev, "NULL mos7720_port pointer\n");
return ;
}
port_number = port->number - port->serial->minor;
read_mos_reg(serial, port_number, LSR, &data);
- dbg("SS::%p LSR:%x", mos7720_port, data);
-
- dbg("Check:Sending Command ..........");
+ dev_dbg(&port->dev, "SS::%p LSR:%x\n", mos7720_port, data);
write_mos_reg(serial, dummy, SP1_REG, 0x02);
write_mos_reg(serial, dummy, SP2_REG, 0x02);
int chars = 0;
struct moschip_port *mos7720_port;
- dbg("%s:entering ...........", __func__);
-
mos7720_port = usb_get_serial_port_data(port);
- if (mos7720_port == NULL) {
- dbg("%s:leaving ...........", __func__);
+ if (mos7720_port == NULL)
return 0;
- }
for (i = 0; i < NUM_URBS; ++i) {
if (mos7720_port->write_urb_pool[i] &&
mos7720_port->write_urb_pool[i]->status == -EINPROGRESS)
chars += URB_TRANSFER_BUFFER_SIZE;
}
- dbg("%s - returns %d", __func__, chars);
+ dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars);
return chars;
}
struct moschip_port *mos7720_port;
int j;
- dbg("mos7720_close:entering...");
-
serial = port->serial;
mos7720_port = usb_get_serial_port_data(port);
/* While closing port, shutdown all bulk read, write *
* and interrupt read if they exists, otherwise nop */
- dbg("Shutdown bulk write");
usb_kill_urb(port->write_urb);
- dbg("Shutdown bulk read");
usb_kill_urb(port->read_urb);
mutex_lock(&serial->disc_mutex);
}
mutex_unlock(&serial->disc_mutex);
mos7720_port->open = 0;
-
- dbg("Leaving %s", __func__);
}
static void mos7720_break(struct tty_struct *tty, int break_state)
struct usb_serial *serial;
struct moschip_port *mos7720_port;
- dbg("Entering %s", __func__);
-
serial = port->serial;
mos7720_port = usb_get_serial_port_data(port);
int room = 0;
int i;
- dbg("%s:entering ...........", __func__);
-
mos7720_port = usb_get_serial_port_data(port);
- if (mos7720_port == NULL) {
- dbg("%s:leaving ...........", __func__);
+ if (mos7720_port == NULL)
return -ENODEV;
- }
/* FIXME: Locking */
for (i = 0; i < NUM_URBS; ++i) {
room += URB_TRANSFER_BUFFER_SIZE;
}
- dbg("%s - returns %d", __func__, room);
+ dev_dbg(&port->dev, "%s - returns %d\n", __func__, room);
return room;
}
struct urb *urb;
const unsigned char *current_position = data;
- dbg("%s:entering ...........", __func__);
-
serial = port->serial;
mos7720_port = usb_get_serial_port_data(port);
- if (mos7720_port == NULL) {
- dbg("mos7720_port is NULL");
+ if (mos7720_port == NULL)
return -ENODEV;
- }
/* try to find a free urb in the list */
urb = NULL;
if (mos7720_port->write_urb_pool[i] &&
mos7720_port->write_urb_pool[i]->status != -EINPROGRESS) {
urb = mos7720_port->write_urb_pool[i];
- dbg("URB:%d", i);
+ dev_dbg(&port->dev, "URB:%d\n", i);
break;
}
}
if (urb == NULL) {
- dbg("%s - no more free urbs", __func__);
+ dev_dbg(&port->dev, "%s - no more free urbs\n", __func__);
goto exit;
}
struct moschip_port *mos7720_port;
int status;
- dbg("%s- port %d", __func__, port->number);
-
mos7720_port = usb_get_serial_port_data(port);
if (mos7720_port == NULL)
return;
if (!mos7720_port->open) {
- dbg("port not opened");
+ dev_dbg(&port->dev, "%s - port not opened\n", __func__);
return;
}
- dbg("%s: Entering ..........", __func__);
-
/* if we are implementing XON/XOFF, send the stop character */
if (I_IXOFF(tty)) {
unsigned char stop_char = STOP_CHAR(tty);
return;
if (!mos7720_port->open) {
- dbg("%s - port not opened", __func__);
+ dev_dbg(&port->dev, "%s - port not opened\n", __func__);
return;
}
- dbg("%s: Entering ..........", __func__);
-
/* if we are implementing XON/XOFF, send the start character */
if (I_IXOFF(tty)) {
unsigned char start_char = START_CHAR(tty);
/***********************************************
* Init Sequence for higher rates
***********************************************/
- dbg("Sending Setting Commands ..........");
+ dev_dbg(&port->dev, "Sending Setting Commands ..........\n");
port_number = port->number - port->serial->minor;
write_mos_reg(serial, port_number, IER, 0x00);
* this function calculates the proper baud rate divisor for the specified
* 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;
__u16 custom;
__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++) {
if (divisor_table[i].baudrate == baudrate) {
custom++;
*divisor = custom;
- dbg("Baud %d = %d", baudrate, custom);
+ dev_dbg(&port->dev, "Baud %d = %d\n", baudrate, custom);
return 0;
}
- dbg("Baud calculation Failed...");
+ dev_dbg(&port->dev, "Baud calculation Failed...\n");
return -EINVAL;
}
port = mos7720_port->port;
serial = port->serial;
- dbg("%s: Entering ..........", __func__);
-
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 */
- status = calc_baud_rate_divisor(baudrate, &divisor);
+ status = calc_baud_rate_divisor(port, baudrate, &divisor);
if (status) {
dev_err(&port->dev, "%s - bad baud rate\n", __func__);
return status;
serial = port->serial;
port_number = port->number - port->serial->minor;
- dbg("%s - port %d", __func__, port->number);
-
if (!mos7720_port->open) {
- dbg("%s - port not opened", __func__);
+ dev_dbg(&port->dev, "%s - port not opened\n", __func__);
return;
}
- dbg("%s: Entering ..........", __func__);
-
lData = UART_LCR_WLEN8;
lStop = 0x00; /* 1 stop bit */
lParity = 0x00; /* No parity */
if (cflag & PARENB) {
if (cflag & PARODD) {
lParity = UART_LCR_PARITY;
- dbg("%s - parity = odd", __func__);
+ dev_dbg(&port->dev, "%s - parity = odd\n", __func__);
} else {
lParity = (UART_LCR_EPAR | UART_LCR_PARITY);
- dbg("%s - parity = even", __func__);
+ dev_dbg(&port->dev, "%s - parity = even\n", __func__);
}
} else {
- dbg("%s - parity = none", __func__);
+ dev_dbg(&port->dev, "%s - parity = none\n", __func__);
}
if (cflag & CMSPAR)
/* Change the Stop bit */
if (cflag & CSTOPB) {
lStop = UART_LCR_STOP;
- dbg("%s - stop bits = 2", __func__);
+ dev_dbg(&port->dev, "%s - stop bits = 2\n", __func__);
} else {
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 */
baud = tty_get_baud_rate(tty);
if (!baud) {
/* pick a default, any default... */
- dbg("Picked default baud...");
+ dev_dbg(&port->dev, "Picked default baud...\n");
baud = 9600;
}
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);
/* FIXME: needs to write actual resulting baud back not just
blindly do so */
if (port->read_urb->status != -EINPROGRESS) {
status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (status)
- dbg("usb_submit_urb(read bulk) failed, status = %d",
- status);
+ dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status);
}
}
return;
if (!mos7720_port->open) {
- dbg("%s - port not opened", __func__);
+ dev_dbg(&port->dev, "%s - port not opened\n", __func__);
return;
}
- dbg("%s\n", "setting termios - ASPIRE");
+ dev_dbg(&port->dev, "setting termios - ASPIRE\n");
cflag = tty->termios->c_cflag;
- dbg("%s - cflag %08x iflag %08x", __func__,
- tty->termios->c_cflag,
- RELEVANT_IFLAG(tty->termios->c_iflag));
+ dev_dbg(&port->dev, "%s - cflag %08x iflag %08x\n", __func__,
+ tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag));
- dbg("%s - old cflag %08x old iflag %08x", __func__,
- old_termios->c_cflag,
- RELEVANT_IFLAG(old_termios->c_iflag));
-
- dbg("%s - port %d", __func__, port->number);
+ dev_dbg(&port->dev, "%s - old cflag %08x old iflag %08x\n", __func__,
+ old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag));
/* change the port settings to the new ones specified */
change_port_settings(tty, mos7720_port, old_termios);
if (port->read_urb->status != -EINPROGRESS) {
status = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (status)
- dbg("usb_submit_urb(read bulk) failed, status = %d",
- status);
+ dev_dbg(&port->dev, "usb_submit_urb(read bulk) failed, status = %d\n", status);
}
}
read_mos_reg(port->serial, port_number, LSR, &data);
if ((data & (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;
}
}
unsigned int mcr ;
unsigned int msr ;
- dbg("%s - port %d", __func__, port->number);
-
mcr = mos7720_port->shadowMCR;
msr = mos7720_port->shadowMSR;
| ((msr & UART_MSR_RI) ? TIOCM_RI : 0) /* 0x080 */
| ((msr & UART_MSR_DSR) ? TIOCM_DSR : 0); /* 0x100 */
- dbg("%s -- %x", __func__, result);
-
return result;
}
struct usb_serial_port *port = tty->driver_data;
struct moschip_port *mos7720_port = usb_get_serial_port_data(port);
unsigned int mcr ;
- dbg("%s - port %d", __func__, port->number);
- dbg("he was at tiocmset");
mcr = mos7720_port->shadowMCR;
icount->brk = cnow.brk;
icount->buf_overrun = cnow.buf_overrun;
- dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__,
- port->number, icount->rx, icount->tx);
+ dev_dbg(&port->dev, "%s TIOCGICOUNT RX=%d, TX=%d\n", __func__,
+ icount->rx, icount->tx);
return 0;
}
if (mos7720_port == NULL)
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) {
case TIOCSERGETLSR:
- dbg("%s (%d) TIOCSERGETLSR", __func__, port->number);
+ dev_dbg(&port->dev, "%s TIOCSERGETLSR\n", __func__);
return get_lsr_info(tty, mos7720_port,
(unsigned int __user *)arg);
/* FIXME: These should be using the mode methods */
case TIOCMBIS:
case TIOCMBIC:
- dbg("%s (%d) TIOCMSET/TIOCMBIC/TIOCMSET",
- __func__, port->number);
+ dev_dbg(&port->dev, "%s TIOCMSET/TIOCMBIC/TIOCMSET\n", __func__);
return set_modem_info(mos7720_port, cmd,
(unsigned int __user *)arg);
case TIOCGSERIAL:
- dbg("%s (%d) TIOCGSERIAL", __func__, port->number);
+ dev_dbg(&port->dev, "%s TIOCGSERIAL\n", __func__);
return get_serial_info(mos7720_port,
(struct serial_struct __user *)arg);
case TIOCMIWAIT:
- dbg("%s (%d) TIOCMIWAIT", __func__, port->number);
+ dev_dbg(&port->dev, "%s TIOCMIWAIT\n", __func__);
cprev = mos7720_port->icount;
while (1) {
if (signal_pending(current))
u16 product;
int ret_val;
- dbg("%s: Entering ..........", __func__);
-
- if (!serial) {
- dbg("Invalid Handler");
- return -ENODEV;
- }
-
product = le16_to_cpu(serial->dev->descriptor.idProduct);
dev = serial->dev;
mos7720_port->port = serial->port[i];
usb_set_serial_port_data(serial->port[i], mos7720_port);
- dbg("port number is %d", serial->port[i]->number);
- dbg("serial number is %d", serial->minor);
+ dev_dbg(&dev->dev, "port number is %d\n", serial->port[i]->number);
+ dev_dbg(&dev->dev, "serial number is %d\n", serial->minor);
}
#endif
/* LSR For Port 1 */
read_mos_reg(serial, 0, LSR, &data);
- dbg("LSR:%x", data);
+ dev_dbg(&dev->dev, "LSR:%x\n", data);
return 0;
}