Skip to contentSkip to conversation

ata: clean up how architectures enable PATA_PLATFORM and PATA_OF_PLATFORM

PATCH Applied Lukas Bulwahn 3 participants 5 messages Sep 14, 2022 – Sep 16, 2022

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

PATCH 1/2 ata: clean up how architectures enable PATA_PLATFORM and PATA_OF_PLATFORM

There are two options for platform device PATA support:

PATA_PLATFORM: Generic platform device PATA support
PATA_OF_PLATFORM: OpenFirmware platform device PATA support

If an architecture allows the generic platform device PATA support, it shall select HAVE_PATA_PLATFORM. Then, Generic platform device PATA support is available and can be selected.

If an architecture has OpenFirmware support, which it indicates by selecting OF, OpenFirmware platform device PATA support is available and can be selected.
If OpenFirmware platform device PATA support is selected, then the functionality (code files) from Generic platform device PATA support needs to be integrated in the kernel build for the OpenFirmware platform device PATA support to work. Select PATA_PLATFORM in PATA_OF_PLATFORM to make sure the needed files are added in the build.

So, architectures with OpenFirmware support, do not need to additionally select HAVE_PATA_PLATFORM. It is only needed by architecture that want the non-OF pata-platform module.

Reflect this way of intended use of config symbols in the ata Kconfig and adjust all architecture definitions.

This follows the suggestion from Arnd Bergmann (see Link).

---
 arch/arm/mach-versatile/Kconfig | 1 -
 arch/arm64/Kconfig              | 1 -
 drivers/ata/Kconfig             | 6 +++---
 3 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/mach-versatile/Kconfig +0 -1
index 2ef226194c3a..b1519b4dc03a 100644
@@ -256,7 +256,6 @@ menuconfig ARCH_VEXPRESS
 	select GPIOLIB
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
-	select HAVE_PATA_PLATFORM
 	select CLK_ICST
 	select NO_IOPORT_MAP
 	select PLAT_VERSATILE
arch/arm64/Kconfig +0 -1
index 51f3f07c3efd..036bd67e662e 100644
@@ -194,7 +194,6 @@ config ARM64
 	select HAVE_IRQ_TIME_ACCOUNTING
 	select HAVE_KVM
 	select HAVE_NMI
-	select HAVE_PATA_PLATFORM
 	select HAVE_PERF_EVENTS
 	select HAVE_PERF_REGS
 	select HAVE_PERF_USER_STACK_DUMP
drivers/ata/Kconfig +3 -3
index 1c9f4fb2595d..c93d97455744 100644
@@ -1102,8 +1102,7 @@ config PATA_PCMCIA
 	  If unsure, say N.
 
 config PATA_PLATFORM
-	tristate "Generic platform device PATA support"
-	depends on EXPERT || PPC || HAVE_PATA_PLATFORM
+	tristate "Generic platform device PATA support" if EXPERT || HAVE_PATA_PLATFORM
 	help
 	  This option enables support for generic directly connected ATA
 	  devices commonly found on embedded systems.
@@ -1112,7 +1111,8 @@ config PATA_PLATFORM
 
 config PATA_OF_PLATFORM
 	tristate "OpenFirmware platform device PATA support"
-	depends on PATA_PLATFORM && OF
+	depends on OF
+	select PATA_PLATFORM
 	help
 	  This option enables support for generic directly connected ATA
 	  devices commonly found on embedded systems with OpenFirmware
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 ata: make PATA_PLATFORM selectable only for suitable architectures

It is currently possible to select "Generic platform device PATA support" in two situations:

- architecture allows the generic platform device PATA support and indicates that with "select HAVE_PATA_PLATFORM".
- if the user claims to be an EXPERT by setting CONFIG_EXPERT to yes

However, there is no use case to have Generic platform device PATA support in a kernel build if the architecture definition, i.e., the selection of configs by an architecture, does not support it.

If the architecture definition is wrong, i.e., it just misses a 'select HAVE_PATA_PLATFORM', then even an expert that configures the kernel build should not just fix that by overruling the claimed support by an architecture. If the architecture definition is wrong, the expert should just provide a patch to correct the architecture definition instead---in the end, if the user is an expert, sending a quick one-line patch should not be an issue.

In other words, I do not see the deeper why an expert can overrule the architecture definition in this case, as the expert may not overrule the config selections defined by the architecture in the large majority ---or probably all other (modulo some mistakes)---of similar cases.

---
 drivers/ata/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ata/Kconfig +1 -1
index c93d97455744..fc11d9d30d72 100644
@@ -1102,7 +1102,7 @@ config PATA_PCMCIA
 	  If unsure, say N.
 
 config PATA_PLATFORM
-	tristate "Generic platform device PATA support" if EXPERT || HAVE_PATA_PLATFORM
+	tristate "Generic platform device PATA support" if HAVE_PATA_PLATFORM
 	help
 	  This option enables support for generic directly connected ATA
 	  devices commonly found on embedded systems.
Signature · 1 line
2.17.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] ata: make PATA_PLATFORM selectable only for suitable architectures

Quoted 19 lines · Lukas Bulwahn

It is currently possible to select "Generic platform device PATA support" in two situations:

- architecture allows the generic platform device PATA support and indicates that with "select HAVE_PATA_PLATFORM".
- if the user claims to be an EXPERT by setting CONFIG_EXPERT to yes

However, there is no use case to have Generic platform device PATA support in a kernel build if the architecture definition, i.e., the selection of configs by an architecture, does not support it.

If the architecture definition is wrong, i.e., it just misses a 'select HAVE_PATA_PLATFORM', then even an expert that configures the kernel build should not just fix that by overruling the claimed support by an architecture. If the architecture definition is wrong, the expert should just provide a patch to correct the architecture definition instead---in the end, if the user is an expert, sending a quick one-line patch should not be an issue.

Quoted 6 lines

In other words, I do not see the deeper why an expert can overrule the architecture definition in this case, as the expert may not overrule the config selections defined by the architecture in the large majority ---or probably all other (modulo some mistakes)---of similar cases.

Sounds reasonable. My best guess about the intention of the EXPERT dependency is that it would be used for users with third-party board files or dts files referencing these. We can't really help users with out-of-tree boardfiles, and the external dts case would be covered by your patch 1/2.

Reviewed-by on v1 1/2
#3 lore raw
In reply to Lukas Bulwahn
Quoted 25 lines · Lukas Bulwahn

There are two options for platform device PATA support:

PATA_PLATFORM: Generic platform device PATA support
PATA_OF_PLATFORM: OpenFirmware platform device PATA support

If an architecture allows the generic platform device PATA support, it shall select HAVE_PATA_PLATFORM. Then, Generic platform device PATA support is available and can be selected.

If an architecture has OpenFirmware support, which it indicates by selecting OF, OpenFirmware platform device PATA support is available and can be selected.
If OpenFirmware platform device PATA support is selected, then the functionality (code files) from Generic platform device PATA support needs to be integrated in the kernel build for the OpenFirmware platform device PATA support to work. Select PATA_PLATFORM in PATA_OF_PLATFORM to make sure the needed files are added in the build.

So, architectures with OpenFirmware support, do not need to additionally select HAVE_PATA_PLATFORM. It is only needed by architecture that want the non-OF pata-platform module.

Reflect this way of intended use of config symbols in the ata Kconfig and adjust all architecture definitions.

Quoted 7 lines

This follows the suggestion from Arnd Bergmann (see Link).

Link:
https://lore.kernel.org/all/[email protected]/

Thanks for the follow-up, looks good.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#4 lore raw
In reply to Lukas Bulwahn
Quoted 25 lines · Lukas Bulwahn

There are two options for platform device PATA support:

PATA_PLATFORM: Generic platform device PATA support
PATA_OF_PLATFORM: OpenFirmware platform device PATA support

If an architecture allows the generic platform device PATA support, it shall select HAVE_PATA_PLATFORM. Then, Generic platform device PATA support is available and can be selected.

If an architecture has OpenFirmware support, which it indicates by selecting OF, OpenFirmware platform device PATA support is available and can be selected.
If OpenFirmware platform device PATA support is selected, then the functionality (code files) from Generic platform device PATA support needs to be integrated in the kernel build for the OpenFirmware platform device PATA support to work. Select PATA_PLATFORM in PATA_OF_PLATFORM to make sure the needed files are added in the build.

So, architectures with OpenFirmware support, do not need to additionally select HAVE_PATA_PLATFORM. It is only needed by architecture that want the non-OF pata-platform module.

Reflect this way of intended use of config symbols in the ata Kconfig and adjust all architecture definitions.

Quoted 6 lines

This follows the suggestion from Arnd Bergmann (see Link).

Applied this patch and 2/2 to for-6.1. Thanks !

Quoted 54 lines
---
 arch/arm/mach-versatile/Kconfig | 1 -
 arch/arm64/Kconfig              | 1 -
 drivers/ata/Kconfig             | 6 +++---
 3 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/mach-versatile/Kconfig +0 -1
index 2ef226194c3a..b1519b4dc03a 100644
@@ -256,7 +256,6 @@ menuconfig ARCH_VEXPRESS
 	select GPIOLIB
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
-	select HAVE_PATA_PLATFORM
 	select CLK_ICST
 	select NO_IOPORT_MAP
 	select PLAT_VERSATILE
arch/arm64/Kconfig +0 -1
index 51f3f07c3efd..036bd67e662e 100644
@@ -194,7 +194,6 @@ config ARM64
 	select HAVE_IRQ_TIME_ACCOUNTING
 	select HAVE_KVM
 	select HAVE_NMI
-	select HAVE_PATA_PLATFORM
 	select HAVE_PERF_EVENTS
 	select HAVE_PERF_REGS
 	select HAVE_PERF_USER_STACK_DUMP
drivers/ata/Kconfig +3 -3
index 1c9f4fb2595d..c93d97455744 100644
@@ -1102,8 +1102,7 @@ config PATA_PCMCIA
 	  If unsure, say N.
 
 config PATA_PLATFORM
-	tristate "Generic platform device PATA support"
-	depends on EXPERT || PPC || HAVE_PATA_PLATFORM
+	tristate "Generic platform device PATA support" if EXPERT || HAVE_PATA_PLATFORM
 	help
 	  This option enables support for generic directly connected ATA
 	  devices commonly found on embedded systems.
@@ -1112,7 +1111,8 @@ config PATA_PLATFORM
 
 config PATA_OF_PLATFORM
 	tristate "OpenFirmware platform device PATA support"
-	depends on PATA_PLATFORM && OF
+	depends on OF
+	select PATA_PLATFORM
 	help
 	  This option enables support for generic directly connected ATA
 	  devices commonly found on embedded systems with OpenFirmware
Signature · 2 lines
Damien Le Moal
Western Digital Research