All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] USB: Provide USB boot device availability notification
@ 2009-04-30  0:09 David VomLehn
  2009-04-30 15:25 ` Sergei Shtylyov
  0 siblings, 1 reply; 6+ messages in thread
From: David VomLehn @ 2009-04-30  0:09 UTC (permalink / raw)
  To: linux-usb; +Cc: gregkh, linux-kernel

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

Use boot device discovery infrastructure to report 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..01a9b76 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_bootdev_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;
+	bootdev_found(usb_bootdev_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)
+		bootdev_probe_done(usb_bootdev_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;
+			bootdev_probe_done(usb_bootdev_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/5] USB: Provide USB boot device availability notification
  2009-04-30  0:09 [PATCH 2/5] USB: Provide USB boot device availability notification David VomLehn
@ 2009-04-30 15:25 ` Sergei Shtylyov
  2009-04-30 15:32   ` Alan Stern
  0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2009-04-30 15:25 UTC (permalink / raw)
  To: David VomLehn; +Cc: linux-usb, gregkh, linux-kernel

Hello.

David VomLehn wrote:

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

> Use boot device discovery infrastructure to report availability of USB
> devices.

> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
> Signed-off-by: David VomLehn <dvomlehn@cisco.com>

[...]

> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index be86ae3..01a9b76 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_bootdev_mask = 0
> +#ifdef CONFIG_USB_SERIAL_CONSOLE
> +				| BOOTDEV_CONSOLE_MASK
> +#endif
> +#if defined(CONFIG_USB_STORAGE) | defined(CONFIG_BLK_DEV_UB)

    It should be ||, not bitwise | here, no?

WBR, Sergei

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

* Re: [PATCH 2/5] USB: Provide USB boot device availability notification
  2009-04-30 15:25 ` Sergei Shtylyov
@ 2009-04-30 15:32   ` Alan Stern
  2009-04-30 15:50     ` Sergei Shtylyov
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Stern @ 2009-04-30 15:32 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: David VomLehn, linux-usb, gregkh, linux-kernel

On Thu, 30 Apr 2009, Sergei Shtylyov 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.
> > + */
> > +static int usb_bootdev_mask = 0
> > +#ifdef CONFIG_USB_SERIAL_CONSOLE
> > +				| BOOTDEV_CONSOLE_MASK
> > +#endif
> > +#if defined(CONFIG_USB_STORAGE) | defined(CONFIG_BLK_DEV_UB)
> 
>     It should be ||, not bitwise | here, no?

No, it should be bitwise |.  The value being constructed is a union of 
disjoint mask bits.

Alan Stern


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

* Re: [PATCH 2/5] USB: Provide USB boot device availability notification
  2009-04-30 15:32   ` Alan Stern
@ 2009-04-30 15:50     ` Sergei Shtylyov
  2009-04-30 19:24       ` Alan Stern
  0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2009-04-30 15:50 UTC (permalink / raw)
  To: Alan Stern; +Cc: David VomLehn, linux-usb, gregkh, linux-kernel

Alan Stern 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.
>>>+ */
>>>+static int usb_bootdev_mask = 0
>>>+#ifdef CONFIG_USB_SERIAL_CONSOLE
>>>+				| BOOTDEV_CONSOLE_MASK
>>>+#endif
>>>+#if defined(CONFIG_USB_STORAGE) | defined(CONFIG_BLK_DEV_UB)

>>    It should be ||, not bitwise | here, no?

> No, it should be bitwise |.  The value being constructed is a union of 
> disjoint mask bits.

    I meant the #if line only. Although it shouldn't matter really...

> Alan Stern

WBR, Sergei

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

* Re: [PATCH 2/5] USB: Provide USB boot device availability notification
  2009-04-30 15:50     ` Sergei Shtylyov
@ 2009-04-30 19:24       ` Alan Stern
  2009-04-30 19:49         ` David VomLehn
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Stern @ 2009-04-30 19:24 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: David VomLehn, linux-usb, gregkh, linux-kernel

On Thu, 30 Apr 2009, Sergei Shtylyov wrote:

> Alan Stern 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.
> >>>+ */
> >>>+static int usb_bootdev_mask = 0
> >>>+#ifdef CONFIG_USB_SERIAL_CONSOLE
> >>>+				| BOOTDEV_CONSOLE_MASK
> >>>+#endif
> >>>+#if defined(CONFIG_USB_STORAGE) | defined(CONFIG_BLK_DEV_UB)
> 
> >>    It should be ||, not bitwise | here, no?
> 
> > No, it should be bitwise |.  The value being constructed is a union of 
> > disjoint mask bits.
> 
>     I meant the #if line only. Although it shouldn't matter really...

Oh, sorry.  Yes, you're right about that (and you're right that it 
doesn't really matter...).

David, you can go ahead and change the patch, but don't bother to
submit a new version for such a small thing.  The next time this gets 
pushed it'll have the right operator.

Alan Stern


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

* Re: [PATCH 2/5] USB: Provide USB boot device availability notification
  2009-04-30 19:24       ` Alan Stern
@ 2009-04-30 19:49         ` David VomLehn
  0 siblings, 0 replies; 6+ messages in thread
From: David VomLehn @ 2009-04-30 19:49 UTC (permalink / raw)
  To: Alan Stern; +Cc: Sergei Shtylyov, linux-usb, gregkh, linux-kernel

On Thu, Apr 30, 2009 at 03:24:30PM -0400, Alan Stern wrote:
> On Thu, 30 Apr 2009, Sergei Shtylyov wrote:
> 
> > Alan Stern 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.
> > >>>+ */
> > >>>+static int usb_bootdev_mask = 0
> > >>>+#ifdef CONFIG_USB_SERIAL_CONSOLE
> > >>>+				| BOOTDEV_CONSOLE_MASK
> > >>>+#endif
> > >>>+#if defined(CONFIG_USB_STORAGE) | defined(CONFIG_BLK_DEV_UB)
> > 
> > >>    It should be ||, not bitwise | here, no?
> > 
> > > No, it should be bitwise |.  The value being constructed is a union of 
> > > disjoint mask bits.
> > 
> >     I meant the #if line only. Although it shouldn't matter really...
> 
> Oh, sorry.  Yes, you're right about that (and you're right that it 
> doesn't really matter...).
> 
> David, you can go ahead and change the patch, but don't bother to
> submit a new version for such a small thing.  The next time this gets 
> pushed it'll have the right operator.

Done. It will be in the next submission.

> Alan Stern

David VomLehn

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

end of thread, other threads:[~2009-04-30 19:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-30  0:09 [PATCH 2/5] USB: Provide USB boot device availability notification David VomLehn
2009-04-30 15:25 ` Sergei Shtylyov
2009-04-30 15:32   ` Alan Stern
2009-04-30 15:50     ` Sergei Shtylyov
2009-04-30 19:24       ` Alan Stern
2009-04-30 19:49         ` David VomLehn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.