From patchwork Tue Jun 12 01:19:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 164300 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 5E876B6FC2 for ; Tue, 12 Jun 2012 11:20:45 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753112Ab2FLBUn (ORCPT ); Mon, 11 Jun 2012 21:20:43 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:51886 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752761Ab2FLBUm (ORCPT ); Mon, 11 Jun 2012 21:20:42 -0400 Received: by mail-pz0-f46.google.com with SMTP id y13so6140776dad.19 for ; Mon, 11 Jun 2012 18:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=wzUXNwRrI2taHg52KByjucb4VJKCajdYZH+N/JyMWVw=; b=Q7FMTjuTphx32arb4ybQa0fLQDJdoAoma3V7EbLJ3VbeCbUs5Df+ZtbZiDkjIUxHoX snv+MDHWnIVxwgn0Et60ZY8uX/Kp+6DXDGLOaqyMo2DgFqLKzGzNudWSDW29oVOVj0Eu PB3qo1z+Iut4R2kM2vnMGedLb8/xmJO01MeXHtx1It9k/q/hv/wEvxblq8OIPQXtu8K+ S2vS5dj8fTXu9imqTYDXAdTDdiGtEQwEIN8ZV0tlh2yFCoF61vQdmuHS+LGLcPwjNLtm 1JB4lwkhgL3Q80c1TUV0XQhgZ6UNJNuQ0zF1xpC2g/9pD0UAdrWn2IiG8eUYPUOc6/TS sRNQ== Received: by 10.68.194.6 with SMTP id hs6mr32830113pbc.133.1339464041863; Mon, 11 Jun 2012 18:20:41 -0700 (PDT) Received: from localhost ([183.37.205.112]) by mx.google.com with ESMTPS id rj4sm114299pbc.30.2012.06.11.18.20.37 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jun 2012 18:20:41 -0700 (PDT) From: Ming Lei To: "David S. Miller" , Greg Kroah-Hartman Cc: Oliver Neukum , netdev@vger.kernel.org, linux-usb@vger.kernel.org, Ming Lei Subject: [PATCH 4/7] usbnet: remove EVENT_DEV_OPEN flag Date: Tue, 12 Jun 2012 09:19:42 +0800 Message-Id: <1339463985-9006-5-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1339463985-9006-1-git-send-email-tom.leiming@gmail.com> References: <1339463985-9006-1-git-send-email-tom.leiming@gmail.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.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 --- 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)