Skip to contentSkip to conversation

mfd: intel_soc_pmic: use 'depends on' instead of 'select'

PATCH In review Arnd Bergmann 4 participants 6 messages Jun 9, 2017 – Jun 15, 2017 Multifunction devices (MFD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: intel_soc_pmic: use 'depends on' instead of 'select'

I ran into a build error on ARM with a platform that has a non-standard clk implementation:

drivers/clk/clk.o: In function `clk_disable':
clk.c:(.text.clk_disable+0x0): multiple definition of clk_disable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_disable+0x0): first defined here drivers/clk/clk.o: In function clk_enable':
clk.c:(.text.clk_enable+0x0): multiple definition of `clk_enable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_enable+0x0): first defined here

The problem is a device driver that uses 'select COMMON_CLK', which is generally a bad idea: selecting a subsystem should only be done from a platform, otherwise we run into circular dependencies. The same driver also selects 'GPIOLIB' and 'I2C', which has a similar effect.

This turns all three into 'depends on', as it should be. The same pattern exists for INTEL_SOC_PMIC and INTEL_SOC_PMIC_CHTWC, so we fix both the same way to keep them in sync. INTEL_SOC_PMIC does not depend on ACPI, so we don't need to 'select' the I2C master driver when ACPI is disabled.

Finally, we can limit the build to x86, unless we are compile testing.

Fixes 2f91ded5f8f4 ("mfd: Add Cherry Trail Whiskey Cove PMIC driver")
Fixes 5f125f1f5705 ("mfd: intel_soc_pmic: Select designware i2c-bus driver")
---
 drivers/mfd/Kconfig | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/mfd/Kconfig +6 -9
index ea5daa935518..74fa52582f06 100644
@@ -454,14 +454,12 @@ config LPC_SCH
 
 config INTEL_SOC_PMIC
 	bool "Support for Crystal Cove PMIC"
-	depends on HAS_IOMEM
-	select GPIOLIB
-	select I2C
+	depends on HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK
+	depends on X86 || COMPILE_TEST
 	select MFD_CORE
 	select REGMAP_I2C
 	select REGMAP_IRQ
-	select COMMON_CLK
-	select I2C_DESIGNWARE_PLATFORM
+	select I2C_DESIGNWARE_PLATFORM if ACPI
 	help
 	  Select this option to enable support for Crystal Cove PMIC
 	  on some Intel SoC systems. The PMIC provides ADC, GPIO,
@@ -484,13 +482,12 @@ config INTEL_SOC_PMIC_BXTWC
 	  on these systems.
 
 config INTEL_SOC_PMIC_CHTWC
-	bool "Support for Intel Cherry Trail Whiskey Cove PMIC"
-	depends on ACPI && HAS_IOMEM
+	tristate "Support for Intel Cherry Trail Whiskey Cove PMIC"
+	depends on ACPI && HAS_IOMEM && I2C=y && COMMON_CLK
+	depends on X86 || COMPILE_TEST
 	select MFD_CORE
-	select I2C
 	select REGMAP_I2C
 	select REGMAP_IRQ
-	select COMMON_CLK
 	select I2C_DESIGNWARE_PLATFORM
 	help
 	  Select this option to enable support for the Intel Cherry Trail
Signature · 1 line
2.9.0
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 20 lines · Arnd Bergmann

I ran into a build error on ARM with a platform that has a non-standard clk implementation:

drivers/clk/clk.o: In function `clk_disable':
clk.c:(.text.clk_disable+0x0): multiple definition of clk_disable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_disable+0x0): first defined here drivers/clk/clk.o: In function clk_enable':
clk.c:(.text.clk_enable+0x0): multiple definition of `clk_enable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_enable+0x0): first defined here

The problem is a device driver that uses 'select COMMON_CLK', which is generally a bad idea: selecting a subsystem should only be done from a platform, otherwise we run into circular dependencies. The same driver also selects 'GPIOLIB' and 'I2C', which has a similar effect.

This turns all three into 'depends on', as it should be. The same pattern exists for INTEL_SOC_PMIC and INTEL_SOC_PMIC_CHTWC, so we fix both the same way to keep them in sync. INTEL_SOC_PMIC does not depend on ACPI, so we don't need to 'select' the I2C master driver when ACPI is disabled.

Quoted 5 lines

Finally, we can limit the build to x86, unless we are compile testing.

Fixes 2f91ded5f8f4 ("mfd: Add Cherry Trail Whiskey Cove PMIC driver")
Fixes 5f125f1f5705 ("mfd: intel_soc_pmic: Select designware i2c-bus driver")

Looks good to me:

Regards,

Hans

Quoted 44 lines
---
  drivers/mfd/Kconfig | 15 ++++++---------
  1 file changed, 6 insertions(+), 9 deletions(-)
drivers/mfd/Kconfig +6 -9
index ea5daa935518..74fa52582f06 100644
@@ -454,14 +454,12 @@ config LPC_SCH
 
  config INTEL_SOC_PMIC
  	bool "Support for Crystal Cove PMIC"
-	depends on HAS_IOMEM
-	select GPIOLIB
-	select I2C
+	depends on HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK
+	depends on X86 || COMPILE_TEST
  	select MFD_CORE
  	select REGMAP_I2C
  	select REGMAP_IRQ
-	select COMMON_CLK
-	select I2C_DESIGNWARE_PLATFORM
+	select I2C_DESIGNWARE_PLATFORM if ACPI
  	help
  	  Select this option to enable support for Crystal Cove PMIC
  	  on some Intel SoC systems. The PMIC provides ADC, GPIO,
@@ -484,13 +482,12 @@ config INTEL_SOC_PMIC_BXTWC
  	  on these systems.
 
  config INTEL_SOC_PMIC_CHTWC
-	bool "Support for Intel Cherry Trail Whiskey Cove PMIC"
-	depends on ACPI && HAS_IOMEM
+	tristate "Support for Intel Cherry Trail Whiskey Cove PMIC"
+	depends on ACPI && HAS_IOMEM && I2C=y && COMMON_CLK
+	depends on X86 || COMPILE_TEST
  	select MFD_CORE
-	select I2C
  	select REGMAP_I2C
  	select REGMAP_IRQ
-	select COMMON_CLK
  	select I2C_DESIGNWARE_PLATFORM
  	help
  	  Select this option to enable support for the Intel Cherry Trail
Reviewed-by
#2 lore raw
Quoted 41 lines · Hans de Goede

Hi,

Quoted 29 lines · Arnd Bergmann

I ran into a build error on ARM with a platform that has a non- standard
clk implementation:

drivers/clk/clk.o: In function `clk_disable':
clk.c:(.text.clk_disable+0x0): multiple definition of `clk_disable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_disable+0x0): first defined here
drivers/clk/clk.o: In function `clk_enable':
clk.c:(.text.clk_enable+0x0): multiple definition of `clk_enable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_enable+0x0): first defined here

The problem is a device driver that uses 'select COMMON_CLK', which is
generally a bad idea: selecting a subsystem should only be done from a platform, otherwise we run into circular dependencies. The same driver
also selects 'GPIOLIB' and 'I2C', which has a similar effect.

This turns all three into 'depends on', as it should be. The same pattern
exists for INTEL_SOC_PMIC and INTEL_SOC_PMIC_CHTWC, so we fix both the
same way to keep them in sync. INTEL_SOC_PMIC does not depend on ACPI,
so we don't need to 'select' the I2C master driver when ACPI is disabled.

Quoted 8 lines

Finally, we can limit the build to x86, unless we are compile testing.

Fixes 2f91ded5f8f4 ("mfd: Add Cherry Trail Whiskey Cove PMIC

driver")

Fixes 5f125f1f5705 ("mfd: intel_soc_pmic: Select designware i2c-bus

driver")

Quoted 3 lines

Looks good to me:

No objections if it works for Hans' case.

Quoted 53 lines

Regards,

Hans

Quoted 46 lines

---
  drivers/mfd/Kconfig | 15 ++++++---------

  1 file changed, 6 insertions(+), 9 deletions(-)
drivers/mfd/Kconfig +0 -0
index ea5daa935518..74fa52582f06 100644
@@ -454,14 +454,12 @@ config LPC_SCH


  config INTEL_SOC_PMIC
   bool "Support for Crystal Cove PMIC"

drivers/mfd/Kconfig +2 -3
-	depends on HAS_IOMEM
-	select GPIOLIB
-	select I2C
+	depends on HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK
+	depends on X86 || COMPILE_TEST

   select MFD_CORE
   select REGMAP_I2C
   select REGMAP_IRQ

drivers/mfd/Kconfig +1 -2
-	select COMMON_CLK
-	select I2C_DESIGNWARE_PLATFORM
+	select I2C_DESIGNWARE_PLATFORM if ACPI

   help
     Select this option to enable support for Crystal Cove PMIC
     on some Intel SoC systems. The PMIC provides ADC, GPIO,

drivers/mfd/Kconfig +0 -0
@@ -484,13 +482,12 @@ config INTEL_SOC_PMIC_BXTWC

     on these systems.

  config INTEL_SOC_PMIC_CHTWC

drivers/mfd/Kconfig +3 -2
-	bool "Support for Intel Cherry Trail Whiskey Cove PMIC"
-	depends on ACPI && HAS_IOMEM
+	tristate "Support for Intel Cherry Trail Whiskey Cove PMIC"
+	depends on ACPI && HAS_IOMEM && I2C=y && COMMON_CLK
+	depends on X86 || COMPILE_TEST

   select MFD_CORE

drivers/mfd/Kconfig +0 -1
-	select I2C

   select REGMAP_I2C
   select REGMAP_IRQ

drivers/mfd/Kconfig +0 -1
-	select COMMON_CLK

   select I2C_DESIGNWARE_PLATFORM
   help
     Select this option to enable support for the Intel Cherry Trail

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw

Hi,

Quoted 42 lines · Andy Shevchenko
Quoted 41 lines · Hans de Goede

Hi,

Quoted 37 lines · Arnd Bergmann

I ran into a build error on ARM with a platform that has a non- standard
clk implementation:

drivers/clk/clk.o: In function `clk_disable':
clk.c:(.text.clk_disable+0x0): multiple definition of `clk_disable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_disable+0x0): first defined here
drivers/clk/clk.o: In function `clk_enable':
clk.c:(.text.clk_enable+0x0): multiple definition of `clk_enable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_enable+0x0): first defined here

The problem is a device driver that uses 'select COMMON_CLK', which is
generally a bad idea: selecting a subsystem should only be done from a platform, otherwise we run into circular dependencies. The same driver
also selects 'GPIOLIB' and 'I2C', which has a similar effect.

This turns all three into 'depends on', as it should be. The same pattern
exists for INTEL_SOC_PMIC and INTEL_SOC_PMIC_CHTWC, so we fix both the
same way to keep them in sync. INTEL_SOC_PMIC does not depend on ACPI,
so we don't need to 'select' the I2C master driver when ACPI is disabled.

Finally, we can limit the build to x86, unless we are compile testing.

Fixes 2f91ded5f8f4 ("mfd: Add Cherry Trail Whiskey Cove PMIC

driver")

Fixes 5f125f1f5705 ("mfd: intel_soc_pmic: Select designware i2c-bus

driver")

Quoted 5 lines
Quoted 3 lines

Looks good to me:

No objections if it works for Hans' case.

Yes I checked my .config stays the same with a "make oldconfig" and this patch.

Regards,

Hans

Quoted 57 lines
Quoted 53 lines

Regards,

Hans

Quoted 46 lines
---
   drivers/mfd/Kconfig | 15 ++++++---------
   1 file changed, 6 insertions(+), 9 deletions(-)
drivers/mfd/Kconfig +3 -5
index ea5daa935518..74fa52582f06 100644
@@ -454,14 +454,12 @@ config LPC_SCH
 
   config INTEL_SOC_PMIC
   	bool "Support for Crystal Cove PMIC"
-	depends on HAS_IOMEM
-	select GPIOLIB
-	select I2C
+	depends on HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK
+	depends on X86 || COMPILE_TEST
   	select MFD_CORE
   	select REGMAP_I2C
   	select REGMAP_IRQ
-	select COMMON_CLK
-	select I2C_DESIGNWARE_PLATFORM
+	select I2C_DESIGNWARE_PLATFORM if ACPI
   	help
   	  Select this option to enable support for Crystal Cove

PMIC
on some Intel SoC systems. The PMIC provides ADC, GPIO,

drivers/mfd/Kconfig +3 -4
@@ -484,13 +482,12 @@ config INTEL_SOC_PMIC_BXTWC
   	  on these systems.
 
   config INTEL_SOC_PMIC_CHTWC
-	bool "Support for Intel Cherry Trail Whiskey Cove PMIC"
-	depends on ACPI && HAS_IOMEM
+	tristate "Support for Intel Cherry Trail Whiskey Cove PMIC"
+	depends on ACPI && HAS_IOMEM && I2C=y && COMMON_CLK
+	depends on X86 || COMPILE_TEST
   	select MFD_CORE
-	select I2C
   	select REGMAP_I2C
   	select REGMAP_IRQ
-	select COMMON_CLK
   	select I2C_DESIGNWARE_PLATFORM
   	help
   	  Select this option to enable support for the Intel

Cherry Trail

#4 lore raw
In reply to Arnd Bergmann
Quoted 20 lines · Arnd Bergmann

I ran into a build error on ARM with a platform that has a non-standard clk implementation:

drivers/clk/clk.o: In function `clk_disable':
clk.c:(.text.clk_disable+0x0): multiple definition of clk_disable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_disable+0x0): first defined here drivers/clk/clk.o: In function clk_enable':
clk.c:(.text.clk_enable+0x0): multiple definition of `clk_enable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_enable+0x0): first defined here

The problem is a device driver that uses 'select COMMON_CLK', which is generally a bad idea: selecting a subsystem should only be done from a platform, otherwise we run into circular dependencies. The same driver also selects 'GPIOLIB' and 'I2C', which has a similar effect.

This turns all three into 'depends on', as it should be. The same pattern exists for INTEL_SOC_PMIC and INTEL_SOC_PMIC_CHTWC, so we fix both the same way to keep them in sync. INTEL_SOC_PMIC does not depend on ACPI, so we don't need to 'select' the I2C master driver when ACPI is disabled.

Quoted 8 lines

Finally, we can limit the build to x86, unless we are compile testing.

Fixes 2f91ded5f8f4 ("mfd: Add Cherry Trail Whiskey Cove PMIC driver")
Fixes 5f125f1f5705 ("mfd: intel_soc_pmic: Select designware i2c-bus driver")
---
 drivers/mfd/Kconfig | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

I need 2 patches, one for each of the Fixes above. The plan being to squash them into the original commits (keeping sign-off credits of course) to prevent bisectability breakage.

If that does not happen, I will have to remove both offending patches until they are fixed.

Quoted 39 lines
drivers/mfd/Kconfig +6 -9
index ea5daa935518..74fa52582f06 100644
@@ -454,14 +454,12 @@ config LPC_SCH
 
 config INTEL_SOC_PMIC
 	bool "Support for Crystal Cove PMIC"
-	depends on HAS_IOMEM
-	select GPIOLIB
-	select I2C
+	depends on HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK
+	depends on X86 || COMPILE_TEST
 	select MFD_CORE
 	select REGMAP_I2C
 	select REGMAP_IRQ
-	select COMMON_CLK
-	select I2C_DESIGNWARE_PLATFORM
+	select I2C_DESIGNWARE_PLATFORM if ACPI
 	help
 	  Select this option to enable support for Crystal Cove PMIC
 	  on some Intel SoC systems. The PMIC provides ADC, GPIO,
@@ -484,13 +482,12 @@ config INTEL_SOC_PMIC_BXTWC
 	  on these systems.
 
 config INTEL_SOC_PMIC_CHTWC
-	bool "Support for Intel Cherry Trail Whiskey Cove PMIC"
-	depends on ACPI && HAS_IOMEM
+	tristate "Support for Intel Cherry Trail Whiskey Cove PMIC"
+	depends on ACPI && HAS_IOMEM && I2C=y && COMMON_CLK
+	depends on X86 || COMPILE_TEST
 	select MFD_CORE
-	select I2C
 	select REGMAP_I2C
 	select REGMAP_IRQ
-	select COMMON_CLK
 	select I2C_DESIGNWARE_PLATFORM
 	help
 	  Select this option to enable support for the Intel Cherry Trail
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#5 lore raw

Hi,

Quoted 31 lines · Lee Jones
Quoted 20 lines · Arnd Bergmann

I ran into a build error on ARM with a platform that has a non-standard clk implementation:

drivers/clk/clk.o: In function `clk_disable':
clk.c:(.text.clk_disable+0x0): multiple definition of clk_disable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_disable+0x0): first defined here drivers/clk/clk.o: In function clk_enable':
clk.c:(.text.clk_enable+0x0): multiple definition of `clk_enable' arch/arm/mach-omap1/clock.o:clock.c:(.text.clk_enable+0x0): first defined here

The problem is a device driver that uses 'select COMMON_CLK', which is generally a bad idea: selecting a subsystem should only be done from a platform, otherwise we run into circular dependencies. The same driver also selects 'GPIOLIB' and 'I2C', which has a similar effect.

This turns all three into 'depends on', as it should be. The same pattern exists for INTEL_SOC_PMIC and INTEL_SOC_PMIC_CHTWC, so we fix both the same way to keep them in sync. INTEL_SOC_PMIC does not depend on ACPI, so we don't need to 'select' the I2C master driver when ACPI is disabled.

Quoted 8 lines

Finally, we can limit the build to x86, unless we are compile testing.

Fixes 2f91ded5f8f4 ("mfd: Add Cherry Trail Whiskey Cove PMIC driver")
Fixes 5f125f1f5705 ("mfd: intel_soc_pmic: Select designware i2c-bus driver")
---
  drivers/mfd/Kconfig | 15 ++++++---------
  1 file changed, 6 insertions(+), 9 deletions(-)
Quoted 6 lines

I need 2 patches, one for each of the Fixes above. The plan being to squash them into the original commits (keeping sign-off credits of course) to prevent bisectability breakage.

If that does not happen, I will have to remove both offending patches until they are fixed.

Ok, I've just send out a split version if this patch.

Regards,

Hans

Quoted 40 lines
Quoted 39 lines
drivers/mfd/Kconfig +6 -9
index ea5daa935518..74fa52582f06 100644
@@ -454,14 +454,12 @@ config LPC_SCH
 
  config INTEL_SOC_PMIC
  	bool "Support for Crystal Cove PMIC"
-	depends on HAS_IOMEM
-	select GPIOLIB
-	select I2C
+	depends on HAS_IOMEM && I2C=y && GPIOLIB && COMMON_CLK
+	depends on X86 || COMPILE_TEST
  	select MFD_CORE
  	select REGMAP_I2C
  	select REGMAP_IRQ
-	select COMMON_CLK
-	select I2C_DESIGNWARE_PLATFORM
+	select I2C_DESIGNWARE_PLATFORM if ACPI
  	help
  	  Select this option to enable support for Crystal Cove PMIC
  	  on some Intel SoC systems. The PMIC provides ADC, GPIO,
@@ -484,13 +482,12 @@ config INTEL_SOC_PMIC_BXTWC
  	  on these systems.
 
  config INTEL_SOC_PMIC_CHTWC
-	bool "Support for Intel Cherry Trail Whiskey Cove PMIC"
-	depends on ACPI && HAS_IOMEM
+	tristate "Support for Intel Cherry Trail Whiskey Cove PMIC"
+	depends on ACPI && HAS_IOMEM && I2C=y && COMMON_CLK
+	depends on X86 || COMPILE_TEST
  	select MFD_CORE
-	select I2C
  	select REGMAP_I2C
  	select REGMAP_IRQ
-	select COMMON_CLK
  	select I2C_DESIGNWARE_PLATFORM
  	help
  	  Select this option to enable support for the Intel Cherry Trail