Skip to contentSkip to conversation

USB Kconfig: Reorganize USB Kconfig Menu

PATCH In review Al Boldi 4 participants 8 messages Dec 23, 2007 – Dec 30, 2007

Subsystems (5)
Arm (32-bit) USB USB serial ATM +1 more subsystems
lore
Share & tools
lore

Al Boldi

author
#0 lore raw

PATCH 1/1 USB Kconfig: Reorganize USB Kconfig Menu

Reogranize USB Kconfig Menu, and move USB_GADGET out into the Device Driver Menu. This helps the USB Kconfig Menu to be more logical/usable.

Cc David Brownell <[email protected]>
Cc Greg KH <[email protected]>
Cc Andrew Morton <[email protected]>

---

drivers/Kconfig +2 -0
@@ -70,6 +70,8 @@ source "drivers/hid/Kconfig"
 
 source "drivers/usb/Kconfig"
 
+source "drivers/usb/gadget/Kconfig"
+
 source "drivers/mmc/Kconfig"
 
 source "drivers/leds/Kconfig"
drivers/usb/Kconfig +12 -14
@@ -2,8 +2,8 @@
 # USB device configuration
 #
 
-menuconfig USB_SUPPORT
-	bool "USB support"
+config USB_SUPPORT
+	bool
 	depends on HAS_IOMEM
 	default y
 	---help---
@@ -52,8 +52,8 @@ config USB_ARCH_HAS_EHCI
 	default PCI
 
 # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
-config USB
-	tristate "Support for Host-side USB"
+menuconfig USB
+	tristate "Host-side USB"
 	depends on USB_ARCH_HAS_HCD
 	---help---
 	  Universal Serial Bus (USB) is a specification for a serial bus
@@ -87,21 +87,16 @@ config USB
 	  To compile this driver as a module, choose M here: the
 	  module will be called usbcore.
 
+if USB
+
 source "drivers/usb/core/Kconfig"
 
 source "drivers/usb/host/Kconfig"
 
-source "drivers/usb/class/Kconfig"
-
 source "drivers/usb/storage/Kconfig"
 
-source "drivers/usb/image/Kconfig"
-
 source "drivers/usb/mon/Kconfig"
 
-comment "USB port drivers"
-	depends on USB
-
 config USB_USS720
 	tristate "USS720 parport driver"
 	depends on USB && PARPORT
@@ -133,10 +128,13 @@ config USB_USS720
 
 source "drivers/usb/serial/Kconfig"
 
-source "drivers/usb/misc/Kconfig"
-
 source "drivers/usb/atm/Kconfig"
 
-source "drivers/usb/gadget/Kconfig"
+source "drivers/usb/class/Kconfig"
+
+source "drivers/usb/image/Kconfig"
+
+source "drivers/usb/misc/Kconfig"
 
+endif # USB
 endif # USB_SUPPORT
drivers/usb/serial/Kconfig +4 -6
@@ -2,10 +2,7 @@
 # USB Serial device configuration
 #
 
-menu "USB Serial Converter support"
-	depends on USB!=n
-
-config USB_SERIAL
+menuconfig USB_SERIAL
 	tristate "USB Serial Converter support"
 	depends on USB
 	---help---
@@ -20,6 +17,8 @@ config USB_SERIAL
 	  To compile this driver as a module, choose M here: the
 	  module will be called usbserial.
 
+if USB_SERIAL
+
 config USB_SERIAL_CONSOLE
 	bool "USB Serial Console device support (EXPERIMENTAL)"
 	depends on USB_SERIAL=y && EXPERIMENTAL
@@ -581,5 +580,4 @@ config USB_EZUSB
 	default y
 
 
-endmenu
-
+endif # USB_SERIAL
drivers/usb/core/Kconfig +7 -0
@@ -1,6 +1,12 @@
 #
 # USB Core configuration
 #
+menuconfig USB_CORE_MENU
+	bool "USB Core Config"
+	depends on USB
+
+if USB_CORE_MENU
+
 config USB_DEBUG
 	bool "USB verbose debug messages"
 	depends on USB
@@ -142,3 +148,4 @@ config USB_OTG_BLACKLIST_HUB
 	  external hubs.  OTG hosts are allowed to reduce hardware
 	  and software costs by not supporting external hubs.
 
+endif # USB_CORE_MENU
drivers/usb/host/Kconfig +2 -1
@@ -1,7 +1,7 @@
 #
 # USB Host Controller Drivers
 #
-comment "USB Host Controller Drivers"
+menu "USB Host Controller Drivers"
 	depends on USB
 
 config USB_EHCI_HCD
@@ -248,3 +248,4 @@ config USB_R8A66597_HCD
 	  To compile this driver as a module, choose M here: the
 	  module will be called r8a66597-hcd.
 
+endmenu
drivers/usb/class/Kconfig +5 -1
@@ -1,9 +1,12 @@
 #
 # USB Class driver configuration
 #
-comment "USB Device Class drivers"
+menuconfig USB_DEVICE_CLASS_MENU
+	bool "USB Device Class drivers"
 	depends on USB
 
+if USB_DEVICE_CLASS_MENU
+
 config USB_ACM
 	tristate "USB Modem (CDC ACM) support"
 	depends on USB
@@ -29,3 +32,4 @@ config USB_PRINTER
 	  To compile this driver as a module, choose M here: the
 	  module will be called usblp.
 
+endif # USB_DEVICE_CLASS_MENU
drivers/usb/gadget/Kconfig +5 -5
@@ -12,10 +12,8 @@
 # With help from a special transceiver and a "Mini-AB" jack, systems with
 # both kinds of controller can also support "USB On-the-Go" (CONFIG_USB_OTG).
 #
-menu "USB Gadget Support"
-
-config USB_GADGET
-	tristate "Support for USB Gadgets"
+menuconfig USB_GADGET
+	tristate "Peripheral-side USB"
 	help
 	   USB is a master/slave protocol, organized with one master
 	   host (such as a PC) controlling up to 127 peripheral devices.
@@ -42,6 +40,8 @@ config USB_GADGET
 	   For more information, see <http://www.linux-usb.org/gadget> and
 	   the kernel DocBook documentation for this API.
 
+if USB_GADGET
+
 config USB_GADGET_DEBUG
 	boolean "Debugging messages"
 	depends on USB_GADGET && DEBUG_KERNEL && EXPERIMENTAL
@@ -522,4 +522,4 @@ config USB_MIDI_GADGET
 
 endchoice
 
-endmenu
+endif # USB_GADGET
drivers/usb/storage/Kconfig +4 -3
@@ -2,11 +2,12 @@
 # USB Storage driver configuration
 #
 
-comment "NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'"
-comment "may also be needed; see USB_STORAGE Help for more information"
+comment "NOTE: USB_STORAGE needs SCSI, and 'SCSI disk support' may"
+	depends on USB
+comment "also be needed; see USB_STORAGE Help for more information"
 	depends on USB
 
-config USB_STORAGE
+menuconfig USB_STORAGE
 	tristate "USB Mass Storage support"
 	depends on USB && SCSI
 	---help---
drivers/usb/atm/Kconfig +4 -5
@@ -2,10 +2,7 @@
 # USB/ATM DSL configuration
 #
 
-menu "USB DSL modem support"
-	depends on USB
-
-config USB_ATM
+menuconfig USB_ATM
 	tristate "USB DSL modem support"
 	depends on USB && ATM
 	select CRC32
@@ -18,6 +15,8 @@ config USB_ATM
 	  To compile this driver as a module, choose M here: the
 	  module will be called usbatm.
 
+if USB_ATM
+
 config USB_SPEEDTOUCH
 	tristate "Speedtouch USB support"
 	depends on USB_ATM
@@ -70,4 +69,4 @@ config USB_XUSBATM
 	  To compile this driver as a module, choose M here: the
 	  module will be called xusbatm.
 
-endmenu
+endif # USB_ATM
drivers/usb/image/Kconfig +6 -1
@@ -1,9 +1,12 @@
 #
 # USB Imageing devices configuration
 #
-comment "USB Imaging devices"
+menuconfig USB_IMG_MENU
+	bool "USB Imaging devices"
 	depends on USB
 
+if USB_IMG_MENU
+
 config USB_MDC800
 	tristate "USB Mustek MDC800 Digital Camera support (EXPERIMENTAL)"
 	depends on USB && EXPERIMENTAL
@@ -28,3 +31,5 @@ config USB_MICROTEK
 	  The scanner will appear as a scsi generic device to the rest
 	  of the system. Scsi support is required.
 	  This driver can be compiled as a module, called microtek.
+
+endif # USB_IMG_MENU
drivers/usb/misc/Kconfig +5 -1
@@ -1,9 +1,12 @@
 #
 # USB Miscellaneous driver configuration
 #
-comment "USB Miscellaneous drivers"
+menuconfig USB_MISC_MENU
+	bool "USB Miscellaneous drivers"
 	depends on USB
 
+if USB_MISC_MENU
+
 config USB_EMI62
 	tristate "EMI 6|2m USB Audio interface support"
 	depends on USB
@@ -269,3 +272,4 @@ config USB_TEST
 	  See <http://www.linux-usb.org/usbtest/> for more information,
 	  including sample test device firmware and "how to use it".
 
+endif # USB_MISC_MENU
#1 lore raw

drivers/usb/Kconfig line 9

Quoted 13 lines · Al Boldi
drivers/usb/Kconfig +2 -2
@@ -2,8 +2,8 @@
 # USB device configuration
 #
 
-menuconfig USB_SUPPORT
-	bool "USB support"
+config USB_SUPPORT
+	bool
 	depends on HAS_IOMEM
 	default y
 	---help---

With this patch, is USB_SUPPORT still needed? It is not visible (anymore), always is y and no other options select/depend on it (according to Kconfig '/' function).

Looks good.

author
#2 lore raw
Quoted 7 lines · Jan Engelhardt
Quoted 6 lines · Al Boldi
drivers/usb/Kconfig +0 -0
@@ -2,8 +2,8 @@
 # USB device configuration
 #
 
Quoted 11 lines

drivers/usb/Kconfig line 9

Quoted 7 lines
drivers/usb/Kconfig +2 -2
-menuconfig USB_SUPPORT
-	bool "USB support"
+config USB_SUPPORT
+	bool
 	depends on HAS_IOMEM
 	default y
 	---help---

With this patch, is USB_SUPPORT still needed? It is not visible (anymore), always is y and no other options select/depend on it (according to Kconfig '/' function).

Well, I left it in, because of defconfig dependencies, and HAS_IOMEM is needed for a few archs.

Quoted 1 line

Looks good.

Thanks!

--
Al

#3 lore raw
Quoted 12 lines · Al Boldi
Quoted 11 lines
Quoted 7 lines
drivers/usb/Kconfig +2 -2
-menuconfig USB_SUPPORT
-	bool "USB support"
+config USB_SUPPORT
+	bool
	depends on HAS_IOMEM
	default y
	---help---

With this patch, is USB_SUPPORT still needed? It is not visible (anymore), always is y and no other options select/depend on it (according to Kconfig '/' function).

Quoted 3 lines

Well, I left it in, because of defconfig dependencies, and HAS_IOMEM is needed for a few archs.

But I do not see any config option that depends on USB_SUPPORT.

#4 lore raw
Quoted 13 lines · Jan Engelhardt
Quoted 12 lines · Al Boldi
Quoted 11 lines
Quoted 7 lines
drivers/usb/Kconfig +2 -2
-menuconfig USB_SUPPORT
-	bool "USB support"
+config USB_SUPPORT
+	bool
	depends on HAS_IOMEM
	default y
	---help---

With this patch, is USB_SUPPORT still needed? It is not visible (anymore), always is y and no other options select/depend on it (according to Kconfig '/' function).

Quoted 5 lines
Quoted 3 lines

Well, I left it in, because of defconfig dependencies, and HAS_IOMEM is needed for a few archs.

But I do not see any config option that depends on USB_SUPPORT.

Nevermind, I just grepped for 'depends on.*USB_SUPPORT' rather than 'if USB_SUPPORT'.

#5 lore raw
In reply to Al Boldi
Quoted 8 lines · Al Boldi

Reogranize USB Kconfig Menu, and move USB_GADGET out into the Device Driver Menu. This helps the USB Kconfig Menu to be more logical/usable.

Cc David Brownell <[email protected]>
Cc Greg KH <[email protected]>
Cc Andrew Morton <[email protected]>

Along those lines, sure ... but this particular patch can't quite be the answer. For one thing, it rather critially needs the appended, else it won't work on ARM. (And quite a lot of the ARM platforms need the gadget stack!!)

There are ISTR a few other platforms which, for reasons unknown to me, don't source drivers/Kconfig but recreate portions of it on their own ... that's not something that this patch should change.

Also, looking at this in xconfig shows some oddness. That "core" submenu holds stuff that would logically be part of the toplevel menu for host side USB. While that toplevel menu has the USS720 driver, which seems more like a "miscellany" thing...

The comment about SCSI shouldn't show when SCSI is defined; and the comment aboue "SCSI disk support" belongs with the mass storage menu, not at the top level. The way that the mass storage menu is presented also hides the fact that you can get fully functional mass storage support without checking *any* of the drivers there, since the core already handles standard devices.

That "ARCH_HAS_HCD" mess has IMO outlived its utility, and should vanish.

- Dave

arch/arm/Kconfig +2 -0
@@ -1068,6 +1068,8 @@ source "drivers/hid/Kconfig"
 
 source "drivers/usb/Kconfig"
 
+source "drivers/usb/gadget/Kconfig"
+
 source "drivers/mmc/Kconfig"
 
 source "drivers/leds/Kconfig"
#6 lore raw
Quoted 10 lines · David Brownell
Quoted 8 lines · Al Boldi

Reogranize USB Kconfig Menu, and move USB_GADGET out into the Device Driver Menu. This helps the USB Kconfig Menu to be more logical/usable.

Cc David Brownell <[email protected]>
Cc Greg KH <[email protected]>
Cc Andrew Morton <[email protected]>
Quoted 8 lines

Along those lines, sure ... but this particular patch can't quite be the answer. For one thing, it rather critially needs the appended, else it won't work on ARM. (And quite a lot of the ARM platforms need the gadget stack!!)

There are ISTR a few other platforms which, for reasons unknown to me, don't source drivers/Kconfig but recreate portions of it on their own ... that's not something that this patch should change.

$ find . -name Kconfig\* | xargs grep drivers/usb/Kconfig
./arch/arm/Kconfig:source "drivers/usb/Kconfig"
./arch/cris/Kconfig:source "drivers/usb/Kconfig"
./arch/h8300/Kconfig:source "drivers/usb/Kconfig"
./arch/v850/Kconfig:source "drivers/usb/Kconfig"
./drivers/Kconfig:source "drivers/usb/Kconfig"
$ 
Quoted 5 lines

Also, looking at this in xconfig shows some oddness. That "core" submenu holds stuff that would logically be part of the toplevel menu for host side USB. While that toplevel menu has the USS720 driver, which seems more like a "miscellany" thing...

Quoted 7 lines

The comment about SCSI shouldn't show when SCSI is defined; and the comment aboue "SCSI disk support" belongs with the mass storage menu, not at the top level. The way that the mass storage menu is presented also hides the fact that you can get fully functional mass storage support without checking *any* of the drivers there, since the core already handles standard devices.
...

The SCSI dependency should be handled through select - there's no reason for bothering the kconfig user wih such implementation details.

Quoted 2 lines

- Dave
...

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
author
#7 lore raw
Quoted 5 lines · Adrian Bunk
Quoted 4 lines · David Brownell

Also, looking at this in xconfig shows some oddness. That "core" submenu holds stuff that would logically be part of the toplevel menu for host side USB. While that toplevel menu has the USS720 driver, which seems more like a "miscellany" thing...

This one probably belongs in its own sub-menu, but as it is only one option, it's not considered worthwhile, so we leave it as is.

Quoted 10 lines
Quoted 7 lines

The comment about SCSI shouldn't show when SCSI is defined; and the comment aboue "SCSI disk support" belongs with the mass storage menu, not at the top level. The way that the mass storage menu is presented also hides the fact that you can get fully functional mass storage support without checking *any* of the drivers there, since the core already handles standard devices.
...

The SCSI dependency should be handled through select - there's no reason for bothering the kconfig user wih such implementation details.

Agreed, and while we are at it, also select ATM for DSL, like this:

drivers/usb/atm/Kconfig +2 -1
@@ -4,7 +4,8 @@
 
 menuconfig USB_ATM
 	tristate "USB DSL modem support"
-	depends on USB && ATM
+	depends on USB && NET
+	select ATM
 	select CRC32
 	default n
 	help
drivers/usb/storage/Kconfig +10 -8
@@ -2,14 +2,10 @@
 # USB Storage driver configuration
 #
 
-comment "NOTE: USB_STORAGE needs SCSI, and 'SCSI disk support' may"
-	depends on USB
-comment "also be needed; see USB_STORAGE Help for more information"
-	depends on USB
-
 menuconfig USB_STORAGE
 	tristate "USB Mass Storage support"
-	depends on USB && SCSI
+	depends on USB
+	select SCSI
 	---help---
 	  Say Y here if you want to connect USB mass storage devices to your
 	  computer's USB port. This is the driver you need for USB
@@ -18,13 +14,17 @@ menuconfig USB_STORAGE
 	  similar devices. This driver may also be used for some cameras
 	  and card readers.
 
-	  This option depends on 'SCSI' support being enabled, but you
-	  probably also need 'SCSI device support: SCSI disk support'
+	  This option selects 'SCSI' support , but you probably
+	  also need 'SCSI device support: SCSI disk support'
 	  (BLK_DEV_SD) for most USB storage devices.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called usb-storage.
 
+if USB_STORAGE
+comment "NOTE: USB_STORAGE selects SCSI, but 'SCSI disk support' may"
+comment "also be needed; see USB_STORAGE Help for more information"
+
 config USB_STORAGE_DEBUG
 	bool "USB Mass Storage verbose debug"
 	depends on USB_STORAGE
@@ -147,6 +147,8 @@ config USB_STORAGE_KARMA
 	  on the resulting scsi device node returns the Karma to normal
 	  operation.
 
+endif # USB_STORAGE
+
 config USB_LIBUSUAL
 	bool "The shared table of common (or usual) storage devices"
 	depends on USB

Thanks!

--
Al