Commit fbf94773 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: omninet: switch to generic read implementation

Switch to the more efficient generic read implementation.
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a6c042f9
...@@ -33,8 +33,7 @@ ...@@ -33,8 +33,7 @@
/* function prototypes */ /* function prototypes */
static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port); static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port);
static void omninet_close(struct usb_serial_port *port); static void omninet_process_read_urb(struct urb *urb);
static void omninet_read_bulk_callback(struct urb *urb);
static void omninet_write_bulk_callback(struct urb *urb); static void omninet_write_bulk_callback(struct urb *urb);
static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count); const unsigned char *buf, int count);
...@@ -61,11 +60,10 @@ static struct usb_serial_driver zyxel_omninet_device = { ...@@ -61,11 +60,10 @@ static struct usb_serial_driver zyxel_omninet_device = {
.port_probe = omninet_port_probe, .port_probe = omninet_port_probe,
.port_remove = omninet_port_remove, .port_remove = omninet_port_remove,
.open = omninet_open, .open = omninet_open,
.close = omninet_close,
.write = omninet_write, .write = omninet_write,
.write_room = omninet_write_room, .write_room = omninet_write_room,
.read_bulk_callback = omninet_read_bulk_callback,
.write_bulk_callback = omninet_write_bulk_callback, .write_bulk_callback = omninet_write_bulk_callback,
.process_read_urb = omninet_process_read_urb,
.disconnect = omninet_disconnect, .disconnect = omninet_disconnect,
}; };
...@@ -134,26 +132,13 @@ static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -134,26 +132,13 @@ static int omninet_open(struct tty_struct *tty, struct usb_serial_port *port)
{ {
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
struct usb_serial_port *wport; struct usb_serial_port *wport;
int result = 0;
wport = serial->port[1]; wport = serial->port[1];
tty_port_tty_set(&wport->port, tty); tty_port_tty_set(&wport->port, tty);
/* Start reading from the device */ return usb_serial_generic_open(tty, port);
result = usb_submit_urb(port->read_urb, GFP_KERNEL);
if (result)
dev_err(&port->dev,
"%s - failed submitting read urb, error %d\n",
__func__, result);
return result;
}
static void omninet_close(struct usb_serial_port *port)
{
usb_kill_urb(port->read_urb);
} }
#define OMNINET_HEADERLEN 4 #define OMNINET_HEADERLEN 4
#define OMNINET_BULKOUTSIZE 64 #define OMNINET_BULKOUTSIZE 64
#define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN) #define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN)
...@@ -175,28 +160,6 @@ static void omninet_process_read_urb(struct urb *urb) ...@@ -175,28 +160,6 @@ static void omninet_process_read_urb(struct urb *urb)
tty_flip_buffer_push(&port->port); tty_flip_buffer_push(&port->port);
} }
static void omninet_read_bulk_callback(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
int status = urb->status;
int result;
if (status) {
dev_dbg(&port->dev, "%s - nonzero read bulk status received: %d\n",
__func__, status);
return;
}
omninet_process_read_urb(urb);
/* Continue trying to always read */
result = usb_submit_urb(urb, GFP_ATOMIC);
if (result)
dev_err(&port->dev,
"%s - failed resubmitting read urb, error %d\n",
__func__, result);
}
static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count) const unsigned char *buf, int count)
{ {
......
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