Skip to contentSkip to conversation

regmap: Fix REGMAP selections

PATCH In review Geert Uytterhoeven 3 participants 12 messages Jul 6, 2023 – Jul 12, 2023

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

cover regmap: Fix REGMAP selections

Hi all,

This patch series fixes several missing selects related to REGMAP.

The first patch fixes a serious thinko I made when making the regmap KUnit test depend on REGMAP.

The last two patches fix missing selects I discovered when diving deeper into the REGMAP_* => REGMAP logic.

Thanks for your comments!

Geert Uytterhoeven (3):
regmap: Replace "default y if" by select
regmap: REGMAP_SLIMBUS should select REGMAP
ASoC: codecs: SND_SOC_WCD934X should select REGMAP_IRQ

 drivers/base/regmap/Kconfig | 16 +++++++++++++++-
 drivers/mfd/Kconfig         |  1 -
 sound/soc/codecs/Kconfig    |  1 +
 3 files changed, 16 insertions(+), 2 deletions(-)
Signature · 12 lines
2.34.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
#1 lore raw

PATCH 1/3 regmap: Replace "default y if" by select

Merely setting the default to enabled is no guarantee that a Kconfig option is actually enabled. While this works for an invisible option, the user can still disable it manually if the option is visible. Hence since the REGMAP option was made visible if KUNIT_ALL_TESTS is enabled, the user can now manually disable REGMAP, causing build failures if any of the REGMAP_* configuration options are enabled.

Fix this by replacing "default y if ..." by individual "select REGMAP" statements for all users.

---
 drivers/base/regmap/Kconfig | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/base/regmap/Kconfig +14 -1
index 0db2021f7477f2ab..e25cc619c75de3d9 100644
@@ -5,7 +5,6 @@
 
 config REGMAP
 	bool "Register Map support" if KUNIT_ALL_TESTS
-	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
@@ -25,10 +24,12 @@ config REGMAP_KUNIT
 
 config REGMAP_AC97
 	tristate
+	select REGMAP
 
 config REGMAP_I2C
 	tristate
 	depends on I2C
+	select REGMAP
 
 config REGMAP_SLIMBUS
 	tristate
@@ -37,23 +38,29 @@ config REGMAP_SLIMBUS
 config REGMAP_SPI
 	tristate
 	depends on SPI
+	select REGMAP
 
 config REGMAP_SPMI
 	tristate
 	depends on SPMI
+	select REGMAP
 
 config REGMAP_W1
 	tristate
 	depends on W1
+	select REGMAP
 
 config REGMAP_MDIO
 	tristate
+	select REGMAP
 
 config REGMAP_MMIO
 	tristate
+	select REGMAP
 
 config REGMAP_IRQ
 	bool
+	select REGMAP
 
 config REGMAP_RAM
 	tristate
@@ -61,23 +68,29 @@ config REGMAP_RAM
 config REGMAP_SOUNDWIRE
 	tristate
 	depends on SOUNDWIRE
+	select REGMAP
 
 config REGMAP_SOUNDWIRE_MBQ
 	tristate
 	depends on SOUNDWIRE
+	select REGMAP
 
 config REGMAP_SCCB
 	tristate
 	depends on I2C
+	select REGMAP
 
 config REGMAP_I3C
 	tristate
 	depends on I3C
+	select REGMAP
 
 config REGMAP_SPI_AVMM
 	tristate
 	depends on SPI
+	select REGMAP
 
 config REGMAP_FSI
 	tristate
 	depends on FSI
+	select REGMAP
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH 1/3] regmap: Replace "default y if" by select

Quoted 9 lines · Geert Uytterhoeven

Merely setting the default to enabled is no guarantee that a Kconfig option is actually enabled. While this works for an invisible option, the user can still disable it manually if the option is visible. Hence since the REGMAP option was made visible if KUNIT_ALL_TESTS is enabled, the user can now manually disable REGMAP, causing build failures if any of the REGMAP_* configuration options are enabled.

Fix this by replacing "default y if ..." by individual "select REGMAP" statements for all users.

I already have a separate patch which will go after the merge window that will move the KUnit visible option to a separate Kconfig since the current bodge to work around your desire to not have KUnit enable anything automatically had really substantial usability issues anyway.

I'm getting fed up with all the problems that these KUNIT_ALL_TESTS issues TBH, the inital patch here seriously damaged the usability.

#3 lore raw

PATCH 2/3 regmap: REGMAP_SLIMBUS should select REGMAP

In reply to Geert Uytterhoeven

If CONFIG_SND_SOC_WCD934X=y, CONFIG_COMPILE_TEST=y, CONFIG_MFD_WCD934X=n, CONFIG_REGMAP=n:

    sound/soc/codecs/wcd934x.c:518:38: error: array type has incomplete element type ‘struct regmap_range_cfg’
      518 | static const struct regmap_range_cfg wcd934x_ifc_ranges[] = {
	  |                                      ^~~~~~~~~~~~~~~~~~

Fix this by making REGMAP_SLIMBUS select REGMAP.

Drop the selection of REGMAP by MFD_WCD934X, as this is not needed (now both REGMAP_SLIMBUS and REGMAP_IRQ select REGMAP).

---
 drivers/base/regmap/Kconfig | 1 +
 drivers/mfd/Kconfig         | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/Kconfig +1 -0
index e25cc619c75de3d9..c3a260ed4e864959 100644
@@ -34,6 +34,7 @@ config REGMAP_I2C
 config REGMAP_SLIMBUS
 	tristate
 	depends on SLIMBUS
+	select REGMAP
 
 config REGMAP_SPI
 	tristate
drivers/mfd/Kconfig +0 -1
index 0b6af476f554a191..5857dad2c64828fa 100644
@@ -2121,7 +2121,6 @@ config MFD_STMFX
 config MFD_WCD934X
 	tristate "Support for WCD9340/WCD9341 Codec"
 	depends on SLIMBUS
-	select REGMAP
 	select REGMAP_SLIMBUS
 	select REGMAP_IRQ
 	select MFD_CORE
Signature · 1 line
2.34.1
maintainer
#4 lore raw

Re: [PATCH 2/3] regmap: REGMAP_SLIMBUS should select REGMAP

Quoted 1 line · Geert Uytterhoeven

Fix this by making REGMAP_SLIMBUS select REGMAP.

Why is this being done as a separate patch?

Quoted 2 lines

Drop the selection of REGMAP by MFD_WCD934X, as this is not needed (now both REGMAP_SLIMBUS and REGMAP_IRQ select REGMAP).

This has always been redudnant, why is it mixed into this patch?

#5 lore raw

Re: [PATCH 2/3] regmap: REGMAP_SLIMBUS should select REGMAP

Hi Mark,

Quoted 5 lines · Mark Brown
Quoted 1 line · Geert Uytterhoeven

Fix this by making REGMAP_SLIMBUS select REGMAP.

Why is this being done as a separate patch?

Because this is a new select, which was not handled through the "default y" before. [PATCH 1/3] converted only the existing ones.

Quoted 4 lines
Quoted 2 lines

Drop the selection of REGMAP by MFD_WCD934X, as this is not needed (now both REGMAP_SLIMBUS and REGMAP_IRQ select REGMAP).

This has always been redudnant, why is it mixed into this patch?

Because it is related to REGMAP_SLIMBUS selecting REGMAP.
I agree it was redundant before, as REGMAP_IRQ already selected REGMAP.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer Acked-by on v1 2/3
#6 lore raw

Re: [PATCH 2/3] regmap: REGMAP_SLIMBUS should select REGMAP

In reply to Geert Uytterhoeven
Quoted 9 lines · Geert Uytterhoeven

If CONFIG_SND_SOC_WCD934X=y, CONFIG_COMPILE_TEST=y, CONFIG_MFD_WCD934X=n, CONFIG_REGMAP=n:

    sound/soc/codecs/wcd934x.c:518:38: error: array type has incomplete element type ‘struct regmap_range_cfg’
      518 | static const struct regmap_range_cfg wcd934x_ifc_ranges[] = {
	  |                                      ^~~~~~~~~~~~~~~~~~

Fix this by making REGMAP_SLIMBUS select REGMAP.

Quoted 7 lines

Drop the selection of REGMAP by MFD_WCD934X, as this is not needed (now both REGMAP_SLIMBUS and REGMAP_IRQ select REGMAP).

---
 drivers/base/regmap/Kconfig | 1 +
 drivers/mfd/Kconfig         | 1 -
Quoted 29 lines
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/Kconfig +1 -0
index e25cc619c75de3d9..c3a260ed4e864959 100644
@@ -34,6 +34,7 @@ config REGMAP_I2C
 config REGMAP_SLIMBUS
 	tristate
 	depends on SLIMBUS
+	select REGMAP
 
 config REGMAP_SPI
 	tristate
drivers/mfd/Kconfig +0 -1
index 0b6af476f554a191..5857dad2c64828fa 100644
@@ -2121,7 +2121,6 @@ config MFD_STMFX
 config MFD_WCD934X
 	tristate "Support for WCD9340/WCD9341 Codec"
 	depends on SLIMBUS
-	select REGMAP
 	select REGMAP_SLIMBUS
 	select REGMAP_IRQ
 	select MFD_CORE
Signature · 1 line
2.34.1
Signature · 1 line
Lee Jones [李琼斯]
#7 lore raw

PATCH 3/3 ASoC: codecs: SND_SOC_WCD934X should select REGMAP_IRQ

In reply to Geert Uytterhoeven

If CONFIG_SND_SOC_WCD934X=y, CONFIG_COMPILE_TEST=y, CONFIG_MFD_WCD934X=n, CONFIG_REGMAP_IRQ=n:

    aarch64-linux-gnu-ld: sound/soc/codecs/wcd934x.o: in function `wcd934x_codec_probe':
    wcd934x.c:(.text+0x33cc): undefined reference to `regmap_irq_get_virq'
    aarch64-linux-gnu-ld: sound/soc/codecs/wcd934x.o: in function `wcd934x_comp_probe':
    wcd934x.c:(.text+0x4cb0): undefined reference to `regmap_irq_get_virq'
    aarch64-linux-gnu-ld: wcd934x.c:(.text+0x4cc0): undefined reference to `regmap_irq_get_virq'
    aarch64-linux-gnu-ld: wcd934x.c:(.text+0x4cd0): undefined reference to `regmap_irq_get_virq'
    aarch64-linux-gnu-ld: wcd934x.c:(.text+0x4ce0): undefined reference to `regmap_irq_get_virq'
    aarch64-linux-gnu-ld: sound/soc/codecs/wcd934x.o:wcd934x.c:(.text+0x4cf0): more undefined references to `regmap_irq_get_virq' follow

Fix this by making SND_SOC_WCD934X select REGMAP_IRQ.

---
 sound/soc/codecs/Kconfig | 1 +
 1 file changed, 1 insertion(+)
sound/soc/codecs/Kconfig +1 -0
index 2a62dbd5339e4a3a..958499050c8b6a3f 100644
@@ -1942,6 +1942,7 @@ config SND_SOC_WCD934X
 	tristate "WCD9340/WCD9341 Codec"
 	depends on COMMON_CLK
 	depends on SLIMBUS
+	select REGMAP_IRQ
 	select REGMAP_SLIMBUS
 	select SND_SOC_WCD_MBHC
 	depends on MFD_WCD934X || COMPILE_TEST
Signature · 1 line
2.34.1
maintainer
#8 lore raw

Re: [PATCH 3/3] ASoC: codecs: SND_SOC_WCD934X should select REGMAP_IRQ

Quoted 2 lines · Geert Uytterhoeven

If CONFIG_SND_SOC_WCD934X=y, CONFIG_COMPILE_TEST=y, CONFIG_MFD_WCD934X=n, CONFIG_REGMAP_IRQ=n:

There appears to be at best a marginal relationship between this and the rest of the series, please don't group things needlessly like this, it just creates spurious dependencies which complicates getting things merged.

#9 lore raw

Re: [PATCH 3/3] ASoC: codecs: SND_SOC_WCD934X should select REGMAP_IRQ

Hi Mark,

Quoted 8 lines · Mark Brown
Quoted 2 lines · Geert Uytterhoeven

If CONFIG_SND_SOC_WCD934X=y, CONFIG_COMPILE_TEST=y, CONFIG_MFD_WCD934X=n, CONFIG_REGMAP_IRQ=n:

There appears to be at best a marginal relationship between this and the rest of the series, please don't group things needlessly like this, it just creates spurious dependencies which complicates getting things merged.

Well, unless you have CONFIG_REGMAP=y due to some other reason, you won't reach the mentioned link error without applying [PATCH 2/3] first.

It doesn't hurt to apply this patch independently, though. Do you want me to resend it (to your sound-persona) as a separate patch?

Thanks!

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer
#10 lore raw

Re: [PATCH 3/3] ASoC: codecs: SND_SOC_WCD934X should select REGMAP_IRQ

Quoted 5 lines · Geert Uytterhoeven

Well, unless you have CONFIG_REGMAP=y due to some other reason, you won't reach the mentioned link error without applying [PATCH 2/3] first.

It doesn't hurt to apply this patch independently, though. Do you want me to resend it (to your sound-persona) as a separate patch?

I've already split it out.

maintainer
#11 lore raw

Re: (subset) [PATCH 0/3] regmap: Fix REGMAP selections

In reply to Geert Uytterhoeven
Quoted 8 lines · Geert Uytterhoeven

Hi all,

This patch series fixes several missing selects related to REGMAP.

The first patch fixes a serious thinko I made when making the regmap KUnit test depend on REGMAP.

[...]

Applied to

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

Thanks!

[3/3] ASoC: codecs: SND_SOC_WCD934X should select REGMAP_IRQ

      commit: e231cd833f6463e9a1d54acae9614b513c74d45e

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