提交 22a416c4 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

USB: serial: use dev_err_console in custom write paths

Use dev_err_console in write paths for devices which can be used as a
console but do not use the generic write implementation.

Compile-only tested.
Signed-off-by: NJohan Hovold <jhovold@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 f1475a00
...@@ -800,7 +800,7 @@ static void cypress_send(struct usb_serial_port *port) ...@@ -800,7 +800,7 @@ static void cypress_send(struct usb_serial_port *port)
cypress_write_int_callback, port, priv->write_urb_interval); cypress_write_int_callback, port, priv->write_urb_interval);
result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC); result = usb_submit_urb(port->interrupt_out_urb, GFP_ATOMIC);
if (result) { if (result) {
dev_err(&port->dev, dev_err_console(port,
"%s - failed submitting write urb, error %d\n", "%s - failed submitting write urb, error %d\n",
__func__, result); __func__, result);
priv->write_urb_in_use = 0; priv->write_urb_in_use = 0;
......
...@@ -995,7 +995,7 @@ static int digi_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -995,7 +995,7 @@ static int digi_write(struct tty_struct *tty, struct usb_serial_port *port,
/* return length of new data written, or error */ /* return length of new data written, or error */
spin_unlock_irqrestore(&priv->dp_port_lock, flags); spin_unlock_irqrestore(&priv->dp_port_lock, flags);
if (ret < 0) if (ret < 0)
dev_err(&port->dev, dev_err_console(port,
"%s: usb_submit_urb failed, ret=%d, port=%d\n", "%s: usb_submit_urb failed, ret=%d, port=%d\n",
__func__, ret, priv->dp_port_num); __func__, ret, priv->dp_port_num);
dbg("digi_write: returning %d", ret); dbg("digi_write: returning %d", ret);
...@@ -1065,7 +1065,7 @@ static void digi_write_bulk_callback(struct urb *urb) ...@@ -1065,7 +1065,7 @@ static void digi_write_bulk_callback(struct urb *urb)
spin_unlock(&priv->dp_port_lock); spin_unlock(&priv->dp_port_lock);
if (ret && ret != -EPERM) if (ret && ret != -EPERM)
dev_err(&port->dev, dev_err_console(port,
"%s: usb_submit_urb failed, ret=%d, port=%d\n", "%s: usb_submit_urb failed, ret=%d, port=%d\n",
__func__, ret, priv->dp_port_num); __func__, ret, priv->dp_port_num);
} }
......
...@@ -1286,7 +1286,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, ...@@ -1286,7 +1286,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial,
count = fifo->count; count = fifo->count;
buffer = kmalloc(count+2, GFP_ATOMIC); buffer = kmalloc(count+2, GFP_ATOMIC);
if (buffer == NULL) { if (buffer == NULL) {
dev_err(&edge_port->port->dev, dev_err_console(edge_port->port,
"%s - no more kernel memory...\n", __func__); "%s - no more kernel memory...\n", __func__);
edge_port->write_in_progress = false; edge_port->write_in_progress = false;
goto exit_send; goto exit_send;
...@@ -1331,7 +1331,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, ...@@ -1331,7 +1331,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial,
status = usb_submit_urb(urb, GFP_ATOMIC); status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) { if (status) {
/* something went wrong */ /* something went wrong */
dev_err(&edge_port->port->dev, dev_err_console(edge_port->port,
"%s - usb_submit_urb(write bulk) failed, status = %d, data lost\n", "%s - usb_submit_urb(write bulk) failed, status = %d, data lost\n",
__func__, status); __func__, status);
edge_port->write_in_progress = false; edge_port->write_in_progress = false;
......
...@@ -1817,7 +1817,7 @@ static void edge_bulk_out_callback(struct urb *urb) ...@@ -1817,7 +1817,7 @@ static void edge_bulk_out_callback(struct urb *urb)
__func__, status); __func__, status);
return; return;
default: default:
dev_err(&urb->dev->dev, "%s - nonzero write bulk status " dev_err_console(port, "%s - nonzero write bulk status "
"received: %d\n", __func__, status); "received: %d\n", __func__, status);
} }
...@@ -2111,7 +2111,7 @@ static void edge_send(struct tty_struct *tty) ...@@ -2111,7 +2111,7 @@ static void edge_send(struct tty_struct *tty)
/* send the data out the bulk port */ /* send the data out the bulk port */
result = usb_submit_urb(port->write_urb, GFP_ATOMIC); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) { if (result) {
dev_err(&port->dev, dev_err_console(port,
"%s - failed submitting write urb, error %d\n", "%s - failed submitting write urb, error %d\n",
__func__, result); __func__, result);
edge_port->ep_write_urb_in_use = 0; edge_port->ep_write_urb_in_use = 0;
......
...@@ -1294,7 +1294,7 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1294,7 +1294,7 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
GFP_KERNEL); GFP_KERNEL);
if (urb->transfer_buffer == NULL) { if (urb->transfer_buffer == NULL) {
dev_err(&port->dev, "%s no more kernel memory...\n", dev_err_console(port, "%s no more kernel memory...\n",
__func__); __func__);
goto exit; goto exit;
} }
...@@ -1315,7 +1315,7 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1315,7 +1315,7 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
/* send it down the pipe */ /* send it down the pipe */
status = usb_submit_urb(urb, GFP_ATOMIC); status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) { if (status) {
dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed " dev_err_console(port, "%s - usb_submit_urb(write bulk) failed "
"with status = %d\n", __func__, status); "with status = %d\n", __func__, status);
bytes_sent = status; bytes_sent = status;
goto exit; goto exit;
......
...@@ -1509,7 +1509,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1509,7 +1509,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
if (urb->transfer_buffer == NULL) { if (urb->transfer_buffer == NULL) {
dev_err(&port->dev, "%s no more kernel memory...\n", dev_err_console(port, "%s no more kernel memory...\n",
__func__); __func__);
goto exit; goto exit;
} }
...@@ -1535,7 +1535,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -1535,7 +1535,7 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
if (status) { if (status) {
mos7840_port->busy[i] = 0; mos7840_port->busy[i] = 0;
dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed " dev_err_console(port, "%s - usb_submit_urb(write bulk) failed "
"with status = %d\n", __func__, status); "with status = %d\n", __func__, status);
bytes_sent = status; bytes_sent = status;
goto exit; goto exit;
......
...@@ -254,7 +254,7 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -254,7 +254,7 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); result = usb_submit_urb(wport->write_urb, GFP_ATOMIC);
if (result) { if (result) {
set_bit(0, &wport->write_urbs_free); set_bit(0, &wport->write_urbs_free);
dev_err(&port->dev, dev_err_console(port,
"%s - failed submitting write urb, error %d\n", "%s - failed submitting write urb, error %d\n",
__func__, result); __func__, result);
} else } else
......
...@@ -302,7 +302,7 @@ static void send_data(struct work_struct *work) ...@@ -302,7 +302,7 @@ static void send_data(struct work_struct *work)
if (count != 0) { if (count != 0) {
allow = kmalloc(1, GFP_KERNEL); allow = kmalloc(1, GFP_KERNEL);
if (!allow) { if (!allow) {
dev_err(&port->dev, "%s(): kmalloc failed\n", dev_err_console(port, "%s(): kmalloc failed\n",
__func__); __func__);
return; return;
} }
...@@ -334,7 +334,7 @@ static void send_data(struct work_struct *work) ...@@ -334,7 +334,7 @@ static void send_data(struct work_struct *work)
port->write_urb->transfer_buffer_length = count; port->write_urb->transfer_buffer_length = count;
result = usb_submit_urb(port->write_urb, GFP_NOIO); result = usb_submit_urb(port->write_urb, GFP_NOIO);
if (result != 0) { if (result != 0) {
dev_err(&port->dev, "%s(): usb_submit_urb() failed" dev_err_console(port, "%s(): usb_submit_urb() failed"
" with error %d\n", __func__, result); " with error %d\n", __func__, result);
priv->flags.write_urb_in_use = 0; priv->flags.write_urb_in_use = 0;
} }
...@@ -938,7 +938,7 @@ static void oti6858_write_bulk_callback(struct urb *urb) ...@@ -938,7 +938,7 @@ static void oti6858_write_bulk_callback(struct urb *urb)
port->write_urb->transfer_buffer_length = 1; port->write_urb->transfer_buffer_length = 1;
result = usb_submit_urb(port->write_urb, GFP_ATOMIC); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) { if (result) {
dev_err(&port->dev, "%s(): usb_submit_urb() failed," dev_err_console(port, "%s(): usb_submit_urb() failed,"
" error %d\n", __func__, result); " error %d\n", __func__, result);
} else { } else {
return; return;
......
...@@ -1248,7 +1248,6 @@ static void ti_bulk_out_callback(struct urb *urb) ...@@ -1248,7 +1248,6 @@ static void ti_bulk_out_callback(struct urb *urb)
{ {
struct ti_port *tport = urb->context; struct ti_port *tport = urb->context;
struct usb_serial_port *port = tport->tp_port; struct usb_serial_port *port = tport->tp_port;
struct device *dev = &urb->dev->dev;
int status = urb->status; int status = urb->status;
dbg("%s - port %d", __func__, port->number); dbg("%s - port %d", __func__, port->number);
...@@ -1266,7 +1265,7 @@ static void ti_bulk_out_callback(struct urb *urb) ...@@ -1266,7 +1265,7 @@ static void ti_bulk_out_callback(struct urb *urb)
wake_up_interruptible(&tport->tp_write_wait); wake_up_interruptible(&tport->tp_write_wait);
return; return;
default: default:
dev_err(dev, "%s - nonzero urb status, %d\n", dev_err_console(port, "%s - nonzero urb status, %d\n",
__func__, status); __func__, status);
tport->tp_tdev->td_urb_error = 1; tport->tp_tdev->td_urb_error = 1;
wake_up_interruptible(&tport->tp_write_wait); wake_up_interruptible(&tport->tp_write_wait);
...@@ -1335,7 +1334,7 @@ static void ti_send(struct ti_port *tport) ...@@ -1335,7 +1334,7 @@ static void ti_send(struct ti_port *tport)
result = usb_submit_urb(port->write_urb, GFP_ATOMIC); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) { if (result) {
dev_err(&port->dev, "%s - submit write urb failed, %d\n", dev_err_console(port, "%s - submit write urb failed, %d\n",
__func__, result); __func__, result);
tport->tp_write_urb_in_use = 0; tport->tp_write_urb_in_use = 0;
/* TODO: reschedule ti_send */ /* TODO: reschedule ti_send */
......
...@@ -740,7 +740,7 @@ static int whiteheat_write(struct tty_struct *tty, ...@@ -740,7 +740,7 @@ static int whiteheat_write(struct tty_struct *tty,
urb->transfer_buffer_length = bytes; urb->transfer_buffer_length = bytes;
result = usb_submit_urb(urb, GFP_ATOMIC); result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) { if (result) {
dev_err(&port->dev, dev_err_console(port,
"%s - failed submitting write urb, error %d\n", "%s - failed submitting write urb, error %d\n",
__func__, result); __func__, result);
sent = result; sent = result;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册