cyberjack: Coding style
Coding style fixups Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
ff7eb60260
commit
b9c52f155f
@ -37,7 +37,7 @@
|
||||
#include <linux/tty_flip.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/usb.h>
|
||||
#include <linux/usb/serial.h>
|
||||
|
||||
@ -145,7 +145,7 @@ static int cyberjack_startup(struct usb_serial *serial)
|
||||
dbg("%s - usb_submit_urb(int urb)", __func__);
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cyberjack_shutdown(struct usb_serial *serial)
|
||||
@ -230,7 +230,7 @@ static int cyberjack_write(struct tty_struct *tty,
|
||||
|
||||
spin_lock_irqsave(&priv->lock, flags);
|
||||
|
||||
if( (count+priv->wrfilled) > sizeof(priv->wrbuf) ) {
|
||||
if (count+priv->wrfilled > sizeof(priv->wrbuf)) {
|
||||
/* To much data for buffer. Reset buffer. */
|
||||
priv->wrfilled = 0;
|
||||
port->write_urb_busy = 0;
|
||||
@ -248,16 +248,16 @@ static int cyberjack_write(struct tty_struct *tty,
|
||||
if (priv->wrfilled >= 3) {
|
||||
wrexpected = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3;
|
||||
dbg("%s - expected data: %d", __func__, wrexpected);
|
||||
} else {
|
||||
} else
|
||||
wrexpected = sizeof(priv->wrbuf);
|
||||
}
|
||||
|
||||
if (priv->wrfilled >= wrexpected) {
|
||||
/* We have enough data to begin transmission */
|
||||
int length;
|
||||
|
||||
dbg("%s - transmitting data (frame 1)", __func__);
|
||||
length = (wrexpected > port->bulk_out_size) ? port->bulk_out_size : wrexpected;
|
||||
length = (wrexpected > port->bulk_out_size) ?
|
||||
port->bulk_out_size : wrexpected;
|
||||
|
||||
memcpy(port->write_urb->transfer_buffer, priv->wrbuf, length);
|
||||
priv->wrsent = length;
|
||||
@ -274,7 +274,8 @@ static int cyberjack_write(struct tty_struct *tty,
|
||||
/* send the data out the bulk port */
|
||||
result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
|
||||
if (result) {
|
||||
err("%s - failed submitting write urb, error %d", __func__, result);
|
||||
err("%s - failed submitting write urb, error %d",
|
||||
__func__, result);
|
||||
/* Throw away data. No better idea what to do with it. */
|
||||
priv->wrfilled = 0;
|
||||
priv->wrsent = 0;
|
||||
@ -296,7 +297,7 @@ static int cyberjack_write(struct tty_struct *tty,
|
||||
|
||||
spin_unlock_irqrestore(&priv->lock, flags);
|
||||
|
||||
return (count);
|
||||
return count;
|
||||
}
|
||||
|
||||
static int cyberjack_write_room(struct tty_struct *tty)
|
||||
@ -319,10 +320,11 @@ static void cyberjack_read_int_callback(struct urb *urb)
|
||||
if (status)
|
||||
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);
|
||||
|
||||
/* React only to interrupts signaling a bulk_in transfer */
|
||||
if( (urb->actual_length == 4) && (data[0] == 0x01) ) {
|
||||
if (urb->actual_length == 4 && data[0] == 0x01) {
|
||||
short old_rdtodo;
|
||||
|
||||
/* This is a announcement of coming bulk_ins. */
|
||||
@ -332,7 +334,7 @@ static void cyberjack_read_int_callback(struct urb *urb)
|
||||
|
||||
old_rdtodo = priv->rdtodo;
|
||||
|
||||
if( (old_rdtodo+size)<(old_rdtodo) ) {
|
||||
if (old_rdtodo + size < old_rdtodo) {
|
||||
dbg("To many bulk_in urbs to do.");
|
||||
spin_unlock(&priv->lock);
|
||||
goto resubmit;
|
||||
@ -374,7 +376,8 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
|
||||
|
||||
dbg("%s - port %d", __func__, port->number);
|
||||
|
||||
usb_serial_debug_data(debug, &port->dev, __func__, urb->actual_length, data);
|
||||
usb_serial_debug_data(debug, &port->dev, __func__,
|
||||
urb->actual_length, data);
|
||||
if (status) {
|
||||
dbg("%s - nonzero read bulk status received: %d",
|
||||
__func__, status);
|
||||
@ -397,7 +400,8 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
|
||||
/* Reduce urbs to do by one. */
|
||||
priv->rdtodo -= urb->actual_length;
|
||||
/* Just to be sure */
|
||||
if ( priv->rdtodo<0 ) priv->rdtodo = 0;
|
||||
if (priv->rdtodo < 0)
|
||||
priv->rdtodo = 0;
|
||||
todo = priv->rdtodo;
|
||||
|
||||
spin_unlock(&priv->lock);
|
||||
@ -409,7 +413,8 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
|
||||
port->read_urb->dev = port->serial->dev;
|
||||
result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
|
||||
if (result)
|
||||
err("%s - failed resubmitting read urb, error %d", __func__, result);
|
||||
err("%s - failed resubmitting read urb, error %d",
|
||||
__func__, result);
|
||||
dbg("%s - usb_submit_urb(read urb)", __func__);
|
||||
}
|
||||
}
|
||||
@ -440,8 +445,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
|
||||
length = ((priv->wrfilled - priv->wrsent) > port->bulk_out_size) ?
|
||||
port->bulk_out_size : (priv->wrfilled - priv->wrsent);
|
||||
|
||||
memcpy (port->write_urb->transfer_buffer, priv->wrbuf + priv->wrsent,
|
||||
length );
|
||||
memcpy(port->write_urb->transfer_buffer,
|
||||
priv->wrbuf + priv->wrsent, length);
|
||||
priv->wrsent += length;
|
||||
|
||||
/* set up our urb */
|
||||
@ -456,7 +461,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
|
||||
/* send the data out the bulk port */
|
||||
result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
|
||||
if (result) {
|
||||
err("%s - failed submitting write urb, error %d", __func__, result);
|
||||
err("%s - failed submitting write urb, error %d",
|
||||
__func__, result);
|
||||
/* Throw away data. No better idea what to do with it. */
|
||||
priv->wrfilled = 0;
|
||||
priv->wrsent = 0;
|
||||
@ -468,7 +474,8 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
|
||||
|
||||
blksize = ((int)priv->wrbuf[2]<<8)+priv->wrbuf[1]+3;
|
||||
|
||||
if( (priv->wrsent>=priv->wrfilled) || (priv->wrsent>=blksize) ) {
|
||||
if (priv->wrsent >= priv->wrfilled ||
|
||||
priv->wrsent >= blksize) {
|
||||
dbg("%s - buffer cleaned", __func__);
|
||||
memset(priv->wrbuf, 0, sizeof(priv->wrbuf));
|
||||
priv->wrfilled = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user