From patchwork Sat May 2 02:26:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David VomLehn X-Patchwork-Id: 26799 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 178CCB707E for ; Sat, 2 May 2009 12:27:41 +1000 (EST) Received: by ozlabs.org (Postfix) id 06A7ADDF6B; Sat, 2 May 2009 12:27:41 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 9A798DDF5F for ; Sat, 2 May 2009 12:27:40 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752606AbZEBC05 (ORCPT ); Fri, 1 May 2009 22:26:57 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751937AbZEBC0z (ORCPT ); Fri, 1 May 2009 22:26:55 -0400 Received: from sj-iport-6.cisco.com ([171.71.176.117]:58017 "EHLO sj-iport-6.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751139AbZEBC0x (ORCPT ); Fri, 1 May 2009 22:26:53 -0400 X-IronPort-AV: E=Sophos;i="4.40,281,1238976000"; d="scan'208";a="296897794" Received: from sj-dkim-1.cisco.com ([171.71.179.21]) by sj-iport-6.cisco.com with ESMTP; 02 May 2009 02:26:54 +0000 Received: from sj-core-5.cisco.com (sj-core-5.cisco.com [171.71.177.238]) by sj-dkim-1.cisco.com (8.12.11/8.12.11) with ESMTP id n422Qrhv030018; Fri, 1 May 2009 19:26:53 -0700 Received: from cuplxvomd02.corp.sa.net ([64.101.20.155]) by sj-core-5.cisco.com (8.13.8/8.13.8) with ESMTP id n422Qrr4009293; Sat, 2 May 2009 02:26:53 GMT Date: Fri, 1 May 2009 19:26:53 -0700 From: David VomLehn To: linux-kernel@vger.kernel.org Cc: akpm@linux-foundation.org, linux-usb@vger.kernel.org, greg@kroah.com, linux-scsi@vger.kernel.org, netdev@vger.kernel.org, arjan@infradead.org Subject: [PATCH 2/5] initdev:kernel: USB init device discovery notification, v2 Message-ID: <20090502022653.GA15743@cuplxvomd02.corp.sa.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; l=2409; t=1241231214; x=1242095214; c=relaxed/simple; s=sjdkim1004; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=dvomlehn@cisco.com; z=From:=20David=20VomLehn=20 |Subject:=20[PATCH=202/5]=20initdev=3Akernel=3A=20USB=20ini t=20device=20discovery=0A=09notification,=20v2 |Sender:=20; bh=skIMzxPDUW2T9sjLkUsniX4hChNWy/JjtfoneUhljZw=; b=ILI3CA1bVPMkQxbG+PM5T5lOZbZTxIM5k2WoZM5nwrOuzXL5+ndg9kP5+s yzmrokJXd0GmEvgyKyuZc5iac1nns/pn85ZAlOBnnKzBqCr2nGiPrXrszJpt y0Ntd8UAIVYPA6y+S1I+W94vbNV7JBxBPgsK532Xcp345FsCvhm9Q=; Authentication-Results: sj-dkim-1; header.From=dvomlehn@cisco.com; dkim=pass ( sig from cisco.com/sjdkim1004 verified; ); Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Alan Stern Use init device discovery infrastructure to provide notification of availability of USB devices. History v2 Change names from bootdev_* to initdev_*. v1.1 Changed check for blockdevice in #if to use || instead of | v1 Initial versions Signed-off-by: Alan Stern Signed-off-by: David VomLehn --- drivers/usb/core/hub.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index be86ae3..2074ab9 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -37,6 +37,20 @@ #endif #endif +/* The mask of possible USB boot devices depends on what drivers and + * options have been configured into the kernel. There are too many + * USB network config options to list here, so just assume it is always + * possible to have a USB network device. + */ +static int usb_initdev_mask = 0 +#ifdef CONFIG_USB_SERIAL_CONSOLE + | BOOTDEV_CONSOLE_MASK +#endif +#if defined(CONFIG_USB_STORAGE) || defined(CONFIG_BLK_DEV_UB) + | BOOTDEV_BLOCK_MASK +#endif + | BOOTDEV_NETDEV_MASK; + struct usb_hub { struct device *intfdev; /* the "interface" device */ struct usb_device *hdev; @@ -73,6 +87,7 @@ struct usb_hub { unsigned limited_power:1; unsigned quiescing:1; unsigned disconnected:1; + unsigned probing:1; unsigned has_indicators:1; u8 indicator[USB_MAXCHILDREN]; @@ -1079,6 +1094,9 @@ static int hub_configure(struct usb_hub *hub, if (hub->has_indicators && blinkenlights) hub->indicator [0] = INDICATOR_CYCLE; + hub->probing = 1; + initdev_found(usb_initdev_mask); + hub_activate(hub, HUB_INIT); return 0; @@ -1124,6 +1142,9 @@ static void hub_disconnect(struct usb_interface *intf) usb_buffer_free(hub->hdev, sizeof(*hub->buffer), hub->buffer, hub->buffer_dma); + if (hub->probing) + initdev_probe_done(usb_initdev_mask); + kref_put(&hub->kref, hub_release); } @@ -3135,6 +3156,11 @@ static void hub_events(void) portstatus, portchange); } /* end for i */ + if (hub->probing) { + hub->probing = 0; + initdev_probe_done(usb_initdev_mask); + } + /* deal with hub status changes */ if (test_and_clear_bit(0, hub->event_bits) == 0) ; /* do nothing */