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

USB: serial: clean up comments in generic driver

Clean up some comments, drop excessive comments and fix-up style.
Signed-off-by: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 059239ad
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version * modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation. * 2 as published by the Free Software Foundation.
*
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -37,7 +36,6 @@ MODULE_PARM_DESC(product, "User specified USB idProduct"); ...@@ -37,7 +36,6 @@ MODULE_PARM_DESC(product, "User specified USB idProduct");
static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */ static struct usb_device_id generic_device_ids[2]; /* Initially all zeroes. */
/* All of the device info needed for the Generic Serial Converter */
struct usb_serial_driver usb_serial_generic_device = { struct usb_serial_driver usb_serial_generic_device = {
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -66,7 +64,6 @@ int usb_serial_generic_register(void) ...@@ -66,7 +64,6 @@ int usb_serial_generic_register(void)
generic_device_ids[0].match_flags = generic_device_ids[0].match_flags =
USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT; USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT;
/* register our generic driver with ourselves */
retval = usb_serial_register_drivers(serial_drivers, retval = usb_serial_register_drivers(serial_drivers,
"usbserial_generic", generic_device_ids); "usbserial_generic", generic_device_ids);
#endif #endif
...@@ -76,7 +73,6 @@ int usb_serial_generic_register(void) ...@@ -76,7 +73,6 @@ int usb_serial_generic_register(void)
void usb_serial_generic_deregister(void) void usb_serial_generic_deregister(void)
{ {
#ifdef CONFIG_USB_SERIAL_GENERIC #ifdef CONFIG_USB_SERIAL_GENERIC
/* remove our generic driver */
usb_serial_deregister_drivers(serial_drivers); usb_serial_deregister_drivers(serial_drivers);
#endif #endif
} }
...@@ -86,13 +82,11 @@ int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port ...@@ -86,13 +82,11 @@ int usb_serial_generic_open(struct tty_struct *tty, struct usb_serial_port *port
int result = 0; int result = 0;
unsigned long flags; unsigned long flags;
/* clear the throttle flags */
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
port->throttled = 0; port->throttled = 0;
port->throttle_req = 0; port->throttle_req = 0;
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
/* if we have a bulk endpoint, start reading from it */
if (port->bulk_in_size) if (port->bulk_in_size)
result = usb_serial_generic_submit_read_urbs(port, GFP_KERNEL); result = usb_serial_generic_submit_read_urbs(port, GFP_KERNEL);
...@@ -127,10 +121,12 @@ int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port, ...@@ -127,10 +121,12 @@ int usb_serial_generic_prepare_write_buffer(struct usb_serial_port *port,
} }
/** /**
* usb_serial_generic_write_start - kick off an URB write * usb_serial_generic_write_start - start writing buffered data
* @port: Pointer to the &struct usb_serial_port data * @port: usb-serial port
*
* Serialised using USB_SERIAL_WRITE_BUSY flag.
* *
* Returns zero on success, or a negative errno value * Return: Zero on success or if busy, otherwise a negative errno value.
*/ */
static int usb_serial_generic_write_start(struct usb_serial_port *port) static int usb_serial_generic_write_start(struct usb_serial_port *port)
{ {
...@@ -175,9 +171,10 @@ static int usb_serial_generic_write_start(struct usb_serial_port *port) ...@@ -175,9 +171,10 @@ static int usb_serial_generic_write_start(struct usb_serial_port *port)
clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags); clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags);
return result; return result;
} }
/*
/* Try sending off another urb, unless in irq context (in which case * Try sending off another urb, unless in irq context (in which case
* there will be no free urb). */ * there will be no free urb).
*/
if (!in_irq()) if (!in_irq())
goto retry; goto retry;
...@@ -187,22 +184,20 @@ static int usb_serial_generic_write_start(struct usb_serial_port *port) ...@@ -187,22 +184,20 @@ static int usb_serial_generic_write_start(struct usb_serial_port *port)
} }
/** /**
* usb_serial_generic_write - generic write function for serial USB devices * usb_serial_generic_write - generic write function
* @tty: Pointer to &struct tty_struct for the device * @tty: tty for the port
* @port: Pointer to the &usb_serial_port structure for the device * @port: usb-serial port
* @buf: Pointer to the data to write * @buf: data to write
* @count: Number of bytes to write * @count: number of bytes to write
* *
* Returns the number of characters actually written, which may be anything * Return: The number of characters buffered, which may be anything from
* from zero to @count. If an error occurs, it returns the negative errno * zero to @count, or a negative errno value.
* value.
*/ */
int usb_serial_generic_write(struct tty_struct *tty, int usb_serial_generic_write(struct tty_struct *tty,
struct usb_serial_port *port, const unsigned char *buf, int count) struct usb_serial_port *port, const unsigned char *buf, int count)
{ {
int result; int result;
/* only do something if we have a bulk out endpoint */
if (!port->bulk_out_size) if (!port->bulk_out_size)
return -ENODEV; return -ENODEV;
...@@ -337,10 +332,11 @@ void usb_serial_generic_process_read_urb(struct urb *urb) ...@@ -337,10 +332,11 @@ void usb_serial_generic_process_read_urb(struct urb *urb)
if (!urb->actual_length) if (!urb->actual_length)
return; return;
/*
/* The per character mucking around with sysrq path it too slow for * The per character mucking around with sysrq path it too slow for
stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases * stuff like 3G modems, so shortcircuit it in the 99.9999999% of
where the USB serial is not a console anyway */ * cases where the USB serial is not a console anyway.
*/
if (!port->port.console || !port->sysrq) if (!port->port.console || !port->sysrq)
tty_insert_flip_string(&port->port, ch, urb->actual_length); tty_insert_flip_string(&port->port, ch, urb->actual_length);
else { else {
...@@ -425,8 +421,6 @@ void usb_serial_generic_throttle(struct tty_struct *tty) ...@@ -425,8 +421,6 @@ void usb_serial_generic_throttle(struct tty_struct *tty)
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
unsigned long flags; unsigned long flags;
/* Set the throttle request flag. It will be picked up
* by usb_serial_generic_read_bulk_callback(). */
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
port->throttle_req = 1; port->throttle_req = 1;
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
...@@ -438,7 +432,6 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty) ...@@ -438,7 +432,6 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty)
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
int was_throttled; int was_throttled;
/* Clear the throttle flags */
spin_lock_irq(&port->lock); spin_lock_irq(&port->lock);
was_throttled = port->throttled; was_throttled = port->throttled;
port->throttled = port->throttle_req = 0; port->throttled = port->throttle_req = 0;
...@@ -559,8 +552,8 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_break); ...@@ -559,8 +552,8 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_break);
/** /**
* usb_serial_handle_dcd_change - handle a change of carrier detect state * usb_serial_handle_dcd_change - handle a change of carrier detect state
* @port: usb_serial_port structure for the open port * @port: usb-serial port
* @tty: tty_struct structure for the port * @tty: tty for the port
* @status: new carrier detect status, nonzero if active * @status: new carrier detect status, nonzero if active
*/ */
void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port,
......
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