Skip to contentSkip to conversation

input: joystick: make USB drivers depend on USB

PATCH In review Marcus Folkesson 3 participants 5 messages Jan 17, 2018 – Jan 18, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 input: joystick: make USB drivers depend on USB

A driver should not enable an entire subsystem.

---
 drivers/input/joystick/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/joystick/Kconfig +1 -2
index 332c0cc1b2ab..4a199cff8c68 100644
@@ -279,8 +279,7 @@ config JOYSTICK_JOYDUMP
 
 config JOYSTICK_XPAD
 	tristate "X-Box gamepad support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the X-Box pad with your computer.
 	  Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
Signature · 1 line
2.15.1
maintainer
#1 lore raw
Quoted 1 line · Marcus Folkesson

A driver should not enable an entire subsystem.

I disagree. As you go through menuconfig and you encounter this option and you have the hardware and you want to enable it, you should be able to do so. Otherwise you enable bunch of functionality, then go back, see what new options appeared, enable them, go back, see if any more new options appeared, and so on.

What exactly prompted this change?

Quoted 23 lines
---
 drivers/input/joystick/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/joystick/Kconfig +1 -2
index 332c0cc1b2ab..4a199cff8c68 100644
@@ -279,8 +279,7 @@ config JOYSTICK_JOYDUMP
 
 config JOYSTICK_XPAD
 	tristate "X-Box gamepad support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the X-Box pad with your computer.
 	  Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
Signature · 1 line
2.15.1
Signature · 1 line
Dmitry
#2 lore raw
Quoted 10 lines · Dmitry Torokhov
Quoted 1 line · Marcus Folkesson

A driver should not enable an entire subsystem.

I disagree. As you go through menuconfig and you encounter this option and you have the hardware and you want to enable it, you should be able to do so. Otherwise you enable bunch of functionality, then go back, see what new options appeared, enable them, go back, see if any more new options appeared, and so on.

What exactly prompted this change?

Two things: today when I reviewed Marcus's patch that selected USB, I commented something along that line.

But that was based on something that Linus has written at least two times in the past on lkml.

Quoted 21 lines
Quoted 21 lines
---
 drivers/input/joystick/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/joystick/Kconfig +1 -2
index 332c0cc1b2ab..4a199cff8c68 100644
@@ -279,8 +279,7 @@ config JOYSTICK_JOYDUMP
 
 config JOYSTICK_XPAD
 	tristate "X-Box gamepad support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the X-Box pad with your computer.
 	  Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
Signature · 1 line
~Randy
#3 lore raw
In reply to Dmitry Torokhov
Quoted 8 lines · Dmitry Torokhov
Quoted 1 line · Marcus Folkesson

A driver should not enable an entire subsystem.

I disagree. As you go through menuconfig and you encounter this option and you have the hardware and you want to enable it, you should be able to do so. Otherwise you enable bunch of functionality, then go back, see what new options appeared, enable them, go back, see if any more new options appeared, and so on.

I've been thinking about this. If a user is using a distro .config file, it most likely has USB support already enabled, so the description above will not apply to them. If they are using some kernel-supplied defconfig file, I still think that the description above will not apply to them since those defconfig file will most likely have USB enabled if the target platform supports USB. And if they are using some .config file that does not have USB support enabled, it could be that way for a very good reason. If the target platform does not support USB but the user enables (sets) JOYSTICK_XPAD (which selects USB) but then their device does not work, they will be both disappointed and confused.

Anyway, I don't think that users will face the problem that you described very often. But I understand what you are saying also.

Quoted 26 lines

What exactly prompted this change?

Quoted 23 lines
---
 drivers/input/joystick/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/joystick/Kconfig +1 -2
index 332c0cc1b2ab..4a199cff8c68 100644
@@ -279,8 +279,7 @@ config JOYSTICK_JOYDUMP
 
 config JOYSTICK_XPAD
 	tristate "X-Box gamepad support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the X-Box pad with your computer.
 	  Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
Signature · 1 line
2.15.1
Signature · 1 line
~Randy
maintainer
#4 lore raw
Quoted 10 lines · Randy Dunlap
Quoted 8 lines · Dmitry Torokhov
Quoted 1 line · Marcus Folkesson

A driver should not enable an entire subsystem.

I disagree. As you go through menuconfig and you encounter this option and you have the hardware and you want to enable it, you should be able to do so. Otherwise you enable bunch of functionality, then go back, see what new options appeared, enable them, go back, see if any more new options appeared, and so on.

Quoted 10 lines

I've been thinking about this. If a user is using a distro .config file, it most likely has USB support already enabled, so the description above will not apply to them. If they are using some kernel-supplied defconfig file, I still think that the description above will not apply to them since those defconfig file will most likely have USB enabled if the target platform supports USB. And if they are using some .config file that does not have USB support enabled, it could be that way for a very good reason. If the target platform does not support USB but the user enables (sets) JOYSTICK_XPAD (which selects USB) but then their device does not work, they will be both disappointed and confused.

You mean their system has USB ports to plug in the XPAD but the target platform does not support USB? I doubt that happens, but it is supposed to be handled by "depends on USB_ARCH_HAS_HCD". If platform definitely does not have a host controller, then we'll hide drivers for USB devices.

Quoted 3 lines

Anyway, I don't think that users will face the problem that you described very often. But I understand what you are saying also.

Yeah, I do not think we have a good config language/tools that allows easily turn on/off features, it's all different tradeoffs. Given that we had this "select USB/depends on USB_ARCH_HAS_HCD" for close to 10 years now, I'd prefer leaving it alone.

Thanks.

Quoted 32 lines
Quoted 28 lines

What exactly prompted this change?

Quoted 23 lines
---
 drivers/input/joystick/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/input/joystick/Kconfig +1 -2
index 332c0cc1b2ab..4a199cff8c68 100644
@@ -279,8 +279,7 @@ config JOYSTICK_JOYDUMP
 
 config JOYSTICK_XPAD
 	tristate "X-Box gamepad support"
-	depends on USB_ARCH_HAS_HCD
-	select USB
+	depends on USB
 	help
 	  Say Y here if you want to use the X-Box pad with your computer.
 	  Make sure to say Y to "Joystick support" (CONFIG_INPUT_JOYDEV)
Signature · 1 line
2.15.1
Signature · 1 line
~Randy
Signature · 1 line
Dmitry