netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/7 v3] initdev:kernel:USB init device discovery notification
@ 2009-08-04 22:15 David VomLehn
  2009-08-07 15:32 ` Alan Jenkins
  0 siblings, 1 reply; 6+ messages in thread
From: David VomLehn @ 2009-08-04 22:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, linux-usb, greg, linux-scsi, netdev, arjan

From: Alan Stern <stern@rowland.harvard.edu>

Use init device discovery infrastructure to provide notification of
availability of USB devices.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: David VomLehn <dvomlehn@cisco.com>
---
 drivers/usb/core/hub.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index be86ae3..08baee0 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
+				| INITDEV_CONSOLE_MASK
+#endif
+#if defined(CONFIG_USB_STORAGE) || defined(CONFIG_BLK_DEV_UB)
+				| INITDEV_BLOCK_MASK
+#endif
+				| INITDEV_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 */

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/7 v3] initdev:kernel:USB init device discovery notification
  2009-08-04 22:15 [PATCH 2/7 v3] initdev:kernel:USB init device discovery notification David VomLehn
@ 2009-08-07 15:32 ` Alan Jenkins
  2009-08-07 15:44   ` Alan Stern
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Jenkins @ 2009-08-07 15:32 UTC (permalink / raw)
  To: David VomLehn
  Cc: linux-kernel, akpm, linux-usb, greg, linux-scsi, netdev, arjan

On 8/4/09, David VomLehn <dvomlehn@cisco.com> wrote:
> From: Alan Stern <stern@rowland.harvard.edu>
>
> Use init device discovery infrastructure to provide notification of
> availability of USB devices.
>
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> Signed-off-by: David VomLehn <dvomlehn@cisco.com>
> ---
>  drivers/usb/core/hub.c |   26 ++++++++++++++++++++++++++
>  1 files changed, 26 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index be86ae3..08baee0 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.
> + */

That could be fixed though.  Make the "USB Network Adaptors" menu into
an option.  Then you just have e.g. "CONFIG_NETDEV_USB", plus the two
class devices outside the menu (CONFIG_USB_ACM and CONFIG_USB_WDM).

Alan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/7 v3] initdev:kernel:USB init device discovery notification
  2009-08-07 15:32 ` Alan Jenkins
@ 2009-08-07 15:44   ` Alan Stern
  2009-08-07 17:17     ` Alan Jenkins
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Stern @ 2009-08-07 15:44 UTC (permalink / raw)
  To: Alan Jenkins
  Cc: David VomLehn, linux-kernel, akpm, linux-usb, greg, linux-scsi,
	netdev, arjan

On Fri, 7 Aug 2009, Alan Jenkins wrote:

> > +/* 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.
> > + */
> 
> That could be fixed though.  Make the "USB Network Adaptors" menu into
> an option.  Then you just have e.g. "CONFIG_NETDEV_USB", plus the two
> class devices outside the menu (CONFIG_USB_ACM and CONFIG_USB_WDM).

That could be done.  It might even meet with the approval of the
networking maintainer, independent of this patch series.

But what if somebody adds yet another networking class driver outside
the menu?

Alan Stern


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/7 v3] initdev:kernel:USB init device discovery notification
  2009-08-07 15:44   ` Alan Stern
@ 2009-08-07 17:17     ` Alan Jenkins
       [not found]       ` <9b2b86520908071017h606e595fr4488d6ff61cb337c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Jenkins @ 2009-08-07 17:17 UTC (permalink / raw)
  To: Alan Stern
  Cc: David VomLehn, linux-kernel, akpm, linux-usb, greg, linux-scsi,
	netdev, arjan

On 8/7/09, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Fri, 7 Aug 2009, Alan Jenkins wrote:
>
>> > +/* 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.
>> > + */
>>
>> That could be fixed though.  Make the "USB Network Adaptors" menu into
>> an option.  Then you just have e.g. "CONFIG_NETDEV_USB", plus the two
>> class devices outside the menu (CONFIG_USB_ACM and CONFIG_USB_WDM).

Oops, scratch WDM.  It doesn't actually provide a network device
(otherwise it would depend on NET).

> That could be done.  It might even meet with the approval of the
> networking maintainer, independent of this patch series.
>
> But what if somebody adds yet another networking class driver outside
> the menu?

Hmm.

Ok, how about a single (hidden) USB_HAS_NETDEV.  NETDEV_USB and
USB_ACM select USB_HAS_NETDEV.

Textual juxtaposition or simple copy+paste inside class/Kconfig should
help it get picked up.  And I'd add a comment pointing the bewildered
to the definition of usb_initdev_mask.

I'll write a patch for your inspection this evening.

Alan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/7 v3] initdev:kernel:USB init device discovery notification
       [not found]       ` <9b2b86520908071017h606e595fr4488d6ff61cb337c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-08-07 17:42         ` David VomLehn
  2009-08-07 20:09           ` Alan Jenkins
  0 siblings, 1 reply; 6+ messages in thread
From: David VomLehn @ 2009-08-07 17:42 UTC (permalink / raw)
  To: Alan Jenkins
  Cc: Alan Stern, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, greg-U8xfFu+wG4EAvxtiuMwx3w,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	arjan-wEGCiKHe2LqWVfeAwA7xHQ

On Fri, Aug 07, 2009 at 06:17:51PM +0100, Alan Jenkins wrote:
> On 8/7/09, Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org> wrote:
> > On Fri, 7 Aug 2009, Alan Jenkins wrote:
> >
> >> > +/* 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.
> >> > + */
> >>
> >> That could be fixed though.  Make the "USB Network Adaptors" menu into
> >> an option.  Then you just have e.g. "CONFIG_NETDEV_USB", plus the two
> >> class devices outside the menu (CONFIG_USB_ACM and CONFIG_USB_WDM).
> 
> Oops, scratch WDM.  It doesn't actually provide a network device
> (otherwise it would depend on NET).
> 
> > That could be done.  It might even meet with the approval of the
> > networking maintainer, independent of this patch series.
> >
> > But what if somebody adds yet another networking class driver outside
> > the menu?
> 
> Hmm.
> 
> Ok, how about a single (hidden) USB_HAS_NETDEV.  NETDEV_USB and
> USB_ACM select USB_HAS_NETDEV.
> 
> Textual juxtaposition or simple copy+paste inside class/Kconfig should
> help it get picked up.  And I'd add a comment pointing the bewildered
> to the definition of usb_initdev_mask.
> 
> I'll write a patch for your inspection this evening.

I remember thinking about this and seem to recall that Alan Stern and I
tossed this idea around, but didn't act on it. Such a thing holds potential
for avoiding an unnecessary delay during boot. Whether it actually makes
things faster in a given configuration will depend on that configuration's
critical path, but I would welcome such a patch on the basis that it's
unlikely to hurt and could improve boot times in some circumstances.

> Alan
--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/7 v3] initdev:kernel:USB init device discovery notification
  2009-08-07 17:42         ` David VomLehn
@ 2009-08-07 20:09           ` Alan Jenkins
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Jenkins @ 2009-08-07 20:09 UTC (permalink / raw)
  To: David VomLehn
  Cc: Alan Stern, linux-kernel, akpm, linux-usb, greg, linux-scsi,
	netdev, arjan

David VomLehn wrote:
> On Fri, Aug 07, 2009 at 06:17:51PM +0100, Alan Jenkins wrote:
>   
>> On 8/7/09, Alan Stern <stern@rowland.harvard.edu> wrote:
>>     
>>> On Fri, 7 Aug 2009, Alan Jenkins wrote:
>>>
>>>       
>>>>> +/* 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.
>>>>> + */
>>>>>           
>>>> That could be fixed though.  Make the "USB Network Adaptors" menu into
>>>> an option.

> I remember thinking about this and seem to recall that Alan Stern and I
> tossed this idea around, but didn't act on it. Such a thing holds potential
> for avoiding an unnecessary delay during boot. Whether it actually makes
> things faster in a given configuration will depend on that configuration's
> critical path, but I would welcome such a patch on the basis that it's
> unlikely to hurt and could improve boot times in some circumstances.
>   

Bother, I see why this doesn't work now.  There are all the USB
*wireless* network drivers outside the menu.

Thanks anyway
Alan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-07 20:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-04 22:15 [PATCH 2/7 v3] initdev:kernel:USB init device discovery notification David VomLehn
2009-08-07 15:32 ` Alan Jenkins
2009-08-07 15:44   ` Alan Stern
2009-08-07 17:17     ` Alan Jenkins
     [not found]       ` <9b2b86520908071017h606e595fr4488d6ff61cb337c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-08-07 17:42         ` David VomLehn
2009-08-07 20:09           ` Alan Jenkins

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).