usb_serial: some coding style fixes
Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e5430f889c
commit
c4d0f8cbca
@@ -229,7 +229,8 @@ static void aircable_send(struct usb_serial_port *port)
|
|||||||
buf[1] = TX_HEADER_1;
|
buf[1] = TX_HEADER_1;
|
||||||
dbuf = (__le16 *)&buf[2];
|
dbuf = (__le16 *)&buf[2];
|
||||||
*dbuf = cpu_to_le16((u16)count);
|
*dbuf = cpu_to_le16((u16)count);
|
||||||
serial_buf_get(priv->tx_buf,buf + HCI_HEADER_LENGTH, MAX_HCI_FRAMESIZE);
|
serial_buf_get(priv->tx_buf, buf + HCI_HEADER_LENGTH,
|
||||||
|
MAX_HCI_FRAMESIZE);
|
||||||
|
|
||||||
memcpy(port->write_urb->transfer_buffer, buf,
|
memcpy(port->write_urb->transfer_buffer, buf,
|
||||||
count + HCI_HEADER_LENGTH);
|
count + HCI_HEADER_LENGTH);
|
||||||
@@ -282,7 +283,7 @@ static void aircable_read(struct work_struct *work)
|
|||||||
count = min(64, serial_buf_data_avail(priv->rx_buf));
|
count = min(64, serial_buf_data_avail(priv->rx_buf));
|
||||||
|
|
||||||
if (count <= 0)
|
if (count <= 0)
|
||||||
return; //We have finished sending everything.
|
return; /* We have finished sending everything. */
|
||||||
|
|
||||||
tty_prepare_flip_string(tty, &data, count);
|
tty_prepare_flip_string(tty, &data, count);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
@@ -304,7 +305,8 @@ static void aircable_read(struct work_struct *work)
|
|||||||
static int aircable_probe(struct usb_serial *serial,
|
static int aircable_probe(struct usb_serial *serial,
|
||||||
const struct usb_device_id *id)
|
const struct usb_device_id *id)
|
||||||
{
|
{
|
||||||
struct usb_host_interface *iface_desc = serial->interface->cur_altsetting;
|
struct usb_host_interface *iface_desc = serial->interface->
|
||||||
|
cur_altsetting;
|
||||||
struct usb_endpoint_descriptor *endpoint;
|
struct usb_endpoint_descriptor *endpoint;
|
||||||
int num_bulk_out = 0;
|
int num_bulk_out = 0;
|
||||||
int i;
|
int i;
|
||||||
@@ -507,7 +509,7 @@ static void aircable_read_bulk_callback(struct urb *urb)
|
|||||||
no_packages = urb->actual_length / (HCI_COMPLETE_FRAME);
|
no_packages = urb->actual_length / (HCI_COMPLETE_FRAME);
|
||||||
|
|
||||||
if (urb->actual_length % HCI_COMPLETE_FRAME != 0)
|
if (urb->actual_length % HCI_COMPLETE_FRAME != 0)
|
||||||
no_packages+=1;
|
no_packages++;
|
||||||
|
|
||||||
for (i = 0; i < no_packages; i++) {
|
for (i = 0; i < no_packages; i++) {
|
||||||
if (remaining > (HCI_COMPLETE_FRAME))
|
if (remaining > (HCI_COMPLETE_FRAME))
|
||||||
|
@@ -69,7 +69,8 @@ static int airprime_send_setup(struct usb_serial_port *port)
|
|||||||
|
|
||||||
return usb_control_msg(serial->dev,
|
return usb_control_msg(serial->dev,
|
||||||
usb_rcvctrlpipe(serial->dev, 0),
|
usb_rcvctrlpipe(serial->dev, 0),
|
||||||
0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT);
|
0x22, 0x21, val, 0, NULL, 0,
|
||||||
|
USB_CTRL_SET_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -90,7 +91,8 @@ static void airprime_read_bulk_callback(struct urb *urb)
|
|||||||
__func__, status);
|
__func__, status);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data);
|
usb_serial_debug_data(debug, &port->dev, __func__,
|
||||||
|
urb->actual_length, data);
|
||||||
|
|
||||||
tty = port->tty;
|
tty = port->tty;
|
||||||
if (tty && urb->actual_length) {
|
if (tty && urb->actual_length) {
|
||||||
@@ -100,7 +102,8 @@ static void airprime_read_bulk_callback(struct urb *urb)
|
|||||||
|
|
||||||
result = usb_submit_urb(urb, GFP_ATOMIC);
|
result = usb_submit_urb(urb, GFP_ATOMIC);
|
||||||
if (result)
|
if (result)
|
||||||
dev_err(&port->dev, "%s - failed resubmitting read urb, error %d\n",
|
dev_err(&port->dev,
|
||||||
|
"%s - failed resubmitting read urb, error %d\n",
|
||||||
__func__, result);
|
__func__, result);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -183,7 +186,8 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
|
|||||||
__func__, i, port->number, result);
|
__func__, i, port->number, result);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
/* remember this urb so we can kill it when the port is closed */
|
/* remember this urb so we can kill it when the
|
||||||
|
port is closed */
|
||||||
priv->read_urbp[i] = urb;
|
priv->read_urbp[i] = urb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,8 +196,8 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
/* some error happened, cancel any submitted urbs and clean up anything that
|
/* some error happened, cancel any submitted urbs and clean up
|
||||||
got allocated successfully */
|
anything that got allocated successfully */
|
||||||
|
|
||||||
while (i-- != 0) {
|
while (i-- != 0) {
|
||||||
urb = priv->read_urbp[i];
|
urb = priv->read_urbp[i];
|
||||||
@@ -315,8 +319,10 @@ static int __init airprime_init(void)
|
|||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
airprime_device.num_ports =
|
airprime_device.num_ports = endpoints;
|
||||||
(endpoints > 0 && endpoints <= MAX_BULK_EPS) ? endpoints : NUM_BULK_EPS;
|
if (endpoints < 0 || endpoints >= MAX_BULK_EPS)
|
||||||
|
airprime_device.num_ports = NUM_BULK_EPS;
|
||||||
|
|
||||||
retval = usb_serial_register(&airprime_device);
|
retval = usb_serial_register(&airprime_device);
|
||||||
if (retval)
|
if (retval)
|
||||||
return retval;
|
return retval;
|
||||||
@@ -341,6 +347,7 @@ MODULE_LICENSE("GPL");
|
|||||||
module_param(debug, bool, S_IRUGO | S_IWUSR);
|
module_param(debug, bool, S_IRUGO | S_IWUSR);
|
||||||
MODULE_PARM_DESC(debug, "Debug enabled");
|
MODULE_PARM_DESC(debug, "Debug enabled");
|
||||||
module_param(buffer_size, int, 0);
|
module_param(buffer_size, int, 0);
|
||||||
MODULE_PARM_DESC(buffer_size, "Size of the transfer buffers in bytes (default 4096)");
|
MODULE_PARM_DESC(buffer_size,
|
||||||
|
"Size of the transfer buffers in bytes (default 4096)");
|
||||||
module_param(endpoints, int, 0);
|
module_param(endpoints, int, 0);
|
||||||
MODULE_PARM_DESC(endpoints, "Number of bulk EPs to configure (default 3)");
|
MODULE_PARM_DESC(endpoints, "Number of bulk EPs to configure (default 3)");
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
#include <linux/usb.h>
|
#include <linux/usb.h>
|
||||||
#include <linux/usb/serial.h>
|
#include <linux/usb/serial.h>
|
||||||
#include <linux/serial.h>
|
#include <linux/serial.h>
|
||||||
#include <asm/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
|
|
||||||
|
|
||||||
static int debug;
|
static int debug;
|
||||||
|
Reference in New Issue
Block a user