const char *function)
{
if (!port) {
- dbg("%s - port == NULL", function);
+ pr_debug("%s - port == NULL", function);
return -1;
}
if (!port->serial) {
- dbg("%s - port->serial == NULL\n", function);
+ pr_debug("%s - port->serial == NULL\n", function);
return -1;
}
const char *function)
{
if (!serial) {
- dbg("%s - serial == NULL\n", function);
+ pr_debug("%s - serial == NULL\n", function);
return -1;
}
if (!serial->type) {
- dbg("%s - serial->type == NULL!", function);
+ pr_debug("%s - serial->type == NULL!", function);
return -1;
}
status = urb->status;
if (status) {
- dbg("nonzero write bulk status received:%d\n", status);
+ dev_dbg(&urb->dev->dev, "nonzero write bulk status received:%d\n", status);
return;
}
if (urb->status) {
qt_port->ReadBulkStopped = 1;
- dbg("%s - nonzero write bulk status received: %d\n",
- __func__, urb->status);
+ dev_dbg(&urb->dev->dev, "%s - nonzero write bulk status received: %d\n",
+ __func__, urb->status);
return;
}
tty = tty_port_tty_get(&port->port);
- if (!tty) {
- dbg("%s - bad tty pointer - exiting", __func__);
+ if (!tty)
return;
- }
data = urb->transfer_buffer;
/* index = MINOR(port->tty->device) - serial->minor; */
index = tty->index - serial->minor;
- dbg("%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding);
+ dev_dbg(&port->dev, "%s - port->RxHolding = %d\n", __func__, qt_port->RxHolding);
if (port_paranoia_check(port, __func__) != 0) {
- dbg("%s - port_paranoia_check, exiting\n", __func__);
qt_port->ReadBulkStopped = 1;
goto exit;
}
- if (!serial) {
- dbg("%s - bad serial pointer, exiting\n", __func__);
+ if (!serial)
goto exit;
- }
+
if (qt_port->closePending == 1) {
/* Were closing , stop reading */
- dbg("%s - (qt_port->closepending == 1\n", __func__);
+ dev_dbg(&port->dev, "%s - (qt_port->closepending == 1\n", __func__);
qt_port->ReadBulkStopped = 1;
goto exit;
}
if (urb->status) {
qt_port->ReadBulkStopped = 1;
- dbg("%s - nonzero read bulk status received: %d\n",
- __func__, urb->status);
+ dev_dbg(&port->dev, "%s - nonzero read bulk status received: %d\n",
+ __func__, urb->status);
goto exit;
}
case 0x00:
/* line status change 4th byte must follow */
if (i > (RxCount - 4)) {
- dbg("Illegal escape seuences in received data\n");
+ dev_dbg(&port->dev, "Illegal escape seuences in received data\n");
break;
}
ProcessLineStatus(qt_port, data[i + 3]);
case 0x01:
/* Modem status status change 4th byte must follow */
- dbg("Modem status status.\n");
+ dev_dbg(&port->dev, "Modem status status.\n");
if (i > (RxCount - 4)) {
- dbg("Illegal escape sequences in received data\n");
+ dev_dbg(&port->dev, "Illegal escape sequences in received data\n");
break;
}
ProcessModemStatus(qt_port,
flag = 1;
break;
case 0xff:
- dbg("No status sequence.\n");
+ dev_dbg(&port->dev, "No status sequence.\n");
if (tty) {
ProcessRxChar(tty, port, data[i]);
qt_read_bulk_callback, port);
result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result)
- dbg("%s - failed resubmitting read urb, error %d",
- __func__, result);
+ dev_dbg(&port->dev, "%s - failed resubmitting read urb, error %d",
+ __func__, result);
else {
if (tty && RxCount) {
tty_flip_buffer_push(tty);
PortSettings += ((__u16) (device_data->porta));
length = sizeof(struct qt_get_device_data);
- dbg("%s - PortSettings = 0x%x\n", __func__, PortSettings);
result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
QT_SET_GET_DEVICE, 0x40, PortSettings,
static int qt_startup(struct usb_serial *serial)
{
+ struct device *dev = &serial->dev->dev;
struct usb_serial_port *port;
struct quatech_port *qt_port;
struct qt_get_device_data DeviceData;
port = serial->port[i];
qt_port = kzalloc(sizeof(*qt_port), GFP_KERNEL);
if (!qt_port) {
- dbg("%s: kmalloc for quatech_port (%d) failed!.",
- __func__, i);
for (--i; i >= 0; i--) {
port = serial->port[i];
kfree(usb_get_serial_port_data(port));
}
status = qt_get_device(serial, &DeviceData);
- if (status < 0) {
- dbg(__FILE__ "box_get_device failed");
+ if (status < 0)
goto startup_error;
- }
- dbg(__FILE__ "DeviceData.portb = 0x%x", DeviceData.portb);
+ dev_dbg(dev, "DeviceData.portb = 0x%x\n", DeviceData.portb);
DeviceData.portb &= ~FULLPWRBIT;
- dbg(__FILE__ "Changing DeviceData.portb to 0x%x", DeviceData.portb);
+ dev_dbg(dev, "Changing DeviceData.portb to 0x%x\n", DeviceData.portb);
status = qt_set_device(serial, &DeviceData);
if (status < 0) {
- dbg(__FILE__ "qt_set_device failed\n");
+ dev_dbg(dev, "qt_set_device failed\n");
goto startup_error;
}
status = qt_get_device(serial, &DeviceData);
if (status < 0) {
- dbg(__FILE__ "qt_get_device failed");
+ dev_dbg(dev, "qt_get_device failed\n");
goto startup_error;
}
status = BoxSetPrebufferLevel(serial); /* sets to default value */
if (status < 0) {
- dbg(__FILE__ "BoxSetPrebufferLevel failed\n");
+ dev_dbg(dev, "BoxSetPrebufferLevel failed\n");
goto startup_error;
}
status = BoxSetATC(serial, ATC_DISABLED);
if (status < 0) {
- dbg(__FILE__ "BoxSetATC failed\n");
+ dev_dbg(dev, "BoxSetATC failed\n");
goto startup_error;
}
- dbg(__FILE__ "DeviceData.portb = 0x%x", DeviceData.portb);
+ dev_dbg(dev, "DeviceData.portb = 0x%x\n", DeviceData.portb);
DeviceData.portb |= NEXT_BOARD_POWER_BIT;
- dbg(__FILE__ "Changing DeviceData.portb to 0x%x", DeviceData.portb);
+ dev_dbg(dev, "Changing DeviceData.portb to 0x%x\n", DeviceData.portb);
status = qt_set_device(serial, &DeviceData);
if (status < 0) {
- dbg(__FILE__ "qt_set_device failed\n");
+ dev_dbg(dev, "qt_set_device failed\n");
goto startup_error;
}
- dbg("Exit Success %s\n", __func__);
-
return 0;
startup_error:
usb_set_serial_port_data(port, NULL);
}
- dbg("Exit fail %s\n", __func__);
-
return -EIO;
}
/* Port specific setups */
result = qt_open_channel(serial, port->number, &ChannelData);
if (result < 0) {
- dbg(__FILE__ "qt_open_channel failed\n");
+ dev_dbg(&port->dev, "qt_open_channel failed\n");
return result;
}
- dbg(__FILE__ "qt_open_channel completed.\n");
+ dev_dbg(&port->dev, "qt_open_channel completed.\n");
/* FIXME: are these needed? Does it even do anything useful? */
quatech_port->shadowLSR = ChannelData.line_status &
/* Set Baud rate to default and turn off (default)flow control here */
result = qt_setuart(serial, port->number, DEFAULT_DIVISOR, DEFAULT_LCR);
if (result < 0) {
- dbg(__FILE__ "qt_setuart failed\n");
+ dev_dbg(&port->dev, "qt_setuart failed\n");
return result;
}
- dbg(__FILE__ "qt_setuart completed.\n");
+ dev_dbg(&port->dev, "qt_setuart completed.\n");
/*
* Put this here to make it responsive to stty and defaults set by
}
- dbg("port number is %d\n", port->number);
- dbg("serial number is %d\n", port->serial->minor);
- dbg("Bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
- dbg("BulkOut endpoint is %d\n", port->bulk_out_endpointAddress);
- dbg("Interrupt endpoint is %d\n", port->interrupt_in_endpointAddress);
- dbg("port's number in the device is %d\n", quatech_port->port_num);
+ dev_dbg(&port->dev, "port number is %d\n", port->number);
+ dev_dbg(&port->dev, "serial number is %d\n", port->serial->minor);
+ dev_dbg(&port->dev, "Bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
+ dev_dbg(&port->dev, "BulkOut endpoint is %d\n", port->bulk_out_endpointAddress);
+ dev_dbg(&port->dev, "Interrupt endpoint is %d\n", port->interrupt_in_endpointAddress);
+ dev_dbg(&port->dev, "port's number in the device is %d\n", quatech_port->port_num);
quatech_port->read_urb = port->read_urb;
/* set up our bulk in urb */
quatech_port->read_urb->transfer_buffer_length,
qt_read_bulk_callback, quatech_port);
- dbg("qt_open: bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
+ dev_dbg(&port->dev, "qt_open: bulkin endpoint is %d\n", port->bulk_in_endpointAddress);
quatech_port->read_urb_busy = true;
result = usb_submit_urb(quatech_port->read_urb, GFP_KERNEL);
if (result) {
chars = port->write_urb->transfer_buffer_length;
}
- dbg("%s - returns %d\n", __func__, chars);
-
return chars;
}
wait--;
if (wait == 0) {
- dbg("%s - TIMEOUT", __func__);
+ dev_dbg(&qt_port->port->dev, "%s - TIMEOUT", __func__);
return;
} else {
wait = 30;
/* Close uart channel */
status = qt_close_channel(serial, index);
if (status < 0)
- dbg("%s - port %d qt_close_channel failed.\n",
- __func__, port->number);
+ dev_dbg(&port->dev, "%s - port %d qt_close_channel failed.\n", __func__, port->number);
port0->open_ports--;
- dbg("qt_num_open_ports in close%d:in port%d\n",
- port0->open_ports, port->number);
+ dev_dbg(&port->dev, "qt_num_open_ports in close%d:in port%d\n", port0->open_ports, port->number);
if (port0->open_ports == 0) {
if (serial->port[0]->interrupt_in_urb) {
- dbg("%s", "Shutdown interrupt_in_urb\n");
+ dev_dbg(&port->dev, "%s", "Shutdown interrupt_in_urb\n");
usb_kill_urb(serial->port[0]->interrupt_in_urb);
}
return -ENODEV;
if (count == 0) {
- dbg("%s - write request of 0 bytes\n", __func__);
+ dev_dbg(&port->dev, "%s - write request of 0 bytes\n", __func__);
return 0;
}
/* only do something if we have a bulk out endpoint */
if (serial->num_bulk_out) {
if (port->write_urb->status == -EINPROGRESS) {
- dbg("%s - already writing\n", __func__);
+ dev_dbg(&port->dev, "%s - already writing\n", __func__);
return 0;
}
/* send the data out the bulk port */
result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result)
- dbg("%s - failed submitting write urb, error %d\n",
- __func__, result);
+ dev_dbg(&port->dev, "%s - failed submitting write urb, error %d\n",
+ __func__, result);
else
result = count;
int retval = -EINVAL;
- if (port_paranoia_check(port, __func__)) {
- dbg("%s", "Invalid port\n");
+ if (port_paranoia_check(port, __func__))
return -1;
- }
serial = get_usb_serial(port, __func__);
struct usb_serial *serial = get_usb_serial(port, __func__);
unsigned int index;
- dbg("%s cmd 0x%04x", __func__, cmd);
+ dev_dbg(&port->dev, "%s cmd 0x%04x\n", __func__, cmd);
index = tty->index - serial->minor;
return 0;
}
- dbg("%s -No ioctl for that one. port = %d\n", __func__, port->number);
+ dev_dbg(&port->dev, "%s -No ioctl for that one. port = %d\n", __func__, port->number);
return -ENOIOCTLCMD;
}
else
new_LCR |= SERIAL_ONE_STOPB;
- dbg("%s - 4\n", __func__);
+ dev_dbg(&port->dev, "%s - 4\n", __func__);
/* Thats the LCR stuff, go ahead and set it */
baud = tty_get_baud_rate(tty);
/* pick a default, any default... */
baud = 9600;
- dbg("%s - got baud = %d\n", __func__, baud);
+ dev_dbg(&port->dev, "%s - got baud = %d\n", __func__, baud);
divisor = MAX_BAUD_RATE / baud;
remainder = MAX_BAUD_RATE % baud;
status =
qt_setuart(port->serial, index, (unsigned short)divisor, new_LCR);
if (status < 0) {
- dbg(__FILE__ "qt_setuart failed\n");
+ dev_dbg(&port->dev, "qt_setuart failed\n");
return;
}
/* Now determine flow control */
if (cflag & CRTSCTS) {
- dbg("%s - Enabling HW flow control port %d\n", __func__,
- port->number);
+ dev_dbg(&port->dev, "%s - Enabling HW flow control port %d\n", __func__, port->number);
/* Enable RTS/CTS flow control */
status = BoxSetHW_FlowCtrl(port->serial, index, 1);
if (status < 0) {
- dbg(__FILE__ "BoxSetHW_FlowCtrl failed\n");
+ dev_dbg(&port->dev, "BoxSetHW_FlowCtrl failed\n");
return;
}
} else {
/* Disable RTS/CTS flow control */
- dbg("%s - disabling HW flow control port %d\n", __func__,
- port->number);
+ dev_dbg(&port->dev, "%s - disabling HW flow control port %d\n", __func__, port->number);
status = BoxSetHW_FlowCtrl(port->serial, index, 0);
if (status < 0) {
- dbg(__FILE__ "BoxSetHW_FlowCtrl failed\n");
+ dev_dbg(&port->dev, "BoxSetHW_FlowCtrl failed\n");
return;
}
BoxSetSW_FlowCtrl(port->serial, index, stop_char,
start_char);
if (status < 0)
- dbg(__FILE__ "BoxSetSW_FlowCtrl (enabled) failed\n");
+ dev_dbg(&port->dev, "BoxSetSW_FlowCtrl (enabled) failed\n");
} else {
/* disable SW flow control */
status = BoxDisable_SW_FlowCtrl(port->serial, index);
if (status < 0)
- dbg(__FILE__ "BoxSetSW_FlowCtrl (diabling) failed\n");
+ dev_dbg(&port->dev, "BoxSetSW_FlowCtrl (diabling) failed\n");
}
tty->termios->c_cflag &= ~CMSPAR;
mutex_lock(&qt_port->lock);
if (qt_port->RxHolding == 1) {
- dbg("%s -qt_port->RxHolding == 1\n", __func__);
+ dev_dbg(&port->dev, "%s -qt_port->RxHolding == 1\n", __func__);
qt_port->RxHolding = 0;
- dbg("%s - qt_port->RxHolding = 0\n", __func__);
+ dev_dbg(&port->dev, "%s - qt_port->RxHolding = 0\n", __func__);
/* if we have a bulk endpoint, start it up */
if ((serial->num_bulk_in) && (qt_port->ReadBulkStopped == 1)) {
{
int num_ports;
- dbg("numberofendpoints: %d\n",
- (int)serial->interface->cur_altsetting->desc.bNumEndpoints);
- dbg("numberofendpoints: %d\n",
- (int)serial->interface->altsetting->desc.bNumEndpoints);
-
num_ports =
(serial->interface->cur_altsetting->desc.bNumEndpoints - 1) / 2;