[PATCH] smsc95xx: add missing .reset_resume hook and reset card

From: Viliam Mateicka
Date: Thu Jul 14 2011 - 07:52:09 EST


This patch fixes the undefined behaviour (random MAC, interface goes down) of smsc95xx driver after resume from suspend.
Calling smsc95xx_reset() is needed to properly set hw registers of card and bring interface up to defined state.

Signed-off-by: Viliam Mateicka <viliam.mateicka@xxxxxxxxx>
---
drivers/net/usb/smsc95xx.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index f74f3ce..5c33be8 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -1181,6 +1181,17 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev,
return skb;
}

+static int smsc95xx_reset_resume(struct usb_interface *intf)
+{
+ struct usbnet *dev = usb_get_intfdata(intf);
+
+ smsc95xx_reset(dev);
+
+ usbnet_resume(intf);
+
+ return 0;
+}
+
static const struct driver_info smsc95xx_info = {
.description = "smsc95xx USB 2.0 Ethernet",
.bind = smsc95xx_bind,
@@ -1295,6 +1306,7 @@ static struct usb_driver smsc95xx_driver = {
.suspend = usbnet_suspend,
.resume = usbnet_resume,
.disconnect = usbnet_disconnect,
+ .reset_resume = smsc95xx_reset_resume,
};

static int __init smsc95xx_init(void)
--
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/