Commit 95da310e authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

usb_serial: API all change

USB serial likes to use port->tty back pointers for the real work it does and
to do so without any actual locking. Unfortunately when you consider hangup
events, hangup/parallel reopen or even worse hangup followed by parallel close
events the tty->port and port->tty pointers are not guaranteed to be the same
as port->tty is the active tty while tty->port is the port the tty may or
may not still be attached to.

So rework the entire API to pass the tty struct. For console cases we need
to pass both for now. This shows up multiple drivers that immediately crash
with USB console some of which have been fixed in the process.

Longer term we need a proper tty as console abstraction
Signed-off-by: 's avatarAlan Cox <alan@redhat.com>
Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: 's avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 1aa3692d
......@@ -272,7 +272,7 @@ static void aircable_read(struct work_struct *work)
* 64 bytes, to ensure I do not get throttled.
* Ask USB mailing list for better aproach.
*/
tty = port->tty;
tty = port->port.tty;
if (!tty) {
schedule_work(&priv->rx_work);
......@@ -378,13 +378,14 @@ static void aircable_shutdown(struct usb_serial *serial)
}
}
static int aircable_write_room(struct usb_serial_port *port)
static int aircable_write_room(struct tty_struct *tty)
{
struct usb_serial_port *port = tty->driver_data;
struct aircable_private *priv = usb_get_serial_port_data(port);
return serial_buf_data_avail(priv->tx_buf);
}
static int aircable_write(struct usb_serial_port *port,
static int aircable_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *source, int count)
{
struct aircable_private *priv = usb_get_serial_port_data(port);
......@@ -466,7 +467,7 @@ static void aircable_read_bulk_callback(struct urb *urb)
if (status) {
dbg("%s - urb status = %d", __func__, status);
if (!port->open_count) {
if (!port->port.count) {
dbg("%s - port is closed, exiting.", __func__);
return;
}
......@@ -494,7 +495,7 @@ static void aircable_read_bulk_callback(struct urb *urb)
usb_serial_debug_data(debug, &port->dev, __func__,
urb->actual_length, urb->transfer_buffer);
tty = port->tty;
tty = port->port.tty;
if (tty && urb->actual_length) {
if (urb->actual_length <= 2) {
/* This is an incomplete package */
......@@ -528,7 +529,7 @@ static void aircable_read_bulk_callback(struct urb *urb)
}
/* Schedule the next read _if_ we are still open */
if (port->open_count) {
if (port->port.count) {
usb_fill_bulk_urb(port->read_urb, port->serial->dev,
usb_rcvbulkpipe(port->serial->dev,
port->bulk_in_endpointAddress),
......@@ -547,8 +548,9 @@ static void aircable_read_bulk_callback(struct urb *urb)
}
/* Based on ftdi_sio.c throttle */
static void aircable_throttle(struct usb_serial_port *port)
static void aircable_throttle(struct tty_struct *tty)
{
struct usb_serial_port *port = tty->driver_data;
struct aircable_private *priv = usb_get_serial_port_data(port);
unsigned long flags;
......@@ -560,8 +562,9 @@ static void aircable_throttle(struct usb_serial_port *port)
}
/* Based on ftdi_sio.c unthrottle */
static void aircable_unthrottle(struct usb_serial_port *port)
static void aircable_unthrottle(struct tty_struct *tty)
{
struct usb_serial_port *port = tty->driver_data;
struct aircable_private *priv = usb_get_serial_port_data(port);
int actually_throttled;
unsigned long flags;
......
/*
* AirPrime CDMA Wireless Serial USB driver
*
* Copyright (C) 2005-2006 Greg Kroah-Hartman <gregkh@suse.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 as published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/usb/serial.h>
static struct usb_device_id id_table [] = {
{ USB_DEVICE(0x0c88, 0x17da) }, /* Kyocera Wireless KPC650/Passport */
{ },
};
MODULE_DEVICE_TABLE(usb, id_table);
#define URB_TRANSFER_BUFFER_SIZE 4096
#define NUM_READ_URBS 4
#define NUM_WRITE_URBS 4
#define NUM_BULK_EPS 3
#define MAX_BULK_EPS 6
/* if overridden by the user, then use their value for the size of the
* read and write urbs, and the number of endpoints */
static int buffer_size = URB_TRANSFER_BUFFER_SIZE;
static int endpoints = NUM_BULK_EPS;
static int debug;
struct airprime_private {
spinlock_t lock;
int outstanding_urbs;
int throttled;
struct urb *read_urbp[NUM_READ_URBS];
/* Settings for the port */
int rts_state; /* Handshaking pins (outputs) */
int dtr_state;
int cts_state; /* Handshaking pins (inputs) */
int dsr_state;
int dcd_state;
int ri_state;
};
static int airprime_send_setup(struct usb_serial_port *port)
{
struct usb_serial *serial = port->serial;
struct airprime_private *priv;
dbg("%s", __func__);
if (port->number != 0)
return 0;
priv = usb_get_serial_port_data(port);
if (port->port.tty) {
int val = 0;
if (priv->dtr_state)
val |= 0x01;
if (priv->rts_state)
val |= 0x02;
return usb_control_msg(serial->dev,
usb_rcvctrlpipe(serial->dev, 0),
0x22, 0x21, val, 0, NULL, 0,
USB_CTRL_SET_TIMEOUT);
}
return 0;
}
static void airprime_read_bulk_callback(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
unsigned char *data = urb->transfer_buffer;
struct tty_struct *tty;
int result;
int status = urb->status;
dbg("%s - port %d", __func__, port->number);
if (status) {
dbg("%s - nonzero read bulk status received: %d",
__func__, status);
return;
}
usb_serial_debug_data(debug, &port->dev, __func__,
urb->actual_length, data);
tty = port->port.tty;
if (tty && urb->actual_length) {
tty_insert_flip_string(tty, data, urb->actual_length);
tty_flip_buffer_push(tty);
}
result = usb_submit_urb(urb, GFP_ATOMIC);
if (result)
dev_err(&port->dev,
"%s - failed resubmitting read urb, error %d\n",
__func__, result);
return;
}
static void airprime_write_bulk_callback(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
struct airprime_private *priv = usb_get_serial_port_data(port);
int status = urb->status;
unsigned long flags;
dbg("%s - port %d", __func__, port->number);
/* free up the transfer buffer, as usb_free_urb() does not do this */
kfree(urb->transfer_buffer);
if (status)
dbg("%s - nonzero write bulk status received: %d",
__func__, status);
spin_lock_irqsave(&priv->lock, flags);
--priv->outstanding_urbs;
spin_unlock_irqrestore(&priv->lock, flags);
usb_serial_port_softint(port);
}
static int airprime_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp)
{
struct airprime_private *priv = usb_get_serial_port_data(port);
struct usb_serial *serial = port->serial;
struct urb *urb;
char *buffer = NULL;
int i;
int result = 0;
dbg("%s - port %d", __func__, port->number);
/* initialize our private data structure if it isn't already created */
if (!priv) {
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) {
result = -ENOMEM;
goto out;
}
spin_lock_init(&priv->lock);
usb_set_serial_port_data(port, priv);
}
/* Set some sane defaults */
priv->rts_state = 1;
priv->dtr_state = 1;
for (i = 0; i < NUM_READ_URBS; ++i) {
buffer = kmalloc(buffer_size, GFP_KERNEL);
if (!buffer) {
dev_err(&port->dev, "%s - out of memory.\n",
__func__);
result = -ENOMEM;
goto errout;
}
urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) {
kfree(buffer);
dev_err(&port->dev, "%s - no more urbs?\n",
__func__);
result = -ENOMEM;
goto errout;
}
usb_fill_bulk_urb(urb, serial->dev,
usb_rcvbulkpipe(serial->dev,
port->bulk_out_endpointAddress),
buffer, buffer_size,
airprime_read_bulk_callback, port);
result = usb_submit_urb(urb, GFP_KERNEL);
if (result) {
usb_free_urb(urb);
kfree(buffer);
dev_err(&port->dev,
"%s - failed submitting read urb %d for port %d, error %d\n",
__func__, i, port->number, result);
goto errout;
}
/* remember this urb so we can kill it when the
port is closed */
priv->read_urbp[i] = urb;
}
airprime_send_setup(port);
goto out;
errout:
/* some error happened, cancel any submitted urbs and clean up
anything that got allocated successfully */
while (i-- != 0) {
urb = priv->read_urbp[i];
buffer = urb->transfer_buffer;
usb_kill_urb(urb);
usb_free_urb(urb);
kfree(buffer);
}
out:
return result;
}
static void airprime_close(struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
{
struct airprime_private *priv = usb_get_serial_port_data(port);
int i;
dbg("%s - port %d", __func__, port->number);
priv->rts_state = 0;
priv->dtr_state = 0;
mutex_lock(&port->serial->disc_mutex);
if (!port->serial->disconnected)
airprime_send_setup(port);
mutex_unlock(&port->serial->disc_mutex);
for (i = 0; i < NUM_READ_URBS; ++i) {
usb_kill_urb(priv->read_urbp[i]);
kfree(priv->read_urbp[i]->transfer_buffer);
usb_free_urb(priv->read_urbp[i]);
}
/* free up private structure */
kfree(priv);
usb_set_serial_port_data(port, NULL);
}
static int airprime_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count)
{
struct airprime_private *priv = usb_get_serial_port_data(port);
struct usb_serial *serial = port->serial;
struct urb *urb;
unsigned char *buffer;
unsigned long flags;
int status;
dbg("%s - port %d", __func__, port->number);
spin_lock_irqsave(&priv->lock, flags);
if (priv->outstanding_urbs > NUM_WRITE_URBS) {
spin_unlock_irqrestore(&priv->lock, flags);
dbg("%s - write limit hit\n", __func__);
return 0;
}
spin_unlock_irqrestore(&priv->lock, flags);
buffer = kmalloc(count, GFP_ATOMIC);
if (!buffer) {
dev_err(&port->dev, "out of memory\n");
return -ENOMEM;
}
urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) {
dev_err(&port->dev, "no more free urbs\n");
kfree(buffer);
return -ENOMEM;
}
memcpy(buffer, buf, count);
usb_serial_debug_data(debug, &port->dev, __func__, count, buffer);
usb_fill_bulk_urb(urb, serial->dev,
usb_sndbulkpipe(serial->dev,
port->bulk_out_endpointAddress),
buffer, count,
airprime_write_bulk_callback, port);
/* send it down the pipe */
status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) {
dev_err(&port->dev,
"%s - usb_submit_urb(write bulk) failed with status = %d\n",
__func__, status);
count = status;
kfree(buffer);
} else {
spin_lock_irqsave(&priv->lock, flags);
++priv->outstanding_urbs;
spin_unlock_irqrestore(&priv->lock, flags);
}
/* we are done with this urb, so let the host driver
* really free it when it is finished with it */
usb_free_urb(urb);
return count;
}
static struct usb_driver airprime_driver = {
.name = "airprime",
.probe = usb_serial_probe,
.disconnect = usb_serial_disconnect,
.id_table = id_table,
.no_dynamic_id = 1,
};
static struct usb_serial_driver airprime_device = {
.driver = {
.owner = THIS_MODULE,
.name = "airprime",
},
.usb_driver = &airprime_driver,
.id_table = id_table,
.open = airprime_open,
.close = airprime_close,
.write = airprime_write,
};
static int __init airprime_init(void)
{
int retval;
airprime_device.num_ports = endpoints;
if (endpoints < 0 || endpoints >= MAX_BULK_EPS)
airprime_device.num_ports = NUM_BULK_EPS;
retval = usb_serial_register(&airprime_device);
if (retval)
return retval;
retval = usb_register(&airprime_driver);
if (retval)
usb_serial_deregister(&airprime_device);
return retval;
}
static void __exit airprime_exit(void)
{
dbg("%s", __func__);
usb_deregister(&airprime_driver);
usb_serial_deregister(&airprime_device);
}
module_init(airprime_init);
module_exit(airprime_exit);
MODULE_LICENSE("GPL");
module_param(debug, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Debug enabled");
module_param(buffer_size, int, 0);
MODULE_PARM_DESC(buffer_size,
"Size of the transfer buffers in bytes (default 4096)");
module_param(endpoints, int, 0);
MODULE_PARM_DESC(endpoints, "Number of bulk EPs to configure (default 3)");
......@@ -158,12 +158,13 @@ cleanup:
return -ENOMEM;
}
static void ark3116_set_termios(struct usb_serial_port *port,
static void ark3116_set_termios(struct tty_struct *tty,
struct usb_serial_port *port,
struct ktermios *old_termios)
{
struct usb_serial *serial = port->serial;
struct ark3116_private *priv = usb_get_serial_port_data(port);
struct ktermios *termios = port->tty->termios;
struct ktermios *termios = tty->termios;
unsigned int cflag = termios->c_cflag;
unsigned long flags;
int baud;
......@@ -177,8 +178,8 @@ static void ark3116_set_termios(struct usb_serial_port *port,
spin_lock_irqsave(&priv->lock, flags);
if (!priv->termios_initialized) {
*(port->tty->termios) = tty_std_termios;
port->tty->termios->c_cflag = B9600 | CS8
*termios = tty_std_termios;
termios->c_cflag = B9600 | CS8
| CREAD | HUPCL | CLOCAL;
termios->c_ispeed = 9600;
termios->c_ospeed = 9600;
......@@ -192,7 +193,7 @@ static void ark3116_set_termios(struct usb_serial_port *port,
buf = kmalloc(1, GFP_KERNEL);
if (!buf) {
dbg("error kmalloc");
*port->tty->termios = *old_termios;
*termios = *old_termios;
return;
}
......@@ -243,7 +244,7 @@ static void ark3116_set_termios(struct usb_serial_port *port,
}
/* set baudrate */
baud = tty_get_baud_rate(port->tty);
baud = tty_get_baud_rate(tty);
switch (baud) {
case 75:
......@@ -262,11 +263,11 @@ static void ark3116_set_termios(struct usb_serial_port *port,
case 230400:
case 460800:
/* Report the resulting rate back to the caller */
tty_encode_baud_rate(port->tty, baud, baud);
tty_encode_baud_rate(tty, baud, baud);
break;
/* set 9600 as default (if given baudrate is invalid for example) */
default:
tty_encode_baud_rate(port->tty, 9600, 9600);
tty_encode_baud_rate(tty, 9600, 9600);
case 0:
baud = 9600;
}
......@@ -317,7 +318,8 @@ static void ark3116_set_termios(struct usb_serial_port *port,
return;
}
static int ark3116_open(struct usb_serial_port *port, struct file *filp)
static int ark3116_open(struct tty_struct *tty, struct usb_serial_port *port,
struct file *filp)
{
struct ktermios tmp_termios;
struct usb_serial *serial = port->serial;
......@@ -332,7 +334,7 @@ static int ark3116_open(struct usb_serial_port *port, struct file *filp)
return -ENOMEM;
}
result = usb_serial_generic_open(port, filp);
result = usb_serial_generic_open(tty, port, filp);
if (result)
goto err_out;
......@@ -362,8 +364,8 @@ static int ark3116_open(struct usb_serial_port *port, struct file *filp)
ARK3116_RCV(serial, 124, 0xFE, 0xC0, 0x0000, 0x0006, 0xFF, buf);
/* initialise termios */
if (port->tty)
ark3116_set_termios(port, &tmp_termios);
if (tty)
ark3116_set_termios(tty, port, &tmp_termios);
err_out:
kfree(buf);
......@@ -371,9 +373,10 @@ err_out:
return result;
}
static int ark3116_ioctl(struct usb_serial_port *port, struct file *file,
static int ark3116_ioctl(struct tty_struct *tty, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct usb_serial_port *port = tty->driver_data;
struct serial_struct serstruct;
void __user *user_arg = (void __user *)arg;
......@@ -403,8 +406,9 @@ static int ark3116_ioctl(struct usb_serial_port *port, struct file *file,
return -ENOIOCTLCMD;
}
static int ark3116_tiocmget(struct usb_serial_port *port, struct file *file)
static int ark3116_tiocmget(struct tty_struct *tty, struct file *file)
{
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial = port->serial;
char *buf;
char temp;
......
......@@ -89,14 +89,13 @@ static int debug;
/* function prototypes for a Belkin USB Serial Adapter F5U103 */
static int belkin_sa_startup (struct usb_serial *serial);
static void belkin_sa_shutdown (struct usb_serial *serial);
static int belkin_sa_open (struct usb_serial_port *port, struct file *filp);
static void belkin_sa_close (struct usb_serial_port *port, struct file *filp);
static int belkin_sa_open (struct tty_struct *tty, struct usb_serial_port *port, struct file *filp);
static void belkin_sa_close (struct tty_struct *tty, struct usb_serial_port *port, struct file *filp);
static void belkin_sa_read_int_callback (struct urb *urb);
static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios * old);
static int belkin_sa_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg);
static void belkin_sa_break_ctl (struct usb_serial_port *port, int break_state );
static int belkin_sa_tiocmget (struct usb_serial_port *port, struct file *file);
static int belkin_sa_tiocmset (struct usb_serial_port *port, struct file *file, unsigned int set, unsigned int clear);
static void belkin_sa_set_termios (struct tty_struct *tty, struct usb_serial_port *port, struct ktermios * old);
static void belkin_sa_break_ctl (struct tty_struct *tty, int break_state );
static int belkin_sa_tiocmget (struct tty_struct *tty, struct file *file);
static int belkin_sa_tiocmset (struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear);
static struct usb_device_id id_table_combined [] = {
......@@ -132,7 +131,6 @@ static struct usb_serial_driver belkin_device = {
.open = belkin_sa_open,
.close = belkin_sa_close,
.read_int_callback = belkin_sa_read_int_callback, /* How we get the status info */
.ioctl = belkin_sa_ioctl,
.set_termios = belkin_sa_set_termios,
.break_ctl = belkin_sa_break_ctl,
.tiocmget = belkin_sa_tiocmget,
......@@ -190,7 +188,7 @@ static int belkin_sa_startup (struct usb_serial *serial)
}
static void belkin_sa_shutdown (struct usb_serial *serial)
static void belkin_sa_shutdown(struct usb_serial *serial)
{
struct belkin_sa_private *priv;
int i;
......@@ -206,7 +204,7 @@ static void belkin_sa_shutdown (struct usb_serial *serial)
}
static int belkin_sa_open (struct usb_serial_port *port, struct file *filp)
static int belkin_sa_open(struct tty_struct *tty, struct usb_serial_port *port, struct file *filp)
{
int retval = 0;
......@@ -235,7 +233,8 @@ exit:
} /* belkin_sa_open */
static void belkin_sa_close (struct usb_serial_port *port, struct file *filp)
static void belkin_sa_close (struct tty_struct *tty,
struct usb_serial_port *port, struct file *filp)
{
dbg("%s port %d", __func__, port->number);
......@@ -246,7 +245,7 @@ static void belkin_sa_close (struct usb_serial_port *port, struct file *filp)
} /* belkin_sa_close */
static void belkin_sa_read_int_callback (struct urb *urb)
static void belkin_sa_read_int_callback(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
struct belkin_sa_private *priv;
......@@ -311,7 +310,7 @@ static void belkin_sa_read_int_callback (struct urb *urb)
* to look in to this before committing any code.
*/
if (priv->last_lsr & BELKIN_SA_LSR_ERR) {
tty = port->tty;
tty = port->port.tty;
/* Overrun Error */
if (priv->last_lsr & BELKIN_SA_LSR_OE) {
}
......@@ -334,7 +333,8 @@ exit:
__func__, retval);
}
static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios *old_termios)
static void belkin_sa_set_termios(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old_termios)
{
struct usb_serial *serial = port->serial;
struct belkin_sa_private *priv = usb_get_serial_port_data(port);
......@@ -347,7 +347,7 @@ static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios
unsigned long control_state;
int bad_flow_control;
speed_t baud;
struct ktermios *termios = port->tty->termios;
struct ktermios *termios = tty->termios;
iflag = termios->c_iflag;
cflag = termios->c_cflag;
......@@ -377,7 +377,7 @@ static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios
}
}
baud = tty_get_baud_rate(port->tty);
baud = tty_get_baud_rate(tty);
if (baud) {
urb_value = BELKIN_SA_BAUD(baud);
/* Clip to maximum speed */
......@@ -387,7 +387,7 @@ static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios
baud = BELKIN_SA_BAUD(urb_value);
/* Report the actual baud rate back to the caller */
tty_encode_baud_rate(port->tty, baud, baud);
tty_encode_baud_rate(tty, baud, baud);
if (BSA_USB_CMD(BELKIN_SA_SET_BAUDRATE_REQUEST, urb_value) < 0)
err("Set baudrate error");
} else {
......@@ -463,8 +463,9 @@ static void belkin_sa_set_termios (struct usb_serial_port *port, struct ktermios
} /* belkin_sa_set_termios */
static void belkin_sa_break_ctl( struct usb_serial_port *port, int break_state )
static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state)
{
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial = port->serial;
if (BSA_USB_CMD(BELKIN_SA_SET_BREAK_REQUEST, break_state ? 1 : 0) < 0)
......@@ -472,8 +473,9 @@ static void belkin_sa_break_ctl( struct usb_serial_port *port, int break_state )
}
static int belkin_sa_tiocmget (struct usb_serial_port *port, struct file *file)
static int belkin_sa_tiocmget(struct tty_struct *tty, struct file *file)
{
struct usb_serial_port *port = tty->driver_data;
struct belkin_sa_private *priv = usb_get_serial_port_data(port);
unsigned long control_state;
unsigned long flags;
......@@ -488,9 +490,10 @@ static int belkin_sa_tiocmget (struct usb_serial_port *port, struct file *file)
}
static int belkin_sa_tiocmset (struct usb_serial_port *port, struct file *file,
static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file,
unsigned int set, unsigned int clear)
{
struct usb_serial_port *port = tty->driver_data;
struct usb_serial *serial = port->serial;
struct belkin_sa_private *priv = usb_get_serial_port_data(port);
unsigned long control_state;
......@@ -540,29 +543,7 @@ exit:
}
static int belkin_sa_ioctl (struct usb_serial_port *port, struct file * file, unsigned int cmd, unsigned long arg)
{
switch (cmd) {
case TIOCMIWAIT:
/* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/
/* TODO */
return( 0 );
case TIOCGICOUNT:
/* return count of modemline transitions */
/* TODO */
return 0;
default:
dbg("belkin_sa_ioctl arg not supported - 0x%04x",cmd);
return(-ENOIOCTLCMD);
break;
}
return 0;
} /* belkin_sa_ioctl */
static int __init belkin_sa_init (void)
static int __init belkin_sa_init(void)
{
int retval;
retval = usb_serial_register(&belkin_device);
......@@ -583,7 +564,7 @@ failed_usb_serial_register:
static void __exit belkin_sa_exit (void)
{
usb_deregister (&belkin_driver);
usb_serial_deregister (&belkin_device);
usb_serial_deregister(&belkin_device);
}