[PATCH RFC] regmap: Move selecting for REGMAP_MDIO and REGMAP_IRQ

Andrew Davis posted 1 patch 7 months, 1 week ago
drivers/base/regmap/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH RFC] regmap: Move selecting for REGMAP_MDIO and REGMAP_IRQ
Posted by Andrew Davis 7 months, 1 week ago
If either REGMAP_IRQ or REGMAP_MDIO are set then REGMAP is also set.
This then enables the selecting of IRQ_DOMAIN or MDIO_BUS from REGMAP
based on the above two symbols respectively. This makes it very easy
to end up with "circular dependencies".

Instead select the IRQ_DOMAIN or MDIO_BUS from the symbols that make
use of them. This is almost equivalent to before but makes it less
likely to end up with false circular dependency detections.

Signed-off-by: Andrew Davis <afd@ti.com>
---

Sending as RFC as I haven't tested all the possible permutations
on config options right now to make sure this causes no changes,
but wanted to suggest this as a possible solution to the circular
dependency described here[0].

[0] https://www.spinics.net/lists/kernel/msg5686254.html

 drivers/base/regmap/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig
index b1affac70d5dc..ffb2ef4882981 100644
--- a/drivers/base/regmap/Kconfig
+++ b/drivers/base/regmap/Kconfig
@@ -6,8 +6,6 @@
 config REGMAP
 	bool
 	default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SOUNDWIRE_MBQ || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM || REGMAP_MDIO || REGMAP_FSI)
-	select IRQ_DOMAIN if REGMAP_IRQ
-	select MDIO_BUS if REGMAP_MDIO
 	help
 	  Enable support for the Register Map (regmap) access API.
 
@@ -58,12 +56,14 @@ config REGMAP_W1
 
 config REGMAP_MDIO
 	tristate
+	select MDIO_BUS
 
 config REGMAP_MMIO
 	tristate
 
 config REGMAP_IRQ
 	bool
+	select IRQ_DOMAIN
 
 config REGMAP_RAM
 	tristate
-- 
2.39.2
Re: [PATCH RFC] regmap: Move selecting for REGMAP_MDIO and REGMAP_IRQ
Posted by Mark Brown 7 months ago
On Fri, 16 May 2025 09:17:22 -0500, Andrew Davis wrote:
> If either REGMAP_IRQ or REGMAP_MDIO are set then REGMAP is also set.
> This then enables the selecting of IRQ_DOMAIN or MDIO_BUS from REGMAP
> based on the above two symbols respectively. This makes it very easy
> to end up with "circular dependencies".
> 
> Instead select the IRQ_DOMAIN or MDIO_BUS from the symbols that make
> use of them. This is almost equivalent to before but makes it less
> likely to end up with false circular dependency detections.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next

Thanks!

[1/1] regmap: Move selecting for REGMAP_MDIO and REGMAP_IRQ
      commit: c5a219395b4e6312102a505bfe73aac8f8bada8c

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Re: [PATCH RFC] regmap: Move selecting for REGMAP_MDIO and REGMAP_IRQ
Posted by Mark Brown 7 months ago
On Fri, May 16, 2025 at 09:17:22AM -0500, Andrew Davis wrote:
> If either REGMAP_IRQ or REGMAP_MDIO are set then REGMAP is also set.
> This then enables the selecting of IRQ_DOMAIN or MDIO_BUS from REGMAP
> based on the above two symbols respectively. This makes it very easy
> to end up with "circular dependencies".
> 
> Instead select the IRQ_DOMAIN or MDIO_BUS from the symbols that make
> use of them. This is almost equivalent to before but makes it less
> likely to end up with false circular dependency detections.

None of these selects should actually do anything since the symbols are
themselves selected?
Re: [PATCH RFC] regmap: Move selecting for REGMAP_MDIO and REGMAP_IRQ
Posted by Andrew Davis 7 months ago
On 5/19/25 5:12 AM, Mark Brown wrote:
> On Fri, May 16, 2025 at 09:17:22AM -0500, Andrew Davis wrote:
>> If either REGMAP_IRQ or REGMAP_MDIO are set then REGMAP is also set.
>> This then enables the selecting of IRQ_DOMAIN or MDIO_BUS from REGMAP
>> based on the above two symbols respectively. This makes it very easy
>> to end up with "circular dependencies".
>>
>> Instead select the IRQ_DOMAIN or MDIO_BUS from the symbols that make
>> use of them. This is almost equivalent to before but makes it less
>> likely to end up with false circular dependency detections.
> 
> None of these selects should actually do anything since the symbols are
> themselves selected?

I was thinking the same, but turns out (and I had to check to prove it to
myself) that "select" actually follows up the dependency tree. So unlike
"depends on" which is weird(broken), "select" functions in a sane way.

Andrew
Re: [PATCH RFC] regmap: Move selecting for REGMAP_MDIO and REGMAP_IRQ
Posted by Krzysztof Kozlowski 7 months ago
On 16/05/2025 16:17, Andrew Davis wrote:
> If either REGMAP_IRQ or REGMAP_MDIO are set then REGMAP is also set.
> This then enables the selecting of IRQ_DOMAIN or MDIO_BUS from REGMAP
> based on the above two symbols respectively. This makes it very easy
> to end up with "circular dependencies".
> 
> Instead select the IRQ_DOMAIN or MDIO_BUS from the symbols that make
> use of them. This is almost equivalent to before but makes it less
> likely to end up with false circular dependency detections.
> 
> Signed-off-by: Andrew Davis <afd@ti.com>
> ---
> 
> Sending as RFC as I haven't tested all the possible permutations
> on config options right now to make sure this causes no changes,
> but wanted to suggest this as a possible solution to the circular
> dependency described here[0].


Reported-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Closes: https://lore.kernel.org/r/bfe991fa-f54c-4d58-b2e0-34c4e4eb48f4@linaro.org/
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Looks ok and seems to solve issues I saw.

This is a potential dependency for a mux patch I want to send to Greg
for upcoming merge window, so it would be great if this was marked as fixes
and got to current RC. Or optionally I could take it with mentioned
mux patch:
https://lore.kernel.org/all/20250515140555.325601-2-krzysztof.kozlowski@linaro.org/


Best regards,
Krzysztof