summaryrefslogtreecommitdiff
path: root/drivers/net/usb/hso.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb/hso.c')
-rw-r--r--drivers/net/usb/hso.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index dec96e8ab567..a57251ba5991 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -1079,8 +1079,7 @@ static void hso_init_termios(struct ktermios *termios)
tty_termios_encode_baud_rate(termios, 115200, 115200);
}
-static void _hso_serial_set_termios(struct tty_struct *tty,
- struct ktermios *old)
+static void _hso_serial_set_termios(struct tty_struct *tty)
{
struct hso_serial *serial = tty->driver_data;
@@ -1262,7 +1261,7 @@ static int hso_serial_open(struct tty_struct *tty, struct file *filp)
if (serial->port.count == 1) {
serial->rx_state = RX_IDLE;
/* Force default termio settings */
- _hso_serial_set_termios(tty, NULL);
+ _hso_serial_set_termios(tty);
tasklet_setup(&serial->unthrottle_tasklet,
hso_unthrottle_tasklet);
result = hso_start_serial_device(serial->parent, GFP_KERNEL);
@@ -1394,7 +1393,7 @@ static void hso_serial_set_termios(struct tty_struct *tty, struct ktermios *old)
/* the actual setup */
spin_lock_irqsave(&serial->serial_lock, flags);
if (serial->port.count)
- _hso_serial_set_termios(tty, old);
+ _hso_serial_set_termios(tty);
else
tty->termios = *old;
spin_unlock_irqrestore(&serial->serial_lock, flags);
@@ -2353,7 +2352,7 @@ static int remove_net_device(struct hso_device *hso_dev)
}
/* Frees our network device */
-static void hso_free_net_device(struct hso_device *hso_dev, bool bailout)
+static void hso_free_net_device(struct hso_device *hso_dev)
{
int i;
struct hso_net *hso_net = dev2net(hso_dev);
@@ -2376,7 +2375,7 @@ static void hso_free_net_device(struct hso_device *hso_dev, bool bailout)
kfree(hso_net->mux_bulk_tx_buf);
hso_net->mux_bulk_tx_buf = NULL;
- if (hso_net->net && !bailout)
+ if (hso_net->net)
free_netdev(hso_net->net);
kfree(hso_dev);
@@ -2536,13 +2535,17 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
if (!hso_net->mux_bulk_tx_buf)
goto err_free_tx_urb;
- add_net_device(hso_dev);
+ result = add_net_device(hso_dev);
+ if (result) {
+ dev_err(&interface->dev, "Failed to add net device\n");
+ goto err_free_tx_buf;
+ }
/* registering our net device */
result = register_netdev(net);
if (result) {
dev_err(&interface->dev, "Failed to register device\n");
- goto err_free_tx_buf;
+ goto err_rmv_ndev;
}
hso_log_port(hso_dev);
@@ -2551,8 +2554,9 @@ static struct hso_device *hso_create_net_device(struct usb_interface *interface,
return hso_dev;
-err_free_tx_buf:
+err_rmv_ndev:
remove_net_device(hso_dev);
+err_free_tx_buf:
kfree(hso_net->mux_bulk_tx_buf);
err_free_tx_urb:
usb_free_urb(hso_net->mux_bulk_tx_urb);
@@ -3133,7 +3137,7 @@ static void hso_free_interface(struct usb_interface *interface)
rfkill_unregister(rfk);
rfkill_destroy(rfk);
}
- hso_free_net_device(network_table[i], false);
+ hso_free_net_device(network_table[i]);
}
}
}
@@ -3242,9 +3246,10 @@ static int __init hso_init(void)
serial_table[i] = NULL;
/* allocate our driver using the proper amount of supported minors */
- tty_drv = alloc_tty_driver(HSO_SERIAL_TTY_MINORS);
- if (!tty_drv)
- return -ENOMEM;
+ tty_drv = tty_alloc_driver(HSO_SERIAL_TTY_MINORS, TTY_DRIVER_REAL_RAW |
+ TTY_DRIVER_DYNAMIC_DEV);
+ if (IS_ERR(tty_drv))
+ return PTR_ERR(tty_drv);
/* fill in all needed values */
tty_drv->driver_name = driver_name;
@@ -3257,7 +3262,6 @@ static int __init hso_init(void)
tty_drv->minor_start = 0;
tty_drv->type = TTY_DRIVER_TYPE_SERIAL;
tty_drv->subtype = SERIAL_TYPE_NORMAL;
- tty_drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
tty_drv->init_termios = tty_std_termios;
hso_init_termios(&tty_drv->init_termios);
tty_set_operations(tty_drv, &hso_serial_ops);
@@ -3282,7 +3286,7 @@ static int __init hso_init(void)
err_unreg_tty:
tty_unregister_driver(tty_drv);
err_free_tty:
- put_tty_driver(tty_drv);
+ tty_driver_kref_put(tty_drv);
return result;
}
@@ -3293,7 +3297,7 @@ static void __exit hso_exit(void)
tty_unregister_driver(tty_drv);
/* deregister the usb driver */
usb_deregister(&hso_driver);
- put_tty_driver(tty_drv);
+ tty_driver_kref_put(tty_drv);
}
/* Module definitions */