USB: serial: metro-usb: fix up coding style errors

This fixes up all of the coding style errors, and removes the initial,
unneeded comments on how to load the module and the old changelog which
are no longer needed.

There are still a number of coding style warnings left, I'll get to them
later.

Cc: Aleksey Babahin <tamerlan311@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Greg Kroah-Hartman 2012-03-08 13:50:54 -08:00
parent 159d4d8d5e
commit d4cbd6e990
1 changed files with 65 additions and 95 deletions

View File

@ -1,32 +1,9 @@
/*
Date Created: 9/15/2006
File Name: metro-usb.c
Description: metro-usb.c is the drivers main source file. The driver is a USB to Serial converter.
The driver takes USB data and sends it to a virtual ttyUSB# serial port.
The driver interfaces with the usbserial.ko driver supplied by Linux.
NOTES:
To install the driver:
1. Install the usbserial.ko module supplied by Linux with: # insmod usbserial.ko
2. Install the metro-usb.ko module with: # insmod metro-usb.ko
Some of this code is credited to Linux USB open source files that are distributed with Linux.
Some of this code is credited to Linux USB open source files that are
distributed with Linux.
Copyright: 2007 Metrologic Instruments. All rights reserved.
Copyright: 2011 Azimut Ltd. <http://azimutrzn.ru/>
Requirements: gedit.exe, notepad.exe
Revision History:
Date: Developer: Revisions:
------------------------------------------------------------------------------
1/30/2007 Philip Nicastro Initial release. (v1.0.0.0)
2/27/2007 Philip Nicastro Changed the metrousb_read_int_callback function to use a loop with the tty_insert_flip_char function to copy each byte to the tty layer. Removed the tty_buffer_request_room and the tty_insert_flip_string function calls. These calls were not supported on Fedora.
2/27/2007 Philip Nicastro Released. (v1.1.0.0)
10/07/2011 Aleksey Babahin Update for new kernel (tested on 2.6.38)
Add unidirection mode support
*/
#include <linux/kernel.h>
@ -41,8 +18,8 @@
#include <linux/moduleparam.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
#include <linux/uaccess.h>
#include <linux/usb/serial.h>
#include <asm/uaccess.h>
/* Version Information */
#define DRIVER_VERSION "v1.2.0.0"
@ -144,12 +121,6 @@ static void metrousb_cleanup (struct usb_serial_port *port)
usb_unlink_urb(port->interrupt_in_urb);
usb_kill_urb(port->interrupt_in_urb);
}
// temp
// this will be needed for the write urb
/* Shutdown any interrupt_out_urbs. */
//if (serial->num_bulk_in)
// usb_kill_urb(port->read_urb);
}
}
@ -207,9 +178,8 @@ static int metrousb_open (struct tty_struct *tty, struct usb_serial_port *port)
* through, otherwise it is scheduled, and with high data rates (like
* with OHCI) data can get lost.
*/
if (tty) {
if (tty)
tty->low_latency = 1;
}
/* Clear the urb pipe. */
usb_clear_halt(serial->dev, port->interrupt_in_urb->pipe);
@ -282,10 +252,10 @@ static void metrousb_read_int_callback (struct urb *urb)
}
if (tty && urb->actual_length) {
// Loop through the data copying each byte to the tty layer.
/* Loop through the data copying each byte to the tty layer. */
tty_insert_flip_string(tty, data, urb->actual_length);
// Force the data to the tty layer.
/* Force the data to the tty layer. */
tty_flip_buffer_push(tty);
}
tty_kref_put(tty);
@ -409,7 +379,7 @@ static int metrousb_startup(struct usb_serial *serial)
port = serial->port[i];
/* Declare memory. */
metro_priv = (struct metrousb_private *) kmalloc (sizeof(struct metrousb_private), GFP_KERNEL);
metro_priv = kmalloc(sizeof(struct metrousb_private), GFP_KERNEL);
if (!metro_priv)
return -ENOMEM;
@ -504,7 +474,7 @@ static int metrousb_tiocmset (struct tty_struct *tty,
spin_lock_irqsave(&metro_priv->lock, flags);
control_state = metro_priv->control_state;
// Set the RTS and DTR values.
/* Set the RTS and DTR values. */
if (set & TIOCM_RTS)
control_state |= TIOCM_RTS;
if (set & TIOCM_DTR)