summaryrefslogtreecommitdiffstats
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.c83
1 files changed, 44 insertions, 39 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index fe98acaead9..f84b78d94c4 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -5,6 +5,7 @@
* Copyright (C) 2008 Option International
* Filip Aben <f.aben@option.com>
* Denis Joseph Barrow <d.barow@option.com>
+ * Jan Dumon <j.dumon@option.com>
* Copyright (C) 2007 Andrew Bird (Sphere Systems Ltd)
* <ajb@spheresystems.co.uk>
* Copyright (C) 2008 Greg Kroah-Hartman <gregkh@suse.de>
@@ -462,9 +463,16 @@ static const struct usb_device_id hso_ids[] = {
{USB_DEVICE(0x0af0, 0x7701)},
{USB_DEVICE(0x0af0, 0x7801)},
{USB_DEVICE(0x0af0, 0x7901)},
- {USB_DEVICE(0x0af0, 0x7361)},
- {USB_DEVICE(0x0af0, 0xd057)},
+ {USB_DEVICE(0x0af0, 0x8200)},
+ {USB_DEVICE(0x0af0, 0x8201)},
+ {USB_DEVICE(0x0af0, 0xd035)},
{USB_DEVICE(0x0af0, 0xd055)},
+ {USB_DEVICE(0x0af0, 0xd155)},
+ {USB_DEVICE(0x0af0, 0xd255)},
+ {USB_DEVICE(0x0af0, 0xd057)},
+ {USB_DEVICE(0x0af0, 0xd157)},
+ {USB_DEVICE(0x0af0, 0xd257)},
+ {USB_DEVICE(0x0af0, 0xd357)},
{}
};
MODULE_DEVICE_TABLE(usb, hso_ids);
@@ -936,8 +944,7 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt,
if (!odev->rx_buf_missing) {
/* Packet is complete. Inject into stack. */
/* We have IP packet here */
- odev->skb_rx_buf->protocol =
- __constant_htons(ETH_P_IP);
+ odev->skb_rx_buf->protocol = cpu_to_be16(ETH_P_IP);
/* don't check it */
odev->skb_rx_buf->ip_summed =
CHECKSUM_UNNECESSARY;
@@ -1247,7 +1254,7 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
* This needs to be a tasklet otherwise we will
* end up recursively calling this function.
*/
-void hso_unthrottle_tasklet(struct hso_serial *serial)
+static void hso_unthrottle_tasklet(struct hso_serial *serial)
{
unsigned long flags;
@@ -1266,7 +1273,7 @@ static void hso_unthrottle(struct tty_struct *tty)
tasklet_hi_schedule(&serial->unthrottle_tasklet);
}
-void hso_unthrottle_workfunc(struct work_struct *work)
+static void hso_unthrottle_workfunc(struct work_struct *work)
{
struct hso_serial *serial =
container_of(work, struct hso_serial,
@@ -1465,9 +1472,9 @@ static int hso_serial_chars_in_buffer(struct tty_struct *tty)
return chars;
}
-int tiocmget_submit_urb(struct hso_serial *serial,
- struct hso_tiocmget *tiocmget,
- struct usb_device *usb)
+static int tiocmget_submit_urb(struct hso_serial *serial,
+ struct hso_tiocmget *tiocmget,
+ struct usb_device *usb)
{
int result;
@@ -2364,12 +2371,6 @@ exit:
return -1;
}
-/* Frees a general hso device */
-static void hso_free_device(struct hso_device *hso_dev)
-{
- kfree(hso_dev);
-}
-
/* Creates a general hso device */
static struct hso_device *hso_create_device(struct usb_interface *intf,
int port_spec)
@@ -2417,24 +2418,33 @@ static void hso_free_net_device(struct hso_device *hso_dev)
if (!hso_net)
return;
+ remove_net_device(hso_net->parent);
+
+ if (hso_net->net) {
+ unregister_netdev(hso_net->net);
+ free_netdev(hso_net->net);
+ }
+
/* start freeing */
for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
usb_free_urb(hso_net->mux_bulk_rx_urb_pool[i]);
kfree(hso_net->mux_bulk_rx_buf_pool[i]);
+ hso_net->mux_bulk_rx_buf_pool[i] = NULL;
}
usb_free_urb(hso_net->mux_bulk_tx_urb);
kfree(hso_net->mux_bulk_tx_buf);
+ hso_net->mux_bulk_tx_buf = NULL;
- remove_net_device(hso_net->parent);
-
- if (hso_net->net) {
- unregister_netdev(hso_net->net);
- free_netdev(hso_net->net);
- }
-
- hso_free_device(hso_dev);
+ kfree(hso_dev);
}
+static const struct net_device_ops hso_netdev_ops = {
+ .ndo_open = hso_net_open,
+ .ndo_stop = hso_net_close,
+ .ndo_start_xmit = hso_net_start_xmit,
+ .ndo_tx_timeout = hso_net_tx_timeout,
+};
+
/* initialize the network interface */
static void hso_net_init(struct net_device *net)
{
@@ -2443,10 +2453,7 @@ static void hso_net_init(struct net_device *net)
D1("sizeof hso_net is %d", (int)sizeof(*hso_net));
/* fill in the other fields */
- net->open = hso_net_open;
- net->stop = hso_net_close;
- net->hard_start_xmit = hso_net_start_xmit;
- net->tx_timeout = hso_net_tx_timeout;
+ net->netdev_ops = &hso_netdev_ops;
net->watchdog_timeo = HSO_NET_TX_TIMEOUT;
net->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
net->type = ARPHRD_NONE;
@@ -2529,14 +2536,15 @@ static void hso_create_rfkill(struct hso_device *hso_dev,
}
/* Creates our network device */
-static struct hso_device *hso_create_net_device(struct usb_interface *interface)
+static struct hso_device *hso_create_net_device(struct usb_interface *interface,
+ int port_spec)
{
int result, i;
struct net_device *net;
struct hso_net *hso_net;
struct hso_device *hso_dev;
- hso_dev = hso_create_device(interface, HSO_INTF_MUX | HSO_PORT_NETWORK);
+ hso_dev = hso_create_device(interface, port_spec);
if (!hso_dev)
return NULL;
@@ -2616,12 +2624,12 @@ static void hso_free_tiomget(struct hso_serial *serial)
{
struct hso_tiocmget *tiocmget = serial->tiocmget;
if (tiocmget) {
- kfree(tiocmget);
if (tiocmget->urb) {
usb_free_urb(tiocmget->urb);
tiocmget->urb = NULL;
}
serial->tiocmget = NULL;
+ kfree(tiocmget);
}
}
@@ -2646,7 +2654,7 @@ static void hso_free_serial_device(struct hso_device *hso_dev)
}
hso_free_tiomget(serial);
kfree(serial);
- hso_free_device(hso_dev);
+ kfree(hso_dev);
}
/* Creates a bulk AT channel */
@@ -2727,7 +2735,7 @@ exit2:
exit:
hso_free_tiomget(serial);
kfree(serial);
- hso_free_device(hso_dev);
+ kfree(hso_dev);
return NULL;
}
@@ -2786,7 +2794,7 @@ exit:
kfree(serial);
}
if (hso_dev)
- hso_free_device(hso_dev);
+ kfree(hso_dev);
return NULL;
}
@@ -2936,7 +2944,8 @@ static int hso_probe(struct usb_interface *interface,
if ((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK) {
/* Create the network device */
if (!disable_net) {
- hso_dev = hso_create_net_device(interface);
+ hso_dev = hso_create_net_device(interface,
+ port_spec);
if (!hso_dev)
goto exit;
tmp_dev = hso_dev;
@@ -2968,7 +2977,7 @@ static int hso_probe(struct usb_interface *interface,
/* It's a regular bulk interface */
if (((port_spec & HSO_PORT_MASK) == HSO_PORT_NETWORK)
&& !disable_net)
- hso_dev = hso_create_net_device(interface);
+ hso_dev = hso_create_net_device(interface, port_spec);
else
hso_dev =
hso_create_bulk_serial_device(interface, port_spec);
@@ -2979,8 +2988,6 @@ static int hso_probe(struct usb_interface *interface,
goto exit;
}
- usb_driver_claim_interface(&hso_driver, interface, hso_dev);
-
/* save our data pointer in this device */
usb_set_intfdata(interface, hso_dev);
@@ -2998,8 +3005,6 @@ static void hso_disconnect(struct usb_interface *interface)
/* remove reference of our private data */
usb_set_intfdata(interface, NULL);
-
- usb_driver_release_interface(&hso_driver, interface);
}
static void async_get_intf(struct work_struct *data)