Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d4cbd6e9 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 159d4d8d
Loading
Loading
Loading
Loading
+65 −95
Original line number Original line Diff line number Diff line
/*
/*
  Date Created:	9/15/2006
  Some of this code is credited to Linux USB open source files that are
  File Name:		metro-usb.c
  distributed with Linux.
  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.


  Copyright:	2007 Metrologic Instruments. All rights reserved.
  Copyright:	2007 Metrologic Instruments. All rights reserved.
  Copyright:	2011 Azimut Ltd. <http://azimutrzn.ru/>
  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>
#include <linux/kernel.h>
@@ -41,8 +18,8 @@
#include <linux/moduleparam.h>
#include <linux/moduleparam.h>
#include <linux/spinlock.h>
#include <linux/spinlock.h>
#include <linux/errno.h>
#include <linux/errno.h>
#include <linux/uaccess.h>
#include <linux/usb/serial.h>
#include <linux/usb/serial.h>
#include <asm/uaccess.h>


/* Version Information */
/* Version Information */
#define DRIVER_VERSION "v1.2.0.0"
#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_unlink_urb(port->interrupt_in_urb);
			usb_kill_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
	 * through, otherwise it is scheduled, and with high data rates (like
	 * with OHCI) data can get lost.
	 * with OHCI) data can get lost.
	 */
	 */
	if (tty) {
	if (tty)
		tty->low_latency = 1;
		tty->low_latency = 1;
	}


	/* Clear the urb pipe. */
	/* Clear the urb pipe. */
	usb_clear_halt(serial->dev, port->interrupt_in_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) {
	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);
		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_flip_buffer_push(tty);
	}
	}
	tty_kref_put(tty);
	tty_kref_put(tty);
@@ -409,7 +379,7 @@ static int metrousb_startup(struct usb_serial *serial)
		port = serial->port[i];
		port = serial->port[i];


		/* Declare memory. */
		/* 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)
		if (!metro_priv)
			return -ENOMEM;
			return -ENOMEM;


@@ -504,7 +474,7 @@ static int metrousb_tiocmset (struct tty_struct *tty,
	spin_lock_irqsave(&metro_priv->lock, flags);
	spin_lock_irqsave(&metro_priv->lock, flags);
	control_state = metro_priv->control_state;
	control_state = metro_priv->control_state;


	// Set the RTS and DTR values.
	/* Set the RTS and DTR values. */
	if (set & TIOCM_RTS)
	if (set & TIOCM_RTS)
		control_state |= TIOCM_RTS;
		control_state |= TIOCM_RTS;
	if (set & TIOCM_DTR)
	if (set & TIOCM_DTR)