linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option
@ 2015-11-05 11:15 Masahiro Yamada
  2015-11-05 11:15 ` [RFC PATCH 1/7] reset: drop ARCH_HAS_RESET_CONTROLLER Masahiro Yamada
                   ` (7 more replies)
  0 siblings, 8 replies; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-05 11:15 UTC (permalink / raw)
  To: linux-kernel, Philipp Zabel
  Cc: Masahiro Yamada, linux-mips, Patrice Chotard, Sascha Hauer,
	kernel, Haojian Zhuang, Eric Miao, Linus Walleij,
	Michael Turquette, Vishnu Patekar, Arnd Bergmann, David Airlie,
	Barry Song, Catalin Marinas, Terje Bergström,
	Heiko Stuebner, Tuomas Tynkkynen, Hans de Goede, linux-rockchip,
	linux-arm-kernel, Will Deacon, Ralf Baechle, Alexandre Courbot,
	Daniel Lezcano, Benjamin Gaignard, Thierry Reding, Mark Yao,
	Vincent Abriou, Sebastian Hesselbarth, Jens Kuske, Russell King,
	linux-gpio, dri-devel, linux-tegra, Maxime Coquelin,
	Srinivas Kandagatla, Shawn Guo, Mark Brown, Stephen Warren,
	linux-spi, Chen-Yu Tsai, Maxime Ripard

When I was implementing a new reset controller for my SoCs,
I struggled to make my sub-menu shown under the reset
controller menu.
I noticed the Kconfig in reset sub-system are screwed up due to two
config options (ARCH_HAS_RESET_CONTROLLER and RESET_CONTROLLER).

I think only the former should be select'ed by relevant SoCs,
but in fact the latter is also select'ed here and there.
Mixing "select" to a user-configurable option is a mess.

Finally, I started to wonder whether it could be more simpler?

The first patch drops ARCH_HAS_RESET_CONTROLLER.
RESET_CONTROLLER should be directly selected by SoCs.

The rest of this series are minor clean ups in other
sub-systems.
I can postpone them if changes over cross sub-systems
are not preferred.



Masahiro Yamada (7):
  reset: drop ARCH_HAS_RESET_CONTROLLER
  spi: sunxi: remove redundant "depends on RESET_CONTROLLER"
  spi: tegra: remove redundant "depends on RESET_CONTROLLER"
  pinctrl: sunxi: remove redundant "depends on RESET_CONTROLLER"
  drm/sti: replace "select RESET_CONTROLLER" with "depends on ..."
  drm/rockchip: remove redundant "depends on RESET_CONTROLLER"
  drm/tegra: tegra: remove redundant "depends on RESET_CONTROLLER"

 arch/arm/Kconfig                 |  3 +--
 arch/arm/mach-berlin/Kconfig     |  2 +-
 arch/arm/mach-imx/Kconfig        |  2 +-
 arch/arm/mach-mmp/Kconfig        |  4 ++--
 arch/arm/mach-prima2/Kconfig     |  2 +-
 arch/arm/mach-rockchip/Kconfig   |  2 +-
 arch/arm/mach-sti/Kconfig        |  1 -
 arch/arm/mach-sunxi/Kconfig      |  1 -
 arch/arm/mach-tegra/Kconfig      |  1 -
 arch/arm64/Kconfig.platforms     |  3 +--
 arch/mips/Kconfig                |  4 +---
 drivers/gpu/drm/rockchip/Kconfig |  1 -
 drivers/gpu/drm/sti/Kconfig      |  4 ++--
 drivers/gpu/drm/tegra/Kconfig    |  1 -
 drivers/pinctrl/sunxi/Kconfig    |  2 --
 drivers/reset/Kconfig            | 12 +++++++-----
 drivers/reset/sti/Kconfig        |  1 -
 drivers/spi/Kconfig              |  6 ++----
 18 files changed, 20 insertions(+), 32 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 25+ messages in thread

* [RFC PATCH 1/7] reset: drop ARCH_HAS_RESET_CONTROLLER
  2015-11-05 11:15 [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Masahiro Yamada
@ 2015-11-05 11:15 ` Masahiro Yamada
  2015-11-05 11:15 ` [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER" Masahiro Yamada
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-05 11:15 UTC (permalink / raw)
  To: linux-kernel, Philipp Zabel
  Cc: Masahiro Yamada, linux-mips, Patrice Chotard, Sascha Hauer,
	kernel, Haojian Zhuang, Eric Miao, Michael Turquette,
	Arnd Bergmann, Barry Song, Catalin Marinas, Heiko Stuebner,
	Tuomas Tynkkynen, linux-rockchip, linux-arm-kernel, Will Deacon,
	Ralf Baechle, Alexandre Courbot, Daniel Lezcano, Thierry Reding,
	Sebastian Hesselbarth, Jens Kuske, Russell King, linux-tegra,
	Maxime Coquelin, Srinivas Kandagatla, Shawn Guo, Stephen Warren,
	Chen-Yu Tsai, Maxime Ripard

The reset sub-system is supposed to be enabled by two steps:

  - ARCH_HAS_RESET_CONTROLLER is select'ed by such sub-architectures
    that support reset controllers

  - Based on that, RESET_CONTROLLER is configured by "make menuconfig"
    or friends.  (Note that it is a user-configurable option as it has
    a prompt.)

But, this is getting messy in spite of the intention.  Some SoC families
(such as Tegra, sunxi, etc.) select both ARCH_HAS_RESET_CONTROLLER and
RESET_CONTROLLER.  So, it is no longer configurable (i.e. forcibly
select'ed) in the multi-platforms.

Also, many drivers that use reset APIs are accompanied by
"depends on RESET_CONTROLLER".

Like pinctrl, clk sub-systems, reset is a fundamental feature needed
for SoCs to work correctly.

If a particular SoC supports a reset controller driver, it is very
likely to be necessary for that SoC.

So, this commit drops ARCH_HAS_RESET_CONTROLLER, making RESET_CONTROLLER
a user-unconfigurable option.  Going forward, it should be directly
select'ed by relevant SoCs.

This change would also be useful to clean-up "depends on RESET_CONTROLLER"
in other drivers.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 arch/arm/Kconfig               |  3 +--
 arch/arm/mach-berlin/Kconfig   |  2 +-
 arch/arm/mach-imx/Kconfig      |  2 +-
 arch/arm/mach-mmp/Kconfig      |  4 ++--
 arch/arm/mach-prima2/Kconfig   |  2 +-
 arch/arm/mach-rockchip/Kconfig |  2 +-
 arch/arm/mach-sti/Kconfig      |  1 -
 arch/arm/mach-sunxi/Kconfig    |  1 -
 arch/arm/mach-tegra/Kconfig    |  1 -
 arch/arm64/Kconfig.platforms   |  3 +--
 arch/mips/Kconfig              |  4 +---
 drivers/reset/Kconfig          | 12 +++++++-----
 drivers/reset/sti/Kconfig      |  1 -
 13 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f1ed110..55af5e8 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -972,7 +972,7 @@ config ARCH_EFM32
 config ARCH_LPC18XX
 	bool "NXP LPC18xx/LPC43xx"
 	depends on ARM_SINGLE_ARMV7M
-	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select ARM_AMBA
 	select CLKSRC_LPC32XX
 	select PINCTRL
@@ -983,7 +983,6 @@ config ARCH_LPC18XX
 config ARCH_STM32
 	bool "STMicrolectronics STM32"
 	depends on ARM_SINGLE_ARMV7M
-	select ARCH_HAS_RESET_CONTROLLER
 	select ARMV7M_SYSTICK
 	select CLKSRC_STM32
 	select RESET_CONTROLLER
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
index 742d53a..1c8e301 100644
--- a/arch/arm/mach-berlin/Kconfig
+++ b/arch/arm/mach-berlin/Kconfig
@@ -1,6 +1,6 @@
 menuconfig ARCH_BERLIN
 	bool "Marvell Berlin SoCs" if ARCH_MULTI_V7
-	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_GIC
 	select DW_APB_ICTL
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 8ceda28..7773cd7 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -58,7 +58,7 @@ config HAVE_IMX_MMDC
 
 config HAVE_IMX_SRC
 	def_bool y if SMP
-	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 
 config IMX_HAVE_IOMUX_V1
 	bool
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index fdbfadf..46fdb69 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -90,7 +90,7 @@ config MACH_MMP_DT
 	select PINCTRL
 	select PINCTRL_SINGLE
 	select COMMON_CLK
-	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select CPU_MOHAWK
 	help
 	  Include support for Marvell MMP2 based platforms using
@@ -104,7 +104,7 @@ config MACH_MMP2_DT
 	select PINCTRL
 	select PINCTRL_SINGLE
 	select COMMON_CLK
-	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select CPU_PJ4
 	help
 	  Include support for Marvell MMP2 based platforms using
diff --git a/arch/arm/mach-prima2/Kconfig b/arch/arm/mach-prima2/Kconfig
index 9ab8932..5d03202 100644
--- a/arch/arm/mach-prima2/Kconfig
+++ b/arch/arm/mach-prima2/Kconfig
@@ -1,6 +1,6 @@
 menuconfig ARCH_SIRF
 	bool "CSR SiRF" if ARCH_MULTI_V7
-	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select GENERIC_IRQ_CHIP
 	select NO_IOPORT_MAP
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index ae4eb7c..6990c3a 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -2,7 +2,7 @@ config ARCH_ROCKCHIP
 	bool "Rockchip RK2928 and RK3xxx SOCs" if ARCH_MULTI_V7
 	select PINCTRL
 	select PINCTRL_ROCKCHIP
-	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_AMBA
 	select ARM_GIC
diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig
index 125865d..d0606e2 100644
--- a/arch/arm/mach-sti/Kconfig
+++ b/arch/arm/mach-sti/Kconfig
@@ -6,7 +6,6 @@ menuconfig ARCH_STI
 	select PINCTRL
 	select PINCTRL_ST
 	select MFD_SYSCON
-	select ARCH_HAS_RESET_CONTROLLER
 	select HAVE_ARM_SCU if SMP
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_ERRATA_754322
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 4efe2d4..60b58ca 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -1,7 +1,6 @@
 menuconfig ARCH_SUNXI
 	bool "Allwinner SoCs" if ARCH_MULTI_V7
 	select ARCH_REQUIRE_GPIOLIB
-	select ARCH_HAS_RESET_CONTROLLER
 	select CLKSRC_MMIO
 	select GENERIC_IRQ_CHIP
 	select PINCTRL
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 0fa4c5f..269efaa 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -9,7 +9,6 @@ menuconfig ARCH_TEGRA
 	select HAVE_ARM_TWD if SMP
 	select PINCTRL
 	select PM_OPP
-	select ARCH_HAS_RESET_CONTROLLER
 	select RESET_CONTROLLER
 	select SOC_BUS
 	select USB_ULPI if USB_PHY
diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms
index bb066e0..c455540 100644
--- a/arch/arm64/Kconfig.platforms
+++ b/arch/arm64/Kconfig.platforms
@@ -53,7 +53,7 @@ config ARCH_QCOM
 
 config ARCH_ROCKCHIP
 	bool "Rockchip Platforms"
-	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select PINCTRL
 	select PINCTRL_ROCKCHIP
@@ -68,7 +68,6 @@ config ARCH_SEATTLE
 
 config ARCH_TEGRA
 	bool "NVIDIA Tegra SoC Family"
-	select ARCH_HAS_RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select CLKDEV_LOOKUP
 	select CLKSRC_MMIO
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index e3aa5b0..da655a0 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -119,7 +119,7 @@ config ATH25
 
 config ATH79
 	bool "Atheros AR71XX/AR724X/AR913X based boards"
-	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select BOOT_RAW
 	select CEVT_R4K
@@ -329,7 +329,6 @@ config LANTIQ
 	select USE_OF
 	select PINCTRL
 	select PINCTRL_LANTIQ
-	select ARCH_HAS_RESET_CONTROLLER
 	select RESET_CONTROLLER
 
 config LASAT
@@ -555,7 +554,6 @@ config RALINK
 	select SYS_HAS_EARLY_PRINTK
 	select HAVE_MACH_CLKDEV
 	select CLKDEV_LOOKUP
-	select ARCH_HAS_RESET_CONTROLLER
 	select RESET_CONTROLLER
 
 config SGI_IP22
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index 0615f50..4ca3cc8 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -1,9 +1,5 @@
-config ARCH_HAS_RESET_CONTROLLER
+config RESET_CONTROLLER
 	bool
-
-menuconfig RESET_CONTROLLER
-	bool "Reset Controller Support"
-	default y if ARCH_HAS_RESET_CONTROLLER
 	help
 	  Generic Reset Controller support.
 
@@ -12,4 +8,10 @@ menuconfig RESET_CONTROLLER
 
 	  If unsure, say no.
 
+
+menu "Reset Controllers"
+	depends on RESET_CONTROLLER
+
 source "drivers/reset/sti/Kconfig"
+
+endmenu
diff --git a/drivers/reset/sti/Kconfig b/drivers/reset/sti/Kconfig
index f8c15a3..6131785 100644
--- a/drivers/reset/sti/Kconfig
+++ b/drivers/reset/sti/Kconfig
@@ -2,7 +2,6 @@ if ARCH_STI
 
 config STI_RESET_SYSCFG
 	bool
-	select RESET_CONTROLLER
 
 config STIH415_RESET
 	bool
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 11:15 [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Masahiro Yamada
  2015-11-05 11:15 ` [RFC PATCH 1/7] reset: drop ARCH_HAS_RESET_CONTROLLER Masahiro Yamada
@ 2015-11-05 11:15 ` Masahiro Yamada
  2015-11-05 11:28   ` Mark Brown
  2015-11-05 11:15 ` [RFC PATCH 3/7] spi: tegra: " Masahiro Yamada
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-05 11:15 UTC (permalink / raw)
  To: linux-kernel, Philipp Zabel; +Cc: Masahiro Yamada, Mark Brown, linux-spi

ARCH_SUNXI selects RESET_CONTROLLER.
The dependency "depends on RESET_CONTROLLER" is already met.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/spi/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 4887f31..604ffab 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -536,7 +536,6 @@ config SPI_SUN4I
 config SPI_SUN6I
 	tristate "Allwinner A31 SPI controller"
 	depends on ARCH_SUNXI || COMPILE_TEST
-	depends on RESET_CONTROLLER
 	help
 	  This enables using the SPI controller on the Allwinner A31 SoCs.
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [RFC PATCH 3/7] spi: tegra: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 11:15 [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Masahiro Yamada
  2015-11-05 11:15 ` [RFC PATCH 1/7] reset: drop ARCH_HAS_RESET_CONTROLLER Masahiro Yamada
  2015-11-05 11:15 ` [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER" Masahiro Yamada
@ 2015-11-05 11:15 ` Masahiro Yamada
  2015-11-05 11:50   ` Mark Brown
  2015-11-05 11:15 ` [RFC PATCH 4/7] pinctrl: sunxi: " Masahiro Yamada
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-05 11:15 UTC (permalink / raw)
  To: linux-kernel, Philipp Zabel; +Cc: Masahiro Yamada, Mark Brown, linux-spi

ARCH_TEGRA selects RESET_CONTROLLER.
The dependency "depends on RESET_CONTROLLER" is already met.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/spi/Kconfig | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 604ffab..d853306 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -549,7 +549,7 @@ config SPI_MXS
 config SPI_TEGRA114
 	tristate "NVIDIA Tegra114 SPI Controller"
 	depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
-	depends on RESET_CONTROLLER && HAS_DMA
+	depends on HAS_DMA
 	help
 	  SPI driver for NVIDIA Tegra114 SPI Controller interface. This controller
 	  is different than the older SoCs SPI controller and also register interface
@@ -558,7 +558,6 @@ config SPI_TEGRA114
 config SPI_TEGRA20_SFLASH
 	tristate "Nvidia Tegra20 Serial flash Controller"
 	depends on ARCH_TEGRA || COMPILE_TEST
-	depends on RESET_CONTROLLER
 	help
 	  SPI driver for Nvidia Tegra20 Serial flash Controller interface.
 	  The main usecase of this controller is to use spi flash as boot
@@ -567,7 +566,7 @@ config SPI_TEGRA20_SFLASH
 config SPI_TEGRA20_SLINK
 	tristate "Nvidia Tegra20/Tegra30 SLINK Controller"
 	depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
-	depends on RESET_CONTROLLER && HAS_DMA
+	depends on HAS_DMA
 	help
 	  SPI driver for Nvidia Tegra20/Tegra30 SLINK Controller interface.
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [RFC PATCH 4/7] pinctrl: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 11:15 [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Masahiro Yamada
                   ` (2 preceding siblings ...)
  2015-11-05 11:15 ` [RFC PATCH 3/7] spi: tegra: " Masahiro Yamada
@ 2015-11-05 11:15 ` Masahiro Yamada
  2015-11-05 13:40   ` Linus Walleij
  2015-11-05 11:15 ` [RFC PATCH 5/7] drm/sti: replace "select RESET_CONTROLLER" with "depends on ..." Masahiro Yamada
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-05 11:15 UTC (permalink / raw)
  To: linux-kernel, Philipp Zabel
  Cc: Masahiro Yamada, Linus Walleij, Vishnu Patekar, Hans de Goede,
	linux-gpio, Chen-Yu Tsai, Maxime Ripard, linux-arm-kernel

ARCH_SUNXI selects RESET_CONTROLLER.
The dependency "depends on RESET_CONTROLLER" is already met.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/pinctrl/sunxi/Kconfig | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/pinctrl/sunxi/Kconfig b/drivers/pinctrl/sunxi/Kconfig
index e68fd95..50bd2e3 100644
--- a/drivers/pinctrl/sunxi/Kconfig
+++ b/drivers/pinctrl/sunxi/Kconfig
@@ -27,7 +27,6 @@ config PINCTRL_SUN6I_A31S
 
 config PINCTRL_SUN6I_A31_R
 	def_bool MACH_SUN6I
-	depends on RESET_CONTROLLER
 	select PINCTRL_SUNXI_COMMON
 
 config PINCTRL_SUN7I_A20
@@ -48,7 +47,6 @@ config PINCTRL_SUN8I_A83T
 
 config PINCTRL_SUN8I_A23_R
 	def_bool MACH_SUN8I
-	depends on RESET_CONTROLLER
 	select PINCTRL_SUNXI_COMMON
 
 config PINCTRL_SUN9I_A80
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [RFC PATCH 5/7] drm/sti: replace "select RESET_CONTROLLER" with "depends on ..."
  2015-11-05 11:15 [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Masahiro Yamada
                   ` (3 preceding siblings ...)
  2015-11-05 11:15 ` [RFC PATCH 4/7] pinctrl: sunxi: " Masahiro Yamada
@ 2015-11-05 11:15 ` Masahiro Yamada
  2015-11-05 11:15 ` [RFC PATCH 6/7] drm/rockchip: remove redundant "depends on RESET_CONTROLLER" Masahiro Yamada
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-05 11:15 UTC (permalink / raw)
  To: linux-kernel, Philipp Zabel
  Cc: Masahiro Yamada, dri-devel, Benjamin Gaignard, David Airlie,
	Vincent Abriou

RESET_CONTROLLER should be select'ed by SoCs that support reset
controllers.  Use "depends on RESET_CONTROLLER" to describe dependency
between two drivers.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/gpu/drm/sti/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
index fbccc10..27daa8f 100644
--- a/drivers/gpu/drm/sti/Kconfig
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -1,7 +1,7 @@
 config DRM_STI
 	tristate "DRM Support for STMicroelectronics SoC stiH41x Series"
-	depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM) && HAVE_DMA_ATTRS
-	select RESET_CONTROLLER
+	depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM) && \
+			HAVE_DMA_ATTRS && RESET_CONTROLLER
 	select DRM_KMS_HELPER
 	select DRM_GEM_CMA_HELPER
 	select DRM_KMS_CMA_HELPER
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [RFC PATCH 6/7] drm/rockchip: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 11:15 [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Masahiro Yamada
                   ` (4 preceding siblings ...)
  2015-11-05 11:15 ` [RFC PATCH 5/7] drm/sti: replace "select RESET_CONTROLLER" with "depends on ..." Masahiro Yamada
@ 2015-11-05 11:15 ` Masahiro Yamada
  2015-11-05 11:15 ` [RFC PATCH 7/7] drm/tegra: tegra: " Masahiro Yamada
  2015-11-05 14:49 ` [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Arnd Bergmann
  7 siblings, 0 replies; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-05 11:15 UTC (permalink / raw)
  To: linux-kernel, Philipp Zabel
  Cc: Masahiro Yamada, Mark Yao, Heiko Stuebner, dri-devel,
	linux-rockchip, David Airlie, linux-arm-kernel

ARCH_ROCKCHIP selects RESET_CONTROLLER.
The dependency "depends on RESET_CONTROLLER" is already met.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/gpu/drm/rockchip/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 35215f6..cb21e38 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -1,7 +1,6 @@
 config DRM_ROCKCHIP
 	tristate "DRM Support for Rockchip"
 	depends on DRM && ROCKCHIP_IOMMU
-	depends on RESET_CONTROLLER
 	select DRM_KMS_HELPER
 	select DRM_KMS_FB_HELPER
 	select DRM_PANEL
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [RFC PATCH 7/7] drm/tegra: tegra: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 11:15 [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Masahiro Yamada
                   ` (5 preceding siblings ...)
  2015-11-05 11:15 ` [RFC PATCH 6/7] drm/rockchip: remove redundant "depends on RESET_CONTROLLER" Masahiro Yamada
@ 2015-11-05 11:15 ` Masahiro Yamada
  2015-11-05 14:49 ` [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Arnd Bergmann
  7 siblings, 0 replies; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-05 11:15 UTC (permalink / raw)
  To: linux-kernel, Philipp Zabel
  Cc: Masahiro Yamada, Terje Bergström, Thierry Reding,
	Stephen Warren, dri-devel, linux-tegra, Alexandre Courbot,
	David Airlie

ARCH_TEGRA selects RESET_CONTROLLER.
The dependency "depends on RESET_CONTROLLER" is already met.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/gpu/drm/tegra/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig
index 74d9d62..a188994 100644
--- a/drivers/gpu/drm/tegra/Kconfig
+++ b/drivers/gpu/drm/tegra/Kconfig
@@ -3,7 +3,6 @@ config DRM_TEGRA
 	depends on ARCH_TEGRA || (ARM && COMPILE_TEST)
 	depends on COMMON_CLK
 	depends on DRM
-	depends on RESET_CONTROLLER
 	select DRM_KMS_HELPER
 	select DRM_MIPI_DSI
 	select DRM_PANEL
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 11:15 ` [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER" Masahiro Yamada
@ 2015-11-05 11:28   ` Mark Brown
  2015-11-05 12:11     ` Masahiro Yamada
  0 siblings, 1 reply; 25+ messages in thread
From: Mark Brown @ 2015-11-05 11:28 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kernel, Philipp Zabel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

On Thu, Nov 05, 2015 at 08:15:23PM +0900, Masahiro Yamada wrote:
> ARCH_SUNXI selects RESET_CONTROLLER.
> The dependency "depends on RESET_CONTROLLER" is already met.

No, it isn't.

>  config SPI_SUN6I
>  	tristate "Allwinner A31 SPI controller"
>  	depends on ARCH_SUNXI || COMPILE_TEST
> -	depends on RESET_CONTROLLER

The dependency is on ARCH_SUNXI || COMPILE_TEST which is not the same as
ARCH_SUNXI.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 3/7] spi: tegra: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 11:15 ` [RFC PATCH 3/7] spi: tegra: " Masahiro Yamada
@ 2015-11-05 11:50   ` Mark Brown
  2015-11-06  6:02     ` Masahiro Yamada
  0 siblings, 1 reply; 25+ messages in thread
From: Mark Brown @ 2015-11-05 11:50 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kernel, Philipp Zabel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

On Thu, Nov 05, 2015 at 08:15:24PM +0900, Masahiro Yamada wrote:
> ARCH_TEGRA selects RESET_CONTROLLER.
> The dependency "depends on RESET_CONTROLLER" is already met.

>  	tristate "NVIDIA Tegra114 SPI Controller"
>  	depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
> -	depends on RESET_CONTROLLER && HAS_DMA
> +	depends on HAS_DMA

Again, this driver doesn't depend on ARCH_TEGRA.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 11:28   ` Mark Brown
@ 2015-11-05 12:11     ` Masahiro Yamada
  2015-11-05 12:20       ` Mark Brown
  0 siblings, 1 reply; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-05 12:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux Kernel Mailing List, Philipp Zabel, linux-spi

2015-11-05 20:28 GMT+09:00 Mark Brown <broonie@kernel.org>:
> On Thu, Nov 05, 2015 at 08:15:23PM +0900, Masahiro Yamada wrote:
>> ARCH_SUNXI selects RESET_CONTROLLER.
>> The dependency "depends on RESET_CONTROLLER" is already met.
>
> No, it isn't.
>
>>  config SPI_SUN6I
>>       tristate "Allwinner A31 SPI controller"
>>       depends on ARCH_SUNXI || COMPILE_TEST
>> -     depends on RESET_CONTROLLER
>
> The dependency is on ARCH_SUNXI || COMPILE_TEST which is not the same as
> ARCH_SUNXI.


The compile test of this driver should pass even if RESET_CONTROLLER
is not defined.
So, it does not matter for COMPILE_TEST.




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 12:11     ` Masahiro Yamada
@ 2015-11-05 12:20       ` Mark Brown
  2015-11-05 12:32         ` Masahiro Yamada
  0 siblings, 1 reply; 25+ messages in thread
From: Mark Brown @ 2015-11-05 12:20 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Linux Kernel Mailing List, Philipp Zabel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

On Thu, Nov 05, 2015 at 09:11:47PM +0900, Masahiro Yamada wrote:
> 2015-11-05 20:28 GMT+09:00 Mark Brown <broonie@kernel.org>:

> > The dependency is on ARCH_SUNXI || COMPILE_TEST which is not the same as
> > ARCH_SUNXI.

> The compile test of this driver should pass even if RESET_CONTROLLER
> is not defined.
> So, it does not matter for COMPILE_TEST.

If that is the case then the change here is that the dependency on
RESET_CONTROLLER is just redundant which isn't what the commit message
says.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 12:20       ` Mark Brown
@ 2015-11-05 12:32         ` Masahiro Yamada
  2015-11-05 15:05           ` Mark Brown
  0 siblings, 1 reply; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-05 12:32 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux Kernel Mailing List, Philipp Zabel, linux-spi

2015-11-05 21:20 GMT+09:00 Mark Brown <broonie@kernel.org>:
> On Thu, Nov 05, 2015 at 09:11:47PM +0900, Masahiro Yamada wrote:
>> 2015-11-05 20:28 GMT+09:00 Mark Brown <broonie@kernel.org>:
>
>> > The dependency is on ARCH_SUNXI || COMPILE_TEST which is not the same as
>> > ARCH_SUNXI.
>
>> The compile test of this driver should pass even if RESET_CONTROLLER
>> is not defined.
>> So, it does not matter for COMPILE_TEST.
>
> If that is the case then the change here is that the dependency on
> RESET_CONTROLLER is just redundant which isn't what the commit message
> says.

For compile test, right, "depends on RESET_CONTROLLER" is
redundant in the first place.

For run-time on real SoCs,the driver failed at the following point
without the reset-controller sub-system.


    sspi->rstc = devm_reset_control_get(&pdev->dev, NULL);
    if (IS_ERR(sspi->rstc)) {
            dev_err(&pdev->dev, "Couldn't get reset controller\n");
            ret = PTR_ERR(sspi->rstc);
            goto err_free_master;
    }




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 4/7] pinctrl: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 11:15 ` [RFC PATCH 4/7] pinctrl: sunxi: " Masahiro Yamada
@ 2015-11-05 13:40   ` Linus Walleij
  2015-11-05 14:06     ` Linus Walleij
  2015-11-16  3:40     ` Masahiro Yamada
  0 siblings, 2 replies; 25+ messages in thread
From: Linus Walleij @ 2015-11-05 13:40 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kernel, Philipp Zabel, Vishnu Patekar, Hans de Goede,
	linux-gpio, Chen-Yu Tsai, Maxime Ripard, linux-arm-kernel

On Thu, Nov 5, 2015 at 12:15 PM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:

> ARCH_SUNXI selects RESET_CONTROLLER.
> The dependency "depends on RESET_CONTROLLER" is already met.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

NACK, this pin controller needs that as dependency, I don't worry
that it's overspecified.

They both do this:
#include <linux/reset.h>

And the object should specify its dependencies, not rely on them
being implicitly available.

The dep is there for human readers too, not just machines. And to
them, this is helpful information.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 4/7] pinctrl: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 13:40   ` Linus Walleij
@ 2015-11-05 14:06     ` Linus Walleij
  2015-11-16  3:40     ` Masahiro Yamada
  1 sibling, 0 replies; 25+ messages in thread
From: Linus Walleij @ 2015-11-05 14:06 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-kernel, Philipp Zabel, Vishnu Patekar, Hans de Goede,
	linux-gpio, Chen-Yu Tsai, Maxime Ripard, linux-arm-kernel

On Thu, Nov 5, 2015 at 2:40 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Thu, Nov 5, 2015 at 12:15 PM, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>
>> ARCH_SUNXI selects RESET_CONTROLLER.
>> The dependency "depends on RESET_CONTROLLER" is already met.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> NACK, this pin controller needs that as dependency, I don't worry
> that it's overspecified.
>
> They both do this:
> #include <linux/reset.h>

You could of course replace the depends with select in this
file so the menu options don't get hidden, as seems to be
the problem as described in 0/7.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option
  2015-11-05 11:15 [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Masahiro Yamada
                   ` (6 preceding siblings ...)
  2015-11-05 11:15 ` [RFC PATCH 7/7] drm/tegra: tegra: " Masahiro Yamada
@ 2015-11-05 14:49 ` Arnd Bergmann
  2015-11-06  5:58   ` Masahiro Yamada
  7 siblings, 1 reply; 25+ messages in thread
From: Arnd Bergmann @ 2015-11-05 14:49 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Masahiro Yamada, linux-kernel, Philipp Zabel, linux-mips, kernel,
	David Airlie, Catalin Marinas, Linus Walleij, Will Deacon,
	dri-devel, Russell King, Thierry Reding, Benjamin Gaignard,
	Heiko Stuebner, Alexandre Courbot, Michael Turquette,
	Daniel Lezcano, linux-rockchip, Chen-Yu Tsai, Maxime Coquelin,
	Sebastian Hesselbarth, Stephen Warren, Haojian Zhuang,
	Hans de Goede, Mark Brown, Jens Kuske, linux-tegra,
	Terje Bergström, Vincent Abriou, Mark Yao, Barry Song,
	Vishnu Patekar, Eric Miao, linux-gpio, Srinivas Kandagatla,
	Patrice Chotard, Ralf Baechle, linux-spi, Tuomas Tynkkynen,
	Sascha Hauer, Maxime Ripard, Shawn Guo

On Thursday 05 November 2015 20:15:21 Masahiro Yamada wrote:
> When I was implementing a new reset controller for my SoCs,
> I struggled to make my sub-menu shown under the reset
> controller menu.
> I noticed the Kconfig in reset sub-system are screwed up due to two
> config options (ARCH_HAS_RESET_CONTROLLER and RESET_CONTROLLER).
> 
> I think only the former should be select'ed by relevant SoCs,
> but in fact the latter is also select'ed here and there.
> Mixing "select" to a user-configurable option is a mess.
> 
> Finally, I started to wonder whether it could be more simpler?
> 
> The first patch drops ARCH_HAS_RESET_CONTROLLER.
> RESET_CONTROLLER should be directly selected by SoCs.
> 
> The rest of this series are minor clean ups in other
> sub-systems.
> I can postpone them if changes over cross sub-systems
> are not preferred.

Thanks a lot for picking up this topic! It has been annoying me
for a while and I have submitted an experimental patch some time
ago, but not finished it myself.

For some reason, I only see a subset of your patches here (patch 1, 4 and 6),
so I don't know exactly what you did. For reference, you can find
my original patch below. Please check if I did things that your
series doesn't do, and whether those are still needed.

	Arnd

commit 7983ffe5e07a5aac0c9bdd657858e3b2b9842b30
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue Feb 24 15:30:30 2015 +0100

    rework RESET_CONTROLLER handling

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2f5f6d0b09a6..ab137ae8dcc8 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -319,6 +319,7 @@ choice
 
 config ARCH_MULTIPLATFORM
 	bool "Allow multiple platforms to be selected"
+	select ARCH_HAS_RESET_CONTROLLER
 	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select ARM_HAS_SG_CHAIN
 	select ARM_PATCH_PHYS_VIRT
diff --git a/arch/arm/mach-berlin/Kconfig b/arch/arm/mach-berlin/Kconfig
index 344434ca366c..2dc8f3df39e6 100644
--- a/arch/arm/mach-berlin/Kconfig
+++ b/arch/arm/mach-berlin/Kconfig
@@ -1,6 +1,5 @@
 menuconfig ARCH_BERLIN
 	bool "Marvell Berlin SoCs" if ARCH_MULTI_V7
-	select ARCH_HAS_RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_GIC
 	select DW_APB_ICTL
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index 8ceda2844c4f..1b1134adc188 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -58,7 +58,6 @@ config HAVE_IMX_MMDC
 
 config HAVE_IMX_SRC
 	def_bool y if SMP
-	select ARCH_HAS_RESET_CONTROLLER
 
 config IMX_HAVE_IOMUX_V1
 	bool
diff --git a/arch/arm/mach-mmp/Kconfig b/arch/arm/mach-mmp/Kconfig
index 4773fe1d8b3f..116502d776ab 100644
--- a/arch/arm/mach-mmp/Kconfig
+++ b/arch/arm/mach-mmp/Kconfig
@@ -113,6 +113,7 @@ config MACH_MMP_DT
 	select PINCTRL_SINGLE
 	select COMMON_CLK
 	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select CPU_MOHAWK
 	help
 	  Include support for Marvell MMP2 based platforms using
@@ -125,6 +126,7 @@ config MACH_MMP2_DT
 	select PINCTRL
 	select PINCTRL_SINGLE
 	select ARCH_HAS_RESET_CONTROLLER
+	select RESET_CONTROLLER
 	select CPU_PJ4
 	help
 	  Include support for Marvell MMP2 based platforms using
diff --git a/arch/arm/mach-prima2/Kconfig b/arch/arm/mach-prima2/Kconfig
index 9ab8932403e5..00adfc4a5cd6 100644
--- a/arch/arm/mach-prima2/Kconfig
+++ b/arch/arm/mach-prima2/Kconfig
@@ -1,12 +1,12 @@
 menuconfig ARCH_SIRF
 	bool "CSR SiRF" if ARCH_MULTI_V7
-	select ARCH_HAS_RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select GENERIC_IRQ_CHIP
 	select NO_IOPORT_MAP
 	select REGMAP
 	select PINCTRL
 	select PINCTRL_SIRF
+	select RESET_CONTROLLER
 	help
 	  Support for CSR SiRFprimaII/Marco/Polo platforms
 
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index ae4eb7cc4bcc..17d2df427c3c 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -2,7 +2,6 @@ config ARCH_ROCKCHIP
 	bool "Rockchip RK2928 and RK3xxx SOCs" if ARCH_MULTI_V7
 	select PINCTRL
 	select PINCTRL_ROCKCHIP
-	select ARCH_HAS_RESET_CONTROLLER
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_AMBA
 	select ARM_GIC
@@ -12,6 +11,7 @@ config ARCH_ROCKCHIP
 	select HAVE_ARM_TWD if SMP
 	select DW_APB_TIMER_OF
 	select REGULATOR if PM
+	select RESET_CONTROLLER
 	select ROCKCHIP_TIMER
 	select ARM_GLOBAL_TIMER
 	select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig
index 125865daaf17..8092f4f84ee6 100644
--- a/arch/arm/mach-sti/Kconfig
+++ b/arch/arm/mach-sti/Kconfig
@@ -6,7 +6,6 @@ menuconfig ARCH_STI
 	select PINCTRL
 	select PINCTRL_ST
 	select MFD_SYSCON
-	select ARCH_HAS_RESET_CONTROLLER
 	select HAVE_ARM_SCU if SMP
 	select ARCH_REQUIRE_GPIOLIB
 	select ARM_ERRATA_754322
@@ -14,7 +13,6 @@ menuconfig ARCH_STI
 	select ARM_ERRATA_775420
 	select PL310_ERRATA_753970 if CACHE_L2X0
 	select PL310_ERRATA_769419 if CACHE_L2X0
-	select RESET_CONTROLLER
 	help
 	  Include support for STiH41x SOCs like STiH415/416 using the device tree
 	  for discovery
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 4efe2d43a126..60b58ca02162 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -1,7 +1,6 @@
 menuconfig ARCH_SUNXI
 	bool "Allwinner SoCs" if ARCH_MULTI_V7
 	select ARCH_REQUIRE_GPIOLIB
-	select ARCH_HAS_RESET_CONTROLLER
 	select CLKSRC_MMIO
 	select GENERIC_IRQ_CHIP
 	select PINCTRL
diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index c2be98f38e73..b1c39eed19f1 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -45,7 +45,7 @@ extern void __init sun6i_reset_init(void);
 static void __init sun6i_timer_init(void)
 {
 	of_clk_init(NULL);
-	if (IS_ENABLED(CONFIG_RESET_CONTROLLER))
+	if (IS_ENABLED(CONFIG_RESET_SUNXI))
 		sun6i_reset_init();
 	clocksource_probe();
 }
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 0fa4c5f8b1be..269efaaa6843 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -9,7 +9,6 @@ menuconfig ARCH_TEGRA
 	select HAVE_ARM_TWD if SMP
 	select PINCTRL
 	select PM_OPP
-	select ARCH_HAS_RESET_CONTROLLER
 	select RESET_CONTROLLER
 	select SOC_BUS
 	select USB_ULPI if USB_PHY
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index e6cd1a32025a..b93b75bf0a2d 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -159,7 +159,6 @@ config DMA_SUN4I
 config DMA_SUN6I
 	tristate "Allwinner A31 SoCs DMA support"
 	depends on MACH_SUN6I || MACH_SUN8I || COMPILE_TEST
-	depends on RESET_CONTROLLER
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
 	help
diff --git a/drivers/gpu/drm/rockchip/Kconfig b/drivers/gpu/drm/rockchip/Kconfig
index 35215f6867d3..cb21e3821244 100644
--- a/drivers/gpu/drm/rockchip/Kconfig
+++ b/drivers/gpu/drm/rockchip/Kconfig
@@ -1,7 +1,6 @@
 config DRM_ROCKCHIP
 	tristate "DRM Support for Rockchip"
 	depends on DRM && ROCKCHIP_IOMMU
-	depends on RESET_CONTROLLER
 	select DRM_KMS_HELPER
 	select DRM_KMS_FB_HELPER
 	select DRM_PANEL
diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
index e3aa5afc0244..8aeb4cdd76e5 100644
--- a/drivers/gpu/drm/sti/Kconfig
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -1,7 +1,6 @@
 config DRM_STI
 	tristate "DRM Support for STMicroelectronics SoC stiH41x Series"
 	depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM) && HAVE_DMA_ATTRS
-	select RESET_CONTROLLER
 	select DRM_KMS_HELPER
 	select DRM_GEM_CMA_HELPER
 	select DRM_KMS_CMA_HELPER
diff --git a/drivers/gpu/drm/tegra/Kconfig b/drivers/gpu/drm/tegra/Kconfig
index 63ebb154b9b5..bbf5a4b7e0b6 100644
--- a/drivers/gpu/drm/tegra/Kconfig
+++ b/drivers/gpu/drm/tegra/Kconfig
@@ -3,7 +3,6 @@ config DRM_TEGRA
 	depends on ARCH_TEGRA || (ARM && COMPILE_TEST)
 	depends on COMMON_CLK
 	depends on DRM
-	depends on RESET_CONTROLLER
 	select DRM_KMS_HELPER
 	select DRM_MIPI_DSI
 	select DRM_PANEL
diff --git a/drivers/gpu/ipu-v3/Kconfig b/drivers/gpu/ipu-v3/Kconfig
index aefdff95356d..08766c6e7856 100644
--- a/drivers/gpu/ipu-v3/Kconfig
+++ b/drivers/gpu/ipu-v3/Kconfig
@@ -1,7 +1,6 @@
 config IMX_IPUV3_CORE
 	tristate "IPUv3 core support"
 	depends on SOC_IMX5 || SOC_IMX6Q || ARCH_MULTIPLATFORM
-	depends on RESET_CONTROLLER
 	select GENERIC_IRQ_CHIP
 	help
 	  Choose this if you have a i.MX5/6 system and want to use the Image
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index e24c2b680b47..775134dc7fc3 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -886,7 +886,6 @@ config I2C_STU300
 
 config I2C_SUN6I_P2WI
 	tristate "Allwinner sun6i internal P2WI controller"
-	depends on RESET_CONTROLLER
 	depends on MACH_SUN6I || COMPILE_TEST
 	help
 	  If you say yes to this option, support will be included for the
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 7eb5859dd035..53d92382030f 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -17,7 +17,8 @@ config GENERIC_PHY
 
 config PHY_BERLIN_USB
 	tristate "Marvell Berlin USB PHY Driver"
-	depends on ARCH_BERLIN && RESET_CONTROLLER && HAS_IOMEM && OF
+	depends on ARCH_BERLIN || COMPILE_TEST
+	depends on HAS_IOMEM && OF
 	select GENERIC_PHY
 	help
 	  Enable this to support the USB PHY on Marvell Berlin SoCs.
@@ -218,7 +219,6 @@ config PHY_MT65XX_USB3
 config PHY_SUN4I_USB
 	tristate "Allwinner sunxi SoC USB PHY driver"
 	depends on ARCH_SUNXI && HAS_IOMEM && OF
-	depends on RESET_CONTROLLER
 	depends on EXTCON
 	depends on POWER_SUPPLY
 	select GENERIC_PHY
@@ -232,7 +232,6 @@ config PHY_SUN4I_USB
 config PHY_SUN9I_USB
 	tristate "Allwinner sun9i SoC USB PHY driver"
 	depends on ARCH_SUNXI && HAS_IOMEM && OF
-	depends on RESET_CONTROLLER
 	select GENERIC_PHY
 	help
 	  Enable this to support the transceiver that is part of Allwinner
@@ -342,7 +341,6 @@ config PHY_XGENE
 
 config PHY_STIH407_USB
 	tristate "STMicroelectronics USB2 picoPHY driver for STiH407 family"
-	depends on RESET_CONTROLLER
 	depends on ARCH_STI || COMPILE_TEST
 	select GENERIC_PHY
 	help
diff --git a/drivers/pinctrl/sunxi/Kconfig b/drivers/pinctrl/sunxi/Kconfig
index e68fd951129a..50bd2e37aaeb 100644
--- a/drivers/pinctrl/sunxi/Kconfig
+++ b/drivers/pinctrl/sunxi/Kconfig
@@ -27,7 +27,6 @@ config PINCTRL_SUN6I_A31S
 
 config PINCTRL_SUN6I_A31_R
 	def_bool MACH_SUN6I
-	depends on RESET_CONTROLLER
 	select PINCTRL_SUNXI_COMMON
 
 config PINCTRL_SUN7I_A20
@@ -48,7 +47,6 @@ config PINCTRL_SUN8I_A83T
 
 config PINCTRL_SUN8I_A23_R
 	def_bool MACH_SUN8I
-	depends on RESET_CONTROLLER
 	select PINCTRL_SUNXI_COMMON
 
 config PINCTRL_SUN9I_A80
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index 0615f50a14cd..12026a1893b5 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -1,15 +1,24 @@
-config ARCH_HAS_RESET_CONTROLLER
+config RESET_CONTROLLER
 	bool
 
-menuconfig RESET_CONTROLLER
-	bool "Reset Controller Support"
-	default y if ARCH_HAS_RESET_CONTROLLER
-	help
-	  Generic Reset Controller support.
+menu "Reset Controller Support"
+	depends on ARCH_HAS_RESET_CONTROLLER || COMPILE_TEST
 
-	  This framework is designed to abstract reset handling of devices
-	  via GPIOs or SoC-internal reset controller modules.
+config RESET_SOCFPGA
+	bool "Altera SOCFPGA reset controller" if COMPILE_TEST
+	default ARCH_SOCFPGA
+	select RESET_CONTROLLER
 
-	  If unsure, say no.
+config RESET_BERLIN
+	bool "Marvell Berlin reset controller" if COMPILE_TEST
+	default ARCH_BERLIN
+	select RESET_CONTROLLER
+
+config RESET_SUNXI
+	bool "Allwinner reset controller" if COMPILE_TEST
+	default ARCH_SUNXI
+	select RESET_CONTROLLER
 
 source "drivers/reset/sti/Kconfig"
+
+endmenu
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
index 85d5904e5480..e05aeffb692f 100644
--- a/drivers/reset/Makefile
+++ b/drivers/reset/Makefile
@@ -1,8 +1,8 @@
 obj-$(CONFIG_RESET_CONTROLLER) += core.o
 obj-$(CONFIG_ARCH_LPC18XX) += reset-lpc18xx.o
-obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
-obj-$(CONFIG_ARCH_BERLIN) += reset-berlin.o
-obj-$(CONFIG_ARCH_SUNXI) += reset-sunxi.o
-obj-$(CONFIG_ARCH_STI) += sti/
+obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
+obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o
+obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
+obj-$(CONFIG_RESET_STI_SYSCFG) += sti/
 obj-$(CONFIG_ARCH_ZYNQ) += reset-zynq.o
 obj-$(CONFIG_ATH79) += reset-ath79.o
diff --git a/drivers/reset/sti/Kconfig b/drivers/reset/sti/Kconfig
index f8c15a37fb35..ef9bb8675577 100644
--- a/drivers/reset/sti/Kconfig
+++ b/drivers/reset/sti/Kconfig
@@ -1,19 +1,19 @@
-if ARCH_STI
+if ARCH_STI || COMPILE_TEST
 
-config STI_RESET_SYSCFG
+config RESET_STI_SYSCFG
 	bool
 	select RESET_CONTROLLER
 
-config STIH415_RESET
-	bool
-	select STI_RESET_SYSCFG
+config RESET_STIH415
+	bool "STmicroelectronics STiH415 reset controller" if COMPILE_TEST
+	select RESET_STI_SYSCFG
 
-config STIH416_RESET
-	bool
-	select STI_RESET_SYSCFG
+config RESET_STIH416
+	bool "STmicroelectronics STiH416 reset controller" if COMPILE_TEST
+	select RESET_STI_SYSCFG
 
-config STIH407_RESET
-	bool
-	select STI_RESET_SYSCFG
+config RESET_STIH407
+	bool "STmicroelectronics STiH407 reset controller" if COMPILE_TEST
+	select RESET_STI_SYSCFG
 
 endif
diff --git a/drivers/reset/sti/Makefile b/drivers/reset/sti/Makefile
index dc85dfbe56a9..445bdddf45b9 100644
--- a/drivers/reset/sti/Makefile
+++ b/drivers/reset/sti/Makefile
@@ -1,5 +1,5 @@
-obj-$(CONFIG_STI_RESET_SYSCFG) += reset-syscfg.o
+obj-$(CONFIG_RESET_STI_SYSCFG) += reset-syscfg.o
 
-obj-$(CONFIG_STIH415_RESET) += reset-stih415.o
-obj-$(CONFIG_STIH416_RESET) += reset-stih416.o
-obj-$(CONFIG_STIH407_RESET) += reset-stih407.o
+obj-$(CONFIG_RESET_STIH415) += reset-stih415.o
+obj-$(CONFIG_RESET_STIH416) += reset-stih416.o
+obj-$(CONFIG_RESET_STIH407) += reset-stih407.o
diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
index 9d5068248aa0..511c40e08780 100644
--- a/drivers/soc/mediatek/Kconfig
+++ b/drivers/soc/mediatek/Kconfig
@@ -13,7 +13,6 @@ config MTK_INFRACFG
 config MTK_PMIC_WRAP
 	tristate "MediaTek PMIC Wrapper Support"
 	depends on ARCH_MEDIATEK
-	depends on RESET_CONTROLLER
 	select REGMAP
 	help
 	  Say yes here to add support for MediaTek PMIC Wrapper found
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index b046fd94346a..4a62428836f3 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -527,7 +527,6 @@ config SPI_SH_HSPI
 config SPI_SIRF
 	tristate "CSR SiRFprimaII SPI controller"
 	depends on SIRF_DMA
-	depends on RESET_CONTROLLER
 	select SPI_BITBANG
 	help
 	  SPI driver for CSR SiRFprimaII SoCs
@@ -548,7 +547,6 @@ config SPI_SUN4I
 config SPI_SUN6I
 	tristate "Allwinner A31 SPI controller"
 	depends on ARCH_SUNXI || COMPILE_TEST
-	depends on RESET_CONTROLLER
 	help
 	  This enables using the SPI controller on the Allwinner A31 SoCs.
 
@@ -562,7 +560,7 @@ config SPI_MXS
 config SPI_TEGRA114
 	tristate "NVIDIA Tegra114 SPI Controller"
 	depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
-	depends on RESET_CONTROLLER && HAS_DMA
+	depends on HAS_DMA
 	help
 	  SPI driver for NVIDIA Tegra114 SPI Controller interface. This controller
 	  is different than the older SoCs SPI controller and also register interface
@@ -571,7 +569,6 @@ config SPI_TEGRA114
 config SPI_TEGRA20_SFLASH
 	tristate "Nvidia Tegra20 Serial flash Controller"
 	depends on ARCH_TEGRA || COMPILE_TEST
-	depends on RESET_CONTROLLER
 	help
 	  SPI driver for Nvidia Tegra20 Serial flash Controller interface.
 	  The main usecase of this controller is to use spi flash as boot
@@ -580,7 +577,7 @@ config SPI_TEGRA20_SFLASH
 config SPI_TEGRA20_SLINK
 	tristate "Nvidia Tegra20/Tegra30 SLINK Controller"
 	depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
-	depends on RESET_CONTROLLER && HAS_DMA
+	depends on HAS_DMA
 	help
 	  SPI driver for Nvidia Tegra20/Tegra30 SLINK Controller interface.
 
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index c463c89b90ef..2e7524f0f3f7 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -205,7 +205,6 @@ config SPEAR_THERMAL
 config ROCKCHIP_THERMAL
 	tristate "Rockchip thermal driver"
 	depends on ARCH_ROCKCHIP || COMPILE_TEST
-	depends on RESET_CONTROLLER
 	help
 	  Rockchip thermal driver provides support for Temperature sensor
 	  ADC (TS-ADC) found on Rockchip SoCs. It supports one critical
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 173132416170..7acb038fd26a 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -140,7 +140,6 @@ config USB_ISP1301
 config USB_MSM_OTG
 	tristate "Qualcomm on-chip USB OTG controller support"
 	depends on (USB || USB_GADGET) && (ARCH_QCOM || COMPILE_TEST)
-	depends on RESET_CONTROLLER
 	depends on EXTCON
 	select USB_PHY
 	help
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 7f65f9cff951..56c389347096 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -40,38 +40,49 @@ struct reset_control *of_reset_control_get(struct device_node *node,
 
 #else
 
+#include <linux/device.h>
+#include <linux/of.h>
+
+static inline int __must_check device_reset(struct device *dev)
+{
+	return -ENOSYS;
+}
+
 static inline int reset_control_reset(struct reset_control *rstc)
 {
-	WARN_ON(1);
+	WARN_ON(rstc != NULL);
 	return 0;
 }
 
 static inline int reset_control_assert(struct reset_control *rstc)
 {
-	WARN_ON(1);
+	WARN_ON(rstc != NULL);
 	return 0;
 }
 
 static inline int reset_control_deassert(struct reset_control *rstc)
 {
-	WARN_ON(1);
+	WARN_ON(rstc != NULL);
 	return 0;
 }
 
 static inline int reset_control_status(struct reset_control *rstc)
 {
-	WARN_ON(1);
+	WARN_ON(rstc != NULL);
 	return 0;
 }
 
 static inline void reset_control_put(struct reset_control *rstc)
 {
-	WARN_ON(1);
+	WARN_ON(rstc != NULL);
 }
 
 static inline int device_reset_optional(struct device *dev)
 {
-	return -ENOSYS;
+	if (of_property_read_bool(dev->of_node, "resets"))
+		return -ENOSYS;
+
+	return 0;
 }
 
 static inline struct reset_control *__must_check reset_control_get(
@@ -88,16 +99,21 @@ static inline struct reset_control *__must_check devm_reset_control_get(
 	return ERR_PTR(-EINVAL);
 }
 
+/*
+ * We intentionally return NULL here when no resets are specified
+ * or when building without DT, which is interpreted as 'success'
+ * if reset controller support is left out from the kernel.
+ */
 static inline struct reset_control *reset_control_get_optional(
 					struct device *dev, const char *id)
 {
-	return ERR_PTR(-ENOSYS);
+	return ERR_PTR(device_reset_optional(dev));
 }
 
 static inline struct reset_control *devm_reset_control_get_optional(
 					struct device *dev, const char *id)
 {
-	return ERR_PTR(-ENOSYS);
+	return reset_control_get_optional(dev, id);
 }
 
 static inline struct reset_control *of_reset_control_get(
diff --git a/sound/soc/tegra/Kconfig b/sound/soc/tegra/Kconfig
index a6768f832c6f..70f58bd43a56 100644
--- a/sound/soc/tegra/Kconfig
+++ b/sound/soc/tegra/Kconfig
@@ -2,7 +2,6 @@ config SND_SOC_TEGRA
 	tristate "SoC Audio for the Tegra System-on-Chip"
 	depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
 	depends on COMMON_CLK
-	depends on RESET_CONTROLLER
 	select REGMAP_MMIO
 	select SND_SOC_GENERIC_DMAENGINE_PCM
 	help


^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 12:32         ` Masahiro Yamada
@ 2015-11-05 15:05           ` Mark Brown
  2015-11-06  6:00             ` Masahiro Yamada
  0 siblings, 1 reply; 25+ messages in thread
From: Mark Brown @ 2015-11-05 15:05 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Linux Kernel Mailing List, Philipp Zabel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 393 bytes --]

On Thu, Nov 05, 2015 at 09:32:15PM +0900, Masahiro Yamada wrote:

> For compile test, right, "depends on RESET_CONTROLLER" is
> redundant in the first place.

> For run-time on real SoCs,the driver failed at the following point
> without the reset-controller sub-system.

Your changelog needs to say this clearly, right now what it's saying
clearly doesn't correspond to what the change does.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option
  2015-11-05 14:49 ` [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Arnd Bergmann
@ 2015-11-06  5:58   ` Masahiro Yamada
  2015-11-06  9:29     ` Arnd Bergmann
  0 siblings, 1 reply; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-06  5:58 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, linux-mips, kernel, David Airlie,
	Catalin Marinas, Linus Walleij, Will Deacon, dri-devel,
	Patrice Chotard, Thierry Reding, Benjamin Gaignard,
	Heiko Stuebner, Alexandre Courbot, Russell King, Daniel Lezcano,
	open list:ARM/Rockchip SoC...,
	Chen-Yu Tsai, Mark Yao, Terje Bergström,
	Sebastian Hesselbarth, Sascha Hauer, Stephen Warren,
	Haojian Zhuang, Hans de Goede, Mark Brown, Jens Kuske,
	linux-tegra, Michael Turquette, Vincent Abriou, Maxime Coquelin,
	Barry Song, Vishnu Patekar, Eric Miao, linux-gpio,
	Srinivas Kandagatla, Linux Kernel Mailing List, Ralf Baechle,
	linux-spi, Tuomas Tynkkynen, Philipp Zabel, Maxime Ripard,
	Shawn Guo

Hi Arnd,



2015-11-05 23:49 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> On Thursday 05 November 2015 20:15:21 Masahiro Yamada wrote:
>> When I was implementing a new reset controller for my SoCs,
>> I struggled to make my sub-menu shown under the reset
>> controller menu.
>> I noticed the Kconfig in reset sub-system are screwed up due to two
>> config options (ARCH_HAS_RESET_CONTROLLER and RESET_CONTROLLER).
>>
>> I think only the former should be select'ed by relevant SoCs,
>> but in fact the latter is also select'ed here and there.
>> Mixing "select" to a user-configurable option is a mess.
>>
>> Finally, I started to wonder whether it could be more simpler?
>>
>> The first patch drops ARCH_HAS_RESET_CONTROLLER.
>> RESET_CONTROLLER should be directly selected by SoCs.
>>
>> The rest of this series are minor clean ups in other
>> sub-systems.
>> I can postpone them if changes over cross sub-systems
>> are not preferred.
>
> Thanks a lot for picking up this topic! It has been annoying me
> for a while and I have submitted an experimental patch some time
> ago, but not finished it myself.
>
> For some reason, I only see a subset of your patches here (patch 1, 4 and 6),
> so I don't know exactly what you did.

All the patches CCed linux-kernel@vger.kernel.org,
so you can dig into LKML log or the following patchwork
https://patchwork.kernel.org/project/LKML/list/




> For reference, you can find
> my original patch below. Please check if I did things that your
> series doesn't do, and whether those are still needed.

Thanks.

Yours looks mostly nice, and this work is worth continuing.
(I am pleased to review it when you submit the next version.)

I have some comments.

[1]
Why is ARCH_HAS_RESET_CONTROLLER select'ed by
ARCH_MULTIPLATFORM, but not by others?
This seems weird.

We do not have such options like
  ARCH_HAS_PINCTRL,  ARCH_HAS_COMMON_CLK...


[2]
The difference is that yours is adding per-driver options such as
RESET_SOCFPGA, RESET_BERLIN, etc.
I think this is a good idea.

But, I notice lowlevel drivers select RESET_CONTROLLER,
for example, RESET_SOCFPGA select RESET_CONTROLLER.

We generally do the opposite in other subsystems, I think.


For example, the whole of clk menu is guarded by "depends on COMMON_CLK".

menu "Common Clock Framework"
         depends on COMMON_CLK

     <bunch of low-level drivers>

endmenu


Likewise for pinctrl.





-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 15:05           ` Mark Brown
@ 2015-11-06  6:00             ` Masahiro Yamada
  2015-11-06 10:21               ` Mark Brown
  0 siblings, 1 reply; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-06  6:00 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux Kernel Mailing List, Philipp Zabel, linux-spi

2015-11-06 0:05 GMT+09:00 Mark Brown <broonie@kernel.org>:
> On Thu, Nov 05, 2015 at 09:32:15PM +0900, Masahiro Yamada wrote:
>
>> For compile test, right, "depends on RESET_CONTROLLER" is
>> redundant in the first place.
>
>> For run-time on real SoCs,the driver failed at the following point
>> without the reset-controller sub-system.
>
> Your changelog needs to say this clearly, right now what it's saying
> clearly doesn't correspond to what the change does.

OK.

This series is RFC and my main focus in on the 1/7.
I will wait for more comments against the first one.


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 3/7] spi: tegra: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 11:50   ` Mark Brown
@ 2015-11-06  6:02     ` Masahiro Yamada
  2015-11-06 10:22       ` Mark Brown
  0 siblings, 1 reply; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-06  6:02 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux Kernel Mailing List, Philipp Zabel, linux-spi

2015-11-05 20:50 GMT+09:00 Mark Brown <broonie@kernel.org>:
> On Thu, Nov 05, 2015 at 08:15:24PM +0900, Masahiro Yamada wrote:
>> ARCH_TEGRA selects RESET_CONTROLLER.
>> The dependency "depends on RESET_CONTROLLER" is already met.
>
>>       tristate "NVIDIA Tegra114 SPI Controller"
>>       depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
>> -     depends on RESET_CONTROLLER && HAS_DMA
>> +     depends on HAS_DMA
>
> Again, this driver doesn't depend on ARCH_TEGRA.

How come?

Sorry, I have not been tracking this sub-system,
so I do not get the "Again".


The prompt says "NVIDIA Tegra114 SPI Controller".

It sounds natural for me that this driver depends on ARCH_TEGRA.
No?



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option
  2015-11-06  5:58   ` Masahiro Yamada
@ 2015-11-06  9:29     ` Arnd Bergmann
  0 siblings, 0 replies; 25+ messages in thread
From: Arnd Bergmann @ 2015-11-06  9:29 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Masahiro Yamada, linux-mips, kernel, David Airlie,
	Catalin Marinas, Linus Walleij, Will Deacon, dri-devel,
	Linux Kernel Mailing List, Thierry Reding, Benjamin Gaignard,
	Heiko Stuebner, Alexandre Courbot, Russell King,
	Michael Turquette, Daniel Lezcano, open list:ARM/Rockchip SoC...,
	Chen-Yu Tsai, Maxime Coquelin, Sebastian Hesselbarth,
	Philipp Zabel, Stephen Warren, Haojian Zhuang, Hans de Goede,
	Mark Brown, Jens Kuske, linux-tegra, Terje Bergström,
	Vincent Abriou, Mark Yao, Barry Song, Vishnu Patekar, Eric Miao,
	linux-gpio, Srinivas Kandagatla, Patrice Chotard, Ralf Baechle,
	linux-spi, Tuomas Tynkkynen, Sascha Hauer, Maxime Ripard,
	Shawn Guo

On Friday 06 November 2015 14:58:04 Masahiro Yamada wrote:
> 2015-11-05 23:49 GMT+09:00 Arnd Bergmann <arnd@arndb.de>:
> [1]
> Why is ARCH_HAS_RESET_CONTROLLER select'ed by
> ARCH_MULTIPLATFORM, but not by others?
> This seems weird.

I tried to avoid having to set this from each platform separately,
and all users of ARCH_HAS_RESET_CONTROLLER on ARM are also
based on ARCH_MULTIPLATFORM. The other platforms are lagging behind
in their conversion and use neither reset controllers not
multiplatform. If anyone wants to make them use reset controllers,
we probably want them to use multiplatform as well.

> We do not have such options like
>   ARCH_HAS_PINCTRL,  ARCH_HAS_COMMON_CLK...

We could of course change it in one direction or another, but it
didn't seem urgent here.

> [2]
> The difference is that yours is adding per-driver options such as
> RESET_SOCFPGA, RESET_BERLIN, etc.
> I think this is a good idea.
> 
> But, I notice lowlevel drivers select RESET_CONTROLLER,
> for example, RESET_SOCFPGA select RESET_CONTROLLER.
> 
> We generally do the opposite in other subsystems, I think.
> 
> 
> For example, the whole of clk menu is guarded by "depends on COMMON_CLK".
> 
> menu "Common Clock Framework"
>          depends on COMMON_CLK
> 
>      <bunch of low-level drivers>
> 
> endmenu
> 
> 
> Likewise for pinctrl.

We can do that too, either way works for me, and we are using both
in other parts of the kernel. REGMAP is an example for another subsystem
that gets selected by each driver that relies on the framework.

The practical difference is only in the case that the subsystem
is enabled (e.g. by using ARCH_MULTIPLATFORM) but all reset drivers
are disabled. A device driver using the API in one case will see
the stubbed-out inline helpers and not contain any object code
that relies on non-NULL return values from them, while in the
other case it calls into the subsystem code to get the same
return value at runtime.

If you volunteer to clean up my patch, feel free to choose between
the two options as you like.

	Arnd

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-06  6:00             ` Masahiro Yamada
@ 2015-11-06 10:21               ` Mark Brown
  0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2015-11-06 10:21 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Linux Kernel Mailing List, Philipp Zabel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 459 bytes --]

On Fri, Nov 06, 2015 at 03:00:04PM +0900, Masahiro Yamada wrote:
> 2015-11-06 0:05 GMT+09:00 Mark Brown <broonie@kernel.org>:

> > Your changelog needs to say this clearly, right now what it's saying
> > clearly doesn't correspond to what the change does.

> OK.

> This series is RFC and my main focus in on the 1/7.
> I will wait for more comments against the first one.

You didn't send that patch to most of the recipients so I've no idea
what that is...

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 3/7] spi: tegra: remove redundant "depends on RESET_CONTROLLER"
  2015-11-06  6:02     ` Masahiro Yamada
@ 2015-11-06 10:22       ` Mark Brown
  0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2015-11-06 10:22 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Linux Kernel Mailing List, Philipp Zabel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 741 bytes --]

On Fri, Nov 06, 2015 at 03:02:57PM +0900, Masahiro Yamada wrote:
> 2015-11-05 20:50 GMT+09:00 Mark Brown <broonie@kernel.org>:
> > On Thu, Nov 05, 2015 at 08:15:24PM +0900, Masahiro Yamada wrote:
> >> ARCH_TEGRA selects RESET_CONTROLLER.
> >> The dependency "depends on RESET_CONTROLLER" is already met.

> >>       tristate "NVIDIA Tegra114 SPI Controller"
> >>       depends on (ARCH_TEGRA && TEGRA20_APB_DMA) || COMPILE_TEST
> >> -     depends on RESET_CONTROLLER && HAS_DMA
> >> +     depends on HAS_DMA

> > Again, this driver doesn't depend on ARCH_TEGRA.

> How come?

> Sorry, I have not been tracking this sub-system,
> so I do not get the "Again".

It's the same issue as your previous patch - there's an || COMPILE_TEST
in there.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 4/7] pinctrl: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-05 13:40   ` Linus Walleij
  2015-11-05 14:06     ` Linus Walleij
@ 2015-11-16  3:40     ` Masahiro Yamada
  2015-11-17 14:03       ` Linus Walleij
  1 sibling, 1 reply; 25+ messages in thread
From: Masahiro Yamada @ 2015-11-16  3:40 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Vishnu Patekar, linux-gpio, linux-kernel, Hans de Goede,
	Chen-Yu Tsai, Philipp Zabel, Maxime Ripard, linux-arm-kernel

Hi Linus

2015-11-05 22:40 GMT+09:00 Linus Walleij <linus.walleij@linaro.org>:
> On Thu, Nov 5, 2015 at 12:15 PM, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>
>> ARCH_SUNXI selects RESET_CONTROLLER.
>> The dependency "depends on RESET_CONTROLLER" is already met.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> NACK, this pin controller needs that as dependency, I don't worry
> that it's overspecified.
>
> They both do this:
> #include <linux/reset.h>
>
> And the object should specify its dependencies, not rely on them
> being implicitly available.
>
> The dep is there for human readers too, not just machines. And to
> them, this is helpful information.

How strict we should follow this rule?

Many drivers depend on OF, but do they all have "depends on OF"?





-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [RFC PATCH 4/7] pinctrl: sunxi: remove redundant "depends on RESET_CONTROLLER"
  2015-11-16  3:40     ` Masahiro Yamada
@ 2015-11-17 14:03       ` Linus Walleij
  0 siblings, 0 replies; 25+ messages in thread
From: Linus Walleij @ 2015-11-17 14:03 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Vishnu Patekar, linux-gpio, linux-kernel, Hans de Goede,
	Chen-Yu Tsai, Philipp Zabel, Maxime Ripard, linux-arm-kernel

On Mon, Nov 16, 2015 at 4:40 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> 2015-11-05 22:40 GMT+09:00 Linus Walleij <linus.walleij@linaro.org>:
>> On Thu, Nov 5, 2015 at 12:15 PM, Masahiro Yamada
>> <yamada.masahiro@socionext.com> wrote:
>>
>>> ARCH_SUNXI selects RESET_CONTROLLER.
>>> The dependency "depends on RESET_CONTROLLER" is already met.
>>>
>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>
>> NACK, this pin controller needs that as dependency, I don't worry
>> that it's overspecified.
>>
>> They both do this:
>> #include <linux/reset.h>
>>
>> And the object should specify its dependencies, not rely on them
>> being implicitly available.
>>
>> The dep is there for human readers too, not just machines. And to
>> them, this is helpful information.
>
> How strict we should follow this rule?
>
> Many drivers depend on OF, but do they all have "depends on OF"?

I think they should, and if they are in my subsystems I consider
it a bug if they don't have this dependency. Also it is a very common
reason why test compiles fail.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2015-11-17 14:04 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-05 11:15 [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Masahiro Yamada
2015-11-05 11:15 ` [RFC PATCH 1/7] reset: drop ARCH_HAS_RESET_CONTROLLER Masahiro Yamada
2015-11-05 11:15 ` [RFC PATCH 2/7] spi: sunxi: remove redundant "depends on RESET_CONTROLLER" Masahiro Yamada
2015-11-05 11:28   ` Mark Brown
2015-11-05 12:11     ` Masahiro Yamada
2015-11-05 12:20       ` Mark Brown
2015-11-05 12:32         ` Masahiro Yamada
2015-11-05 15:05           ` Mark Brown
2015-11-06  6:00             ` Masahiro Yamada
2015-11-06 10:21               ` Mark Brown
2015-11-05 11:15 ` [RFC PATCH 3/7] spi: tegra: " Masahiro Yamada
2015-11-05 11:50   ` Mark Brown
2015-11-06  6:02     ` Masahiro Yamada
2015-11-06 10:22       ` Mark Brown
2015-11-05 11:15 ` [RFC PATCH 4/7] pinctrl: sunxi: " Masahiro Yamada
2015-11-05 13:40   ` Linus Walleij
2015-11-05 14:06     ` Linus Walleij
2015-11-16  3:40     ` Masahiro Yamada
2015-11-17 14:03       ` Linus Walleij
2015-11-05 11:15 ` [RFC PATCH 5/7] drm/sti: replace "select RESET_CONTROLLER" with "depends on ..." Masahiro Yamada
2015-11-05 11:15 ` [RFC PATCH 6/7] drm/rockchip: remove redundant "depends on RESET_CONTROLLER" Masahiro Yamada
2015-11-05 11:15 ` [RFC PATCH 7/7] drm/tegra: tegra: " Masahiro Yamada
2015-11-05 14:49 ` [RFC PATCH 0/7] reset: make RESET_CONTROLLER a select'ed option Arnd Bergmann
2015-11-06  5:58   ` Masahiro Yamada
2015-11-06  9:29     ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).