Commit b1481cdc authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] USB Kaweth driver update

Here's a patch against 2.5.3 for the USB kaweth driver that does the
following:
	- removes SMP deadlock
	- removes nfs deadlock
	- fixes a memory leak when the firmware is not loaded.
	- few other minor cleanups.
This patch was done by Oliver Neukum.
parent 491b5970
...@@ -155,6 +155,7 @@ MODULE_DEVICE_TABLE (usb, usb_klsi_table); ...@@ -155,6 +155,7 @@ MODULE_DEVICE_TABLE (usb, usb_klsi_table);
* kaweth_driver * kaweth_driver
****************************************************************/ ****************************************************************/
static struct usb_driver kaweth_driver = { static struct usb_driver kaweth_driver = {
owner: THIS_MODULE,
name: "kaweth", name: "kaweth",
probe: kaweth_probe, probe: kaweth_probe,
disconnect: kaweth_disconnect, disconnect: kaweth_disconnect,
...@@ -238,8 +239,7 @@ static int kaweth_control(struct kaweth_device *kaweth, ...@@ -238,8 +239,7 @@ static int kaweth_control(struct kaweth_device *kaweth,
return -EBUSY; return -EBUSY;
} }
dr = kmalloc(sizeof(struct usb_ctrlrequest), dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
if (!dr) { if (!dr) {
kaweth_dbg("kmalloc() failed"); kaweth_dbg("kmalloc() failed");
...@@ -586,14 +586,10 @@ static void kaweth_usb_transmit_complete(struct urb *urb) ...@@ -586,14 +586,10 @@ static void kaweth_usb_transmit_complete(struct urb *urb)
{ {
struct kaweth_device *kaweth = urb->context; struct kaweth_device *kaweth = urb->context;
spin_lock(&kaweth->device_lock); if (unlikely(urb->status != 0))
if (urb->status)
kaweth_dbg("%s: TX status %d.", kaweth->net->name, urb->status); kaweth_dbg("%s: TX status %d.", kaweth->net->name, urb->status);
netif_wake_queue(kaweth->net); netif_wake_queue(kaweth->net);
spin_unlock(&kaweth->device_lock);
} }
/**************************************************************** /****************************************************************
...@@ -757,9 +753,7 @@ static void *kaweth_probe( ...@@ -757,9 +753,7 @@ static void *kaweth_probe(
memset(kaweth, 0, sizeof(struct kaweth_device)); memset(kaweth, 0, sizeof(struct kaweth_device));
kaweth->dev = dev; kaweth->dev = dev;
kaweth->status = 0; spin_lock_init(&kaweth->device_lock);
kaweth->net = NULL;
kaweth->device_lock = SPIN_LOCK_UNLOCKED;
kaweth_dbg("Resetting."); kaweth_dbg("Resetting.");
...@@ -824,6 +818,7 @@ static void *kaweth_probe( ...@@ -824,6 +818,7 @@ static void *kaweth_probe(
/* Device will now disappear for a moment... */ /* Device will now disappear for a moment... */
kaweth_info("Firmware loaded. I'll be back..."); kaweth_info("Firmware loaded. I'll be back...");
kfree(kaweth);
return NULL; return NULL;
} }
...@@ -925,6 +920,8 @@ static void kaweth_disconnect(struct usb_device *dev, void *ptr) ...@@ -925,6 +920,8 @@ static void kaweth_disconnect(struct usb_device *dev, void *ptr)
kaweth_warn("unregistering non-existant device"); kaweth_warn("unregistering non-existant device");
return; return;
} }
usb_unlink_urb(kaweth->tx_urb);
usb_unlink_urb(kaweth->rx_urb);
if(kaweth->net) { if(kaweth->net) {
if(kaweth->net->flags & IFF_UP) { if(kaweth->net->flags & IFF_UP) {
......
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