mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viliam Mateicka <viliam.mateicka@gmail.com>
To: "David S . Miller " <davem@davemloft.net>,
	mirq-linux@rere.qmqm.pl,
	Steve Glendinning <steve.glendinning@smsc.com>,
	Rabin Vincent <rabin@rab.in>, David Decotigny <decot@google.com>,
	linux-kernel@vger.kernel.org
Cc: Viliam Mateicka <viliam.mateicka@gmail.com>
Subject: [PATCH] smsc95xx: add missing .reset_resume hook and reset card
Date: Thu, 14 Jul 2011 13:51:46 +0200	[thread overview]
Message-ID: <1310644306-16180-1-git-send-email-viliam.mateicka@gmail.com> (raw)

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@gmail.com>
---
 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


             reply	other threads:[~2011-07-14 11:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14 11:51 Viliam Mateicka [this message]
2011-07-14 16:03 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1310644306-16180-1-git-send-email-viliam.mateicka@gmail.com \
    --to=viliam.mateicka@gmail.com \
    --cc=davem@davemloft.net \
    --cc=decot@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=rabin@rab.in \
    --cc=steve.glendinning@smsc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®