netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Cc: Oliver Neukum <oneukum-l3A5Bk7waGM@public.gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ming Lei <tom.leiming-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 4/7] usbnet: remove EVENT_DEV_OPEN flag
Date: Tue, 12 Jun 2012 09:19:42 +0800	[thread overview]
Message-ID: <1339463985-9006-5-git-send-email-tom.leiming@gmail.com> (raw)
In-Reply-To: <1339463985-9006-1-git-send-email-tom.leiming-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

EVENT_DEV_OPEN is introduced to mark if the interface is opened or
not, but we already have IFF_UP to handle it, so just
remove the flag and use IFF_UP.

Also the patch may fix one bug in failure path of usbnet_open:
it may return failure but EVENT_DEV_OPEN is not cleared. After
this convering, dev->net->flags & IFF_UP always return consistent
status of the interface.

Signed-off-by: Ming Lei <tom.leiming-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/net/usb/usbnet.c   |    6 ++----
 include/linux/usb/usbnet.h |    1 -
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 022c1e7..96f8a08 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -686,7 +686,6 @@ int usbnet_stop (struct net_device *net)
 	struct driver_info	*info = dev->driver_info;
 	int			retval;
 
-	clear_bit(EVENT_DEV_OPEN, &dev->flags);
 	netif_stop_queue (net);
 
 	netif_info(dev, ifdown, dev->net,
@@ -778,7 +777,6 @@ int usbnet_open (struct net_device *net)
 		}
 	}
 
-	set_bit(EVENT_DEV_OPEN, &dev->flags);
 	netif_start_queue (net);
 	netif_info(dev, ifup, dev->net,
 		   "open: enable queueing (rx %d, tx %d) mtu %d %s framing\n",
@@ -1542,7 +1540,7 @@ int usbnet_resume (struct usb_interface *intf)
 
 	if (!--dev->suspend_count) {
 		/* resume interrupt URBs */
-		if (dev->interrupt && test_bit(EVENT_DEV_OPEN, &dev->flags))
+		if (dev->interrupt && (dev->net->flags & IFF_UP))
 			usb_submit_urb(dev->interrupt, GFP_NOIO);
 
 		spin_lock_irq(&dev->txq.lock);
@@ -1564,7 +1562,7 @@ int usbnet_resume (struct usb_interface *intf)
 		clear_bit(EVENT_DEV_ASLEEP, &dev->flags);
 		spin_unlock_irq(&dev->txq.lock);
 
-		if (test_bit(EVENT_DEV_OPEN, &dev->flags)) {
+		if (dev->net->flags & IFF_UP) {
 			if (!(dev->txq.qlen >= TX_QLEN(dev)))
 				netif_tx_wake_all_queues(dev->net);
 			tasklet_schedule (&dev->bh);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 76f4396..f15a729 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -68,7 +68,6 @@ struct usbnet {
 #		define EVENT_RX_PAUSED	5
 #		define EVENT_DEV_WAKING 6
 #		define EVENT_DEV_ASLEEP 7
-#		define EVENT_DEV_OPEN	8
 };
 
 static inline struct usb_driver *driver_of(struct usb_interface *intf)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-06-12  1:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12  1:19 [PATCH 0/7] usbnet: misc cleanup Ming Lei
2012-06-12  1:19 ` [PATCH 1/7] usbnet: remove usb_get/put_dev in .probe and .disconnect Ming Lei
2012-06-12  1:19 ` [PATCH 3/7] usbnet:cdc-phonet: " Ming Lei
     [not found] ` <1339463985-9006-1-git-send-email-tom.leiming-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-06-12  1:19   ` [PATCH 2/7] usbnet:pegasus: " Ming Lei
2012-06-12  1:19   ` Ming Lei [this message]
     [not found]     ` <1339463985-9006-5-git-send-email-tom.leiming-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-06-12 18:14       ` [PATCH 4/7] usbnet: remove EVENT_DEV_OPEN flag Oliver Neukum
2012-06-13  2:12         ` Ming Lei
2012-06-13  4:47           ` Ming Lei
2012-06-13  7:40             ` Oliver Neukum
     [not found]               ` <201206130940.54817.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2012-06-13  8:28                 ` Bjørn Mork
     [not found]                   ` <87r4tjlio1.fsf-lbf33ChDnrE/G1V5fR+Y7Q@public.gmane.org>
2012-06-13  9:21                     ` Ming Lei
2012-06-12  1:19   ` [PATCH 6/7] usbnet: remove declaration for intr_complete Ming Lei
2012-06-12  1:19   ` [PATCH 7/7] usbnet: don't initialize transfer buffer before submit status URB Ming Lei
2012-06-13  1:51   ` [PATCH 0/7] usbnet: misc cleanup David Miller
2012-06-12  1:19 ` [PATCH 5/7] usbnet: remove flag of EVENT_DEV_WAKING Ming Lei

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=1339463985-9006-5-git-send-email-tom.leiming@gmail.com \
    --to=tom.leiming-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=oneukum-l3A5Bk7waGM@public.gmane.org \
    /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).