Re: [RFC PATCH 1/5] USB: drop depends on USB and enclose everythinginto an if USB block

From: Alan Stern
Date: Tue Mar 26 2013 - 15:05:01 EST


On Tue, 26 Mar 2013, Florian Fainelli wrote:

> This patch removes the depends on USB from all config symbols in
> drivers/usb/host/Kconfig and replace that with an if USB / endif block
> as suggested by Alan Stern.

I'm afraid this patch is filled with errors.

For one thing, it doesn't appreciate the difference between host-side
USB and device-side USB. CONFIG_USB describes support for the
host-side part of the stack, whereas CONFIG_USB_GADGET describes
support for the device-side (or gadget-side) part. This means you must
not make things like drivers/usb/gadget/Kconfig dependent on
CONFIG_USB.

For another, the patch doesn't understand the difference between && and
||. As an example, putting chipidea/Kconfig inside "if USB" and then
doing this:

> --- a/drivers/usb/chipidea/Kconfig
> +++ b/drivers/usb/chipidea/Kconfig
> @@ -1,6 +1,6 @@
> config USB_CHIPIDEA
> tristate "ChipIdea Highspeed Dual Role Controller"
> - depends on USB || USB_GADGET
> + depends on USB_GADGET
> help
> Say Y here if your system has a dual role high speed USB
> controller based on ChipIdea silicon IP. Currently, only the

effectively changes the || to an &&. This is not what we want.

You need to be a lot more careful about the distinction between hosts
and gadgets. The situation becomes even more complicated when you
realize that some of the code applies to Dual-Role Devices, which can
be either hosts or gadgets (this includes OTG). In addition, there are
a few things (such as gadget/dummy_hcd.c) which require _both_
host-side and device-side support.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/