From: Hayes Wang <hayeswang@realtek.com>
To: <netdev@vger.kernel.org>
Cc: <nic_swsd@realtek.com>, <linux-kernel@vger.kernel.org>,
<linux-usb@vger.kernel.org>, Hayes Wang <hayeswang@realtek.com>
Subject: [PATCH net-next 3/3] r8152: check RTL8152_UNPLUG and netif_running before autoresume
Date: Fri, 31 Oct 2014 14:03:56 +0800 [thread overview]
Message-ID: <1394712342-15778-78-Taiwan-albertk@realtek.com> (raw)
In-Reply-To: <1394712342-15778-75-Taiwan-albertk@realtek.com>
If the device is unplugged or !netif_running(), the workqueue
doesn't neet to wake the device, and could return directly.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 670279a..e522abe 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2859,15 +2859,18 @@ static void rtl_work_func_t(struct work_struct *work)
{
struct r8152 *tp = container_of(work, struct r8152, schedule.work);
+ /* If the device is unplugged or !netif_running(), the workqueue
+ * doesn't neet to wake the device, and could return directly.
+ */
+ if (test_bit(RTL8152_UNPLUG, &tp->flags) || !netif_running(tp->netdev))
+ return;
+
if (usb_autopm_get_interface(tp->intf) < 0)
return;
if (!test_bit(WORK_ENABLE, &tp->flags))
goto out1;
- if (test_bit(RTL8152_UNPLUG, &tp->flags))
- goto out1;
-
if (!mutex_trylock(&tp->control)) {
schedule_delayed_work(&tp->schedule, 0);
goto out1;
--
1.9.3
next prev parent reply other threads:[~2014-10-31 6:04 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-31 6:03 [PATCH net-next 0/3] Code adjustment Hayes Wang
2014-10-31 6:03 ` [PATCH net-next 1/3] r8152: remove the duplicate init for the list of rx_done Hayes Wang
2014-10-31 6:03 ` [PATCH net-next 2/3] r8152: clear the flag of SCHEDULE_TASKLET in tasklet Hayes Wang
2014-10-31 6:03 ` Hayes Wang [this message]
2014-10-31 9:56 ` [PATCH net-next v2 0/3] Code adjustment Hayes Wang
2014-10-31 9:56 ` [PATCH net-next v2 1/3] r8152: remove the duplicate init for the list of rx_done Hayes Wang
2014-10-31 9:56 ` [PATCH net-next v2 2/3] r8152: clear the flag of SCHEDULE_TASKLET in tasklet Hayes Wang
2014-10-31 20:15 ` David Miller
2014-11-02 17:57 ` [PATCH net-next v2 2/3] r8152: clear the flagofSCHEDULE_TASKLET " Hayes Wang
2014-11-02 22:53 ` Francois Romieu
2014-11-03 12:35 ` [PATCH net-next v2 2/3] r8152: clear theflagofSCHEDULE_TASKLETin tasklet Hayes Wang
2014-11-07 10:05 ` Hayes Wang
2014-11-08 22:11 ` Francois Romieu
2014-11-10 5:23 ` [PATCH net-next v2 2/3] r8152: cleartheflagofSCHEDULE_TASKLETintasklet Hayes Wang
2014-10-31 9:56 ` [PATCH net-next v2 3/3] r8152: check RTL8152_UNPLUG and netif_running before autoresume Hayes Wang
2014-11-12 2:05 ` [PATCH net-next v3 0/3] Code adjustment Hayes Wang
2014-11-12 2:05 ` [PATCH net-next v3 1/3] r8152: remove the duplicate init for the list of rx_done Hayes Wang
2014-11-12 2:05 ` [PATCH net-next v3 2/3] r8152: clear the flag of SCHEDULE_TASKLET in tasklet Hayes Wang
2014-11-12 2:05 ` [PATCH net-next v3 3/3] r8152: check RTL8152_UNPLUG and netif_running before autoresume Hayes Wang
2014-11-12 19:49 ` [PATCH net-next v3 0/3] Code adjustment 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=1394712342-15778-78-Taiwan-albertk@realtek.com \
--to=hayeswang@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.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;
as well as URLs for NNTP newsgroup(s).