diff mbox series

[v17,7/7] usb: Specify dependencies on USB_XHCI_PLATFORM with 'depends on'

Message ID 20211116120642.v17.7.If248f05613bbb06a44eb0b0909be5d97218f417b@changeid (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Matthias Kaehlcke Nov. 16, 2021, 8:07 p.m. UTC
Some USB controller drivers that depend on the xhci-plat driver
specify this dependency using 'select' in Kconfig. This is not
recommended for symbols that have other dependencies as it may
lead to invalid configurations. Use 'depends on' to specify the
dependency instead of 'select'.

For dwc3 specify the dependency on USB_XHCI_PLATFORM in
USB_DWC3_HOST and USB_DWC3_DUAL_ROLE. Also adjust the
dependencies of USB_DWC3_CORE to make sure that at least one
of USB_DWC3_HOST, USB_DWC3_GADGET or USB_DWC3_DUAL_ROLE can be
selected.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
---

Changes in v17:
- removed explicit dependency on USB from USB_DWC3
- added 'Reviewed-by' tags from Roger and Doug

Changes in v16:
- none

Changes in v15:
- adjusted dependencies of USB_DWC3_CORE to make sure it can only
  be enabled when at least one of USB_DWC3_HOST, USB_DWC3_GADGET
  or USB_DWC3_DUAL_ROLE is selectable
- updated commit message

Changes in v14:
- none

Changes in v13:
- patch added to the series

 drivers/usb/cdns3/Kconfig | 2 +-
 drivers/usb/dwc3/Kconfig  | 5 +++--
 drivers/usb/host/Kconfig  | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

Comments

Alan Stern Nov. 17, 2021, 2:21 a.m. UTC | #1
On Tue, Nov 16, 2021 at 12:07:39PM -0800, Matthias Kaehlcke wrote:
> Some USB controller drivers that depend on the xhci-plat driver
> specify this dependency using 'select' in Kconfig. This is not
> recommended for symbols that have other dependencies as it may
> lead to invalid configurations. Use 'depends on' to specify the
> dependency instead of 'select'.
> 
> For dwc3 specify the dependency on USB_XHCI_PLATFORM in
> USB_DWC3_HOST and USB_DWC3_DUAL_ROLE. Also adjust the
> dependencies of USB_DWC3_CORE to make sure that at least one
> of USB_DWC3_HOST, USB_DWC3_GADGET or USB_DWC3_DUAL_ROLE can be
> selected.
> 
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> Reviewed-by: Roger Quadros <rogerq@kernel.org>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> ---
> 
> Changes in v17:
> - removed explicit dependency on USB from USB_DWC3
> - added 'Reviewed-by' tags from Roger and Doug
> 
> Changes in v16:
> - none
> 
> Changes in v15:
> - adjusted dependencies of USB_DWC3_CORE to make sure it can only
>   be enabled when at least one of USB_DWC3_HOST, USB_DWC3_GADGET
>   or USB_DWC3_DUAL_ROLE is selectable
> - updated commit message
> 
> Changes in v14:
> - none
> 
> Changes in v13:
> - patch added to the series

> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index d1d926f8f9c2..e5e612f143a1 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -80,7 +80,7 @@ config USB_XHCI_MTK
>  
>  config USB_XHCI_MVEBU
>  	tristate "xHCI support for Marvell Armada 375/38x/37xx"
> -	select USB_XHCI_PLATFORM
> +	depends on USB_XHCI_PLATFORM
>  	depends on HAS_IOMEM
>  	depends on ARCH_MVEBU || COMPILE_TEST
>  	help
> @@ -112,9 +112,9 @@ config USB_EHCI_BRCMSTB
>  config USB_BRCMSTB
>  	tristate "Broadcom STB USB support"
>  	depends on (ARCH_BRCMSTB && PHY_BRCM_USB) || COMPILE_TEST
> +	depends on !USB_XHCI_HCD || USB_XHCI_PLATFORM
>  	select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
>  	select USB_EHCI_BRCMSTB if USB_EHCI_HCD
> -	select USB_XHCI_PLATFORM if USB_XHCI_HCD
>  	help
>  	  Enables support for XHCI, EHCI and OHCI host controllers
>  	  found in Broadcom STB SoC's.

It should be pointed out that this now requires people with xHCI systems 
to actively turn on CONFIG_USB_XHCI_PLATFORM before they can enable 
CONFIG_USB_BRCMSTB.  Before, that was not necessary.  Some users might 
get confused and not realize what is needed.  Perhaps something should 
be added to the "help" text.

Alan Stern
Matthias Kaehlcke Nov. 18, 2021, 5:16 p.m. UTC | #2
On Tue, Nov 16, 2021 at 09:21:44PM -0500, Alan Stern wrote:
> On Tue, Nov 16, 2021 at 12:07:39PM -0800, Matthias Kaehlcke wrote:
> > Some USB controller drivers that depend on the xhci-plat driver
> > specify this dependency using 'select' in Kconfig. This is not
> > recommended for symbols that have other dependencies as it may
> > lead to invalid configurations. Use 'depends on' to specify the
> > dependency instead of 'select'.
> > 
> > For dwc3 specify the dependency on USB_XHCI_PLATFORM in
> > USB_DWC3_HOST and USB_DWC3_DUAL_ROLE. Also adjust the
> > dependencies of USB_DWC3_CORE to make sure that at least one
> > of USB_DWC3_HOST, USB_DWC3_GADGET or USB_DWC3_DUAL_ROLE can be
> > selected.
> > 
> > Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> > Reviewed-by: Roger Quadros <rogerq@kernel.org>
> > Reviewed-by: Douglas Anderson <dianders@chromium.org>
> > ---
> > 
> > Changes in v17:
> > - removed explicit dependency on USB from USB_DWC3
> > - added 'Reviewed-by' tags from Roger and Doug
> > 
> > Changes in v16:
> > - none
> > 
> > Changes in v15:
> > - adjusted dependencies of USB_DWC3_CORE to make sure it can only
> >   be enabled when at least one of USB_DWC3_HOST, USB_DWC3_GADGET
> >   or USB_DWC3_DUAL_ROLE is selectable
> > - updated commit message
> > 
> > Changes in v14:
> > - none
> > 
> > Changes in v13:
> > - patch added to the series
> 
> > diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> > index d1d926f8f9c2..e5e612f143a1 100644
> > --- a/drivers/usb/host/Kconfig
> > +++ b/drivers/usb/host/Kconfig
> > @@ -80,7 +80,7 @@ config USB_XHCI_MTK
> >  
> >  config USB_XHCI_MVEBU
> >  	tristate "xHCI support for Marvell Armada 375/38x/37xx"
> > -	select USB_XHCI_PLATFORM
> > +	depends on USB_XHCI_PLATFORM
> >  	depends on HAS_IOMEM
> >  	depends on ARCH_MVEBU || COMPILE_TEST
> >  	help
> > @@ -112,9 +112,9 @@ config USB_EHCI_BRCMSTB
> >  config USB_BRCMSTB
> >  	tristate "Broadcom STB USB support"
> >  	depends on (ARCH_BRCMSTB && PHY_BRCM_USB) || COMPILE_TEST
> > +	depends on !USB_XHCI_HCD || USB_XHCI_PLATFORM
> >  	select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
> >  	select USB_EHCI_BRCMSTB if USB_EHCI_HCD
> > -	select USB_XHCI_PLATFORM if USB_XHCI_HCD
> >  	help
> >  	  Enables support for XHCI, EHCI and OHCI host controllers
> >  	  found in Broadcom STB SoC's.
> 
> It should be pointed out that this now requires people with xHCI systems 
> to actively turn on CONFIG_USB_XHCI_PLATFORM before they can enable 
> CONFIG_USB_BRCMSTB.  Before, that was not necessary.  Some users might 
> get confused and not realize what is needed.  Perhaps something should 
> be added to the "help" text.

I agree that the change could cause confusion, I'm not sure though if
adding something to the "help" text is a good mitigation. Users won't see
the text unless they can select the option, which requires
CONFIG_USB_XHCI_PLATFORM to be enabled. Also the dependencies are specified
nearby (and displayed), so it seems similar to a code comment on something
that the code evidently does (e.g. "initialize foobar with 0").

On a different note: I'm considering to break the CONFIG_USB_XHCI_PLATFORM
related patches out of the onboard_usb_hub series, since the driver
doesn't any longer depend on xhci_plat. In that sense I'm also open
to abandon those patches, if they aren't considered an improvement on
their own.
Matthias Kaehlcke Dec. 16, 2021, 11:56 p.m. UTC | #3
On Tue, Nov 16, 2021 at 12:07:39PM -0800, Matthias Kaehlcke wrote:
> Some USB controller drivers that depend on the xhci-plat driver
> specify this dependency using 'select' in Kconfig. This is not
> recommended for symbols that have other dependencies as it may
> lead to invalid configurations. Use 'depends on' to specify the
> dependency instead of 'select'.
> 
> For dwc3 specify the dependency on USB_XHCI_PLATFORM in
> USB_DWC3_HOST and USB_DWC3_DUAL_ROLE. Also adjust the
> dependencies of USB_DWC3_CORE to make sure that at least one
> of USB_DWC3_HOST, USB_DWC3_GADGET or USB_DWC3_DUAL_ROLE can be
> selected.
> 
> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> Reviewed-by: Roger Quadros <rogerq@kernel.org>
> Reviewed-by: Douglas Anderson <dianders@chromium.org>

Note: This patch has been removed from the onboard_usb_hub series,
together with "ARM: configs: Explicitly enable USB_XHCI_PLATFORM
where needed" and "arm64: defconfig: Explicitly enable
USB_XHCI_PLATFORM". These patches aren't any longer needed for the
series. If maintainers think they are useful independently from
the series please pick them or let me know what needs to be
changed to get them landed.
Dmitry Osipenko Dec. 17, 2021, 12:47 a.m. UTC | #4
17.12.2021 02:56, Matthias Kaehlcke пишет:
> On Tue, Nov 16, 2021 at 12:07:39PM -0800, Matthias Kaehlcke wrote:
>> Some USB controller drivers that depend on the xhci-plat driver
>> specify this dependency using 'select' in Kconfig. This is not
>> recommended for symbols that have other dependencies as it may
>> lead to invalid configurations. Use 'depends on' to specify the
>> dependency instead of 'select'.
>>
>> For dwc3 specify the dependency on USB_XHCI_PLATFORM in
>> USB_DWC3_HOST and USB_DWC3_DUAL_ROLE. Also adjust the
>> dependencies of USB_DWC3_CORE to make sure that at least one
>> of USB_DWC3_HOST, USB_DWC3_GADGET or USB_DWC3_DUAL_ROLE can be
>> selected.
>>
>> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
>> Reviewed-by: Roger Quadros <rogerq@kernel.org>
>> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> 
> Note: This patch has been removed from the onboard_usb_hub series,
> together with "ARM: configs: Explicitly enable USB_XHCI_PLATFORM
> where needed" and "arm64: defconfig: Explicitly enable
> USB_XHCI_PLATFORM". These patches aren't any longer needed for the
> series. If maintainers think they are useful independently from
> the series please pick them or let me know what needs to be
> changed to get them landed.
> 

Hi,

I don't know what this all is about, perhaps I'm CC'ed semi-randomly
because touched that Kconfig once.

All I can say here is that the commit message tells us "This is not
recommended" and doesn't explain what's the actual problem is being
solved. If there is no real problem, why bother?
Matthias Kaehlcke Dec. 20, 2021, 6:44 p.m. UTC | #5
On Fri, Dec 17, 2021 at 03:47:24AM +0300, Dmitry Osipenko wrote:
> 17.12.2021 02:56, Matthias Kaehlcke пишет:
> > On Tue, Nov 16, 2021 at 12:07:39PM -0800, Matthias Kaehlcke wrote:
> >> Some USB controller drivers that depend on the xhci-plat driver
> >> specify this dependency using 'select' in Kconfig. This is not
> >> recommended for symbols that have other dependencies as it may
> >> lead to invalid configurations. Use 'depends on' to specify the
> >> dependency instead of 'select'.
> >>
> >> For dwc3 specify the dependency on USB_XHCI_PLATFORM in
> >> USB_DWC3_HOST and USB_DWC3_DUAL_ROLE. Also adjust the
> >> dependencies of USB_DWC3_CORE to make sure that at least one
> >> of USB_DWC3_HOST, USB_DWC3_GADGET or USB_DWC3_DUAL_ROLE can be
> >> selected.
> >>
> >> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
> >> Reviewed-by: Roger Quadros <rogerq@kernel.org>
> >> Reviewed-by: Douglas Anderson <dianders@chromium.org>
> > 
> > Note: This patch has been removed from the onboard_usb_hub series,
> > together with "ARM: configs: Explicitly enable USB_XHCI_PLATFORM
> > where needed" and "arm64: defconfig: Explicitly enable
> > USB_XHCI_PLATFORM". These patches aren't any longer needed for the
> > series. If maintainers think they are useful independently from
> > the series please pick them or let me know what needs to be
> > changed to get them landed.
> > 
> 
> Hi,
> 
> I don't know what this all is about, perhaps I'm CC'ed semi-randomly
> because touched that Kconfig once.

Yes, it seems tools select you based on their heuristics because you
made changes to that file.

> All I can say here is that the commit message tells us "This is not
> recommended" and doesn't explain what's the actual problem is being
> solved. If there is no real problem, why bother?

Earlier versions of the onboard_usb_hub series [1] which had a dependency
involving USB_XHCI_PLATFORM had an issue with invalid (rand)configs
that was related with the 'selects'.

The series doesn't depend on USB_XHCI_PLATFORM any longer, hence the
original issue doesn't exist anymore, however it might re-surface in
the future.

Personally I have no vested interest at this point in getting the
config changes landed, I just wanted to make clear what the status
is (split off from the series, no future versions unless someone
requests them), rather than abandoning them silently.

[1]: https://patchwork.kernel.org/project/linux-usb/list/?series=531343
Dmitry Osipenko Dec. 20, 2021, 7:59 p.m. UTC | #6
20.12.2021 21:44, Matthias Kaehlcke пишет:
> On Fri, Dec 17, 2021 at 03:47:24AM +0300, Dmitry Osipenko wrote:
>> 17.12.2021 02:56, Matthias Kaehlcke пишет:
>>> On Tue, Nov 16, 2021 at 12:07:39PM -0800, Matthias Kaehlcke wrote:
>>>> Some USB controller drivers that depend on the xhci-plat driver
>>>> specify this dependency using 'select' in Kconfig. This is not
>>>> recommended for symbols that have other dependencies as it may
>>>> lead to invalid configurations. Use 'depends on' to specify the
>>>> dependency instead of 'select'.
>>>>
>>>> For dwc3 specify the dependency on USB_XHCI_PLATFORM in
>>>> USB_DWC3_HOST and USB_DWC3_DUAL_ROLE. Also adjust the
>>>> dependencies of USB_DWC3_CORE to make sure that at least one
>>>> of USB_DWC3_HOST, USB_DWC3_GADGET or USB_DWC3_DUAL_ROLE can be
>>>> selected.
>>>>
>>>> Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
>>>> Reviewed-by: Roger Quadros <rogerq@kernel.org>
>>>> Reviewed-by: Douglas Anderson <dianders@chromium.org>
>>>
>>> Note: This patch has been removed from the onboard_usb_hub series,
>>> together with "ARM: configs: Explicitly enable USB_XHCI_PLATFORM
>>> where needed" and "arm64: defconfig: Explicitly enable
>>> USB_XHCI_PLATFORM". These patches aren't any longer needed for the
>>> series. If maintainers think they are useful independently from
>>> the series please pick them or let me know what needs to be
>>> changed to get them landed.
>>>
>>
>> Hi,
>>
>> I don't know what this all is about, perhaps I'm CC'ed semi-randomly
>> because touched that Kconfig once.
> 
> Yes, it seems tools select you based on their heuristics because you
> made changes to that file.
> 
>> All I can say here is that the commit message tells us "This is not
>> recommended" and doesn't explain what's the actual problem is being
>> solved. If there is no real problem, why bother?
> 
> Earlier versions of the onboard_usb_hub series [1] which had a dependency
> involving USB_XHCI_PLATFORM had an issue with invalid (rand)configs
> that was related with the 'selects'.
> 
> The series doesn't depend on USB_XHCI_PLATFORM any longer, hence the
> original issue doesn't exist anymore, however it might re-surface in
> the future.
> 
> Personally I have no vested interest at this point in getting the
> config changes landed, I just wanted to make clear what the status
> is (split off from the series, no future versions unless someone
> requests them), rather than abandoning them silently.
> 
> [1]: https://patchwork.kernel.org/project/linux-usb/list/?series=531343
> 

My point is that you should always explain in a commit message what
problem is being solved and how it's solved. There is no explanation of
the problem in the commit of this patch. If there is no real problem and
patch is a minor improvement, then it also should be explained explicitly.
diff mbox series

Patch

diff --git a/drivers/usb/cdns3/Kconfig b/drivers/usb/cdns3/Kconfig
index b98ca0a1352a..07e12f786d48 100644
--- a/drivers/usb/cdns3/Kconfig
+++ b/drivers/usb/cdns3/Kconfig
@@ -1,7 +1,7 @@ 
 config USB_CDNS_SUPPORT
 	tristate "Cadence USB Support"
 	depends on USB_SUPPORT && (USB || USB_GADGET) && HAS_DMA
-	select USB_XHCI_PLATFORM if USB_XHCI_HCD
+	depends on !USB_XHCI_HCD || USB_XHCI_PLATFORM
 	select USB_ROLE_SWITCH
 	help
 	  Say Y here if your system has a Cadence USBSS or USBSSP
diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index c483f28b695d..8f08b0724379 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -2,8 +2,7 @@ 
 
 config USB_DWC3
 	tristate "DesignWare USB3 DRD Core Support"
-	depends on (USB || USB_GADGET) && HAS_DMA
-	select USB_XHCI_PLATFORM if USB_XHCI_HCD
+	depends on (USB_XHCI_PLATFORM || USB_GADGET) && HAS_DMA
 	select USB_ROLE_SWITCH if USB_DWC3_DUAL_ROLE
 	help
 	  Say Y or M here if your system has a Dual Role SuperSpeed
@@ -30,6 +29,7 @@  choice
 config USB_DWC3_HOST
 	bool "Host only mode"
 	depends on USB=y || USB=USB_DWC3
+	depends on USB_XHCI_PLATFORM
 	help
 	  Select this when you want to use DWC3 in host mode only,
 	  thereby the gadget feature will be regressed.
@@ -44,6 +44,7 @@  config USB_DWC3_GADGET
 config USB_DWC3_DUAL_ROLE
 	bool "Dual Role mode"
 	depends on ((USB=y || USB=USB_DWC3) && (USB_GADGET=y || USB_GADGET=USB_DWC3))
+	depends on USB_XHCI_PLATFORM
 	depends on (EXTCON=y || EXTCON=USB_DWC3)
 	help
 	  This is the default mode of working of DWC3 controller where
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index d1d926f8f9c2..e5e612f143a1 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -80,7 +80,7 @@  config USB_XHCI_MTK
 
 config USB_XHCI_MVEBU
 	tristate "xHCI support for Marvell Armada 375/38x/37xx"
-	select USB_XHCI_PLATFORM
+	depends on USB_XHCI_PLATFORM
 	depends on HAS_IOMEM
 	depends on ARCH_MVEBU || COMPILE_TEST
 	help
@@ -112,9 +112,9 @@  config USB_EHCI_BRCMSTB
 config USB_BRCMSTB
 	tristate "Broadcom STB USB support"
 	depends on (ARCH_BRCMSTB && PHY_BRCM_USB) || COMPILE_TEST
+	depends on !USB_XHCI_HCD || USB_XHCI_PLATFORM
 	select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
 	select USB_EHCI_BRCMSTB if USB_EHCI_HCD
-	select USB_XHCI_PLATFORM if USB_XHCI_HCD
 	help
 	  Enables support for XHCI, EHCI and OHCI host controllers
 	  found in Broadcom STB SoC's.