vexpress: modularize power reset driver
Subsystems (4)
cover vexpress: modularize power reset driver
Hi,
This patchset contains a bugfixe, a cleanup and fixes allmodconfig build breakages on arm and arm64. Also making the vexpress power reset driver a module.
Cheers,
Anders
Anders Roxell (5):
power: vexpress: add suppress_bind_attrs to true
power: vexpress: cleanup: use builtin_platform_driver Revert "ARM: vexpress: Don't select VEXPRESS_CONFIG"
power: reset: vexpress: fix build issue
power: vexpress: make the reset driver a module
arch/arm/mach-vexpress/Kconfig | 2 +- drivers/power/reset/Kconfig | 3 ++- drivers/power/reset/vexpress-poweroff.c | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/5 power: vexpress: add suppress_bind_attrs to true
Make sure that the POWER_RESET_VEXPRESS driver won't have bind/unbind attributes available via the sysfs, so lets be explicit here and use ".suppress_bind_attrs = true" to prevent userspace from doing something silly.
--- drivers/power/reset/vexpress-poweroff.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/reset/vexpress-poweroff.c +1 -0
@@ -143,6 +143,7 @@ static struct platform_driver vexpress_reset_driver = { .driver = { .name = "vexpress-reset", .of_match_table = vexpress_reset_of_match, + .suppress_bind_attrs = true, }, };
Signature · 1 line
2.26.2
Re: [PATCH 1/5] power: vexpress: add suppress_bind_attrs to true
Quoted 5 lines · Anders Roxell
Make sure that the
POWER_RESET_VEXPRESSdriver won't have bind/unbind attributes available via the sysfs, so lets be explicit here and use ".suppress_bind_attrs = true" to prevent userspace from doing something silly.
This doesn't really make sense if we're going to make this a module. Module unloading and unbind introduce the same requirements of cleaning up (undoing whatever probe did).
Rob
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 1/5] power: vexpress: add suppress_bind_attrs to true
Quoted 11 lines · Rob Herring
Quoted 5 lines · Anders Roxell
Make sure that the
POWER_RESET_VEXPRESSdriver won't have bind/unbind attributes available via the sysfs, so lets be explicit here and use ".suppress_bind_attrs = true" to prevent userspace from doing something silly.This doesn't really make sense if we're going to make this a module. Module unloading and unbind introduce the same requirements of cleaning up (undoing whatever probe did).
I still want this change as a separate patch so we can backport it to stable kernels for correctness.
Also, as long as we don't have a working (and tested) .remove callback, we can only allow making the driver a loadable module but not also allowing the module to be removed.
Arnd
PATCH 2/5 power: vexpress: cleanup: use builtin_platform_driver
In reply to Anders RoxellUse the helper macro for builtin drivers taht don't do anything special in driver init. This removes some boilerplate code.
--- drivers/power/reset/vexpress-poweroff.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/power/reset/vexpress-poweroff.c +1 -6
@@ -146,9 +146,4 @@ static struct platform_driver vexpress_reset_driver = { .suppress_bind_attrs = true, }, }; - -static int __init vexpress_reset_init (void ) -{ -return platform_driver_register (&vexpress_reset_driver); -} -device_initcall (vexpress_reset_init); +builtin_platform_driver (vexpress_reset_driver);
Signature · 1 line
2.26.2
PATCH 3/5 Revert "ARM: vexpress: Don't select VEXPRESS_CONFIG"
In reply to Anders RoxellThis reverts commit 848685c25da99d871bbd87369f3c3d6eead661ac. Due to when I set 'depends on VEXPRESS_CONFOG=Y' in 'config POWER_RESET_VEXPRESS' to get an allmodconfig build on arm64 to build, and allmodconfig build on arm fails if this patch isn't reverted.
--- arch/arm/mach-vexpress/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-vexpress/Kconfig +1 -0
@@ -19,6 +19,7 @@ menuconfig ARCH_VEXPRESS select POWER_SUPPLY select REGULATOR if MMC_ARMMMCI select REGULATOR_FIXED_VOLTAGE if REGULATOR + select VEXPRESS_CONFIG help This option enables support for systems using Cortex processor based ARM core and logic (FPGA) tiles on the Versatile Express motherboard,
Signature · 1 line
2.26.2
PATCH 4/5 power: reset: vexpress: fix build issue
In reply to Anders RoxellAn allmodconfig kernel makes CONFIG_VEXPRESS_CONFIG a module and CONFIG_POWER_RESET_VEXPRESS builtin. That makes us see this build error:
aarch64-linux-gnu-ld: drivers/power/reset/vexpress-poweroff.o: in function `vexpress_reset_probe':../drivers/power/reset/vexpress-poweroff.c:119: undefined reference to devm_regmap_init_vexpress_config' ../drivers/power/reset/vexpress-poweroff.c:119:(.text+0x48c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol devm_regmap_init_vexpress_config'
make[1]: *** [/srv/src/kernel/next/Makefile:1126: vmlinux] Error 1
Rework so that POWER_RESET_VEXPRESS depends on 'VEXPRESS_CONFIG=y'.
--- drivers/power/reset/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/reset/Kconfig +1 -1
@@ -191,7 +191,7 @@ config POWER_RESET_VERSATILE config POWER_RESET_VEXPRESS bool "ARM Versatile Express power-off and reset driver" depends on ARM || ARM64 - depends on VEXPRESS_CONFIG + depends on VEXPRESS_CONFIG=y help Power off and reset support for the ARM Ltd. Versatile Express boards.
Signature · 1 line
2.26.2
PATCH 5/5 power: vexpress: make the reset driver a module
In reply to Anders RoxellToday the vexpress power driver can only be builtin. Rework so it's possible for the vexpress power driver to be a module.
--- arch/arm/mach-vexpress/Kconfig | 1 - drivers/power/reset/Kconfig | 5 +++-- drivers/power/reset/vexpress-poweroff.c | 12 +++++++++++- 3 files changed, 14 insertions(+), 4 deletions(-)
arch/arm/mach-vexpress/Kconfig +0 -1
@@ -15,7 +15,6 @@ menuconfig ARCH_VEXPRESS select NO_IOPORT_MAP select PLAT_VERSATILE select POWER_RESET - select POWER_RESET_VEXPRESS select POWER_SUPPLY select REGULATOR if MMC_ARMMMCI select REGULATOR_FIXED_VOLTAGE if REGULATOR
drivers/power/reset/Kconfig +3 -2
@@ -189,9 +189,10 @@ config POWER_RESET_VERSATILE reference boards. config POWER_RESET_VEXPRESS - bool "ARM Versatile Express power-off and reset driver" + tristate "ARM Versatile Express power-off and reset driver" depends on ARM || ARM64 - depends on VEXPRESS_CONFIG=y + depends on VEXPRESS_CONFIG + default VEXPRESS_CONFIG help Power off and reset support for the ARM Ltd. Versatile Express boards.
drivers/power/reset/vexpress-poweroff.c +11 -1
@@ -5,6 +5,7 @@*/ #include <linux/delay.h> +#include <linux/module.h> #include <linux/notifier.h> #include <linux/of.h> #include <linux/of_device.h>
@@ -146,4 +147,13 @@ static struct platform_driver vexpress_reset_driver = { .suppress_bind_attrs = true, }, }; -builtin_platform_driver (vexpress_reset_driver); + +static int __init vexpress_reset_init (void ) +{ +return platform_driver_register (&vexpress_reset_driver); +} +module_init (vexpress_reset_init); + +MODULE_AUTHOR ("Pawel Moll <[email protected]>" ); +MODULE_DESCRIPTION ("Vexpress reset driver" ); +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.26.2
Re: [PATCH 5/5] power: vexpress: make the reset driver a module
Quoted 3 lines · Anders Roxell
Today the vexpress power driver can only be builtin. Rework so it's possible for the vexpress power driver to be a module.
This is the same incomplete patch I did[1]. As a module, it needs to clean-up everything probe did like overwriting global variables.
Rob
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 5/5] power: vexpress: make the reset driver a module
Quoted 6 lines · Rob Herring
Quoted 3 lines · Anders Roxell
Today the vexpress power driver can only be builtin. Rework so it's possible for the vexpress power driver to be a module.
Quoted 6 lines
This is the same incomplete patch I did[1]. As a module, it needs to clean-up everything probe did like overwriting global variables.
Rob
[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
Your version was actually broken because it allowed unloading the driver again. The version that Anders sent is a bit better because it explicitly forbids unloading by having a module_init but not module_exit function, so as long as the .suppress_bind_attrs flag is set, this will not crash the kernel.
It would be nice to have a .remove callback, but for the merge window I'm happy with a patch that fixes the build regression.
Arnd
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 9 lines · Anders Roxell
Hi,
This patchset contains a bugfixe, a cleanup and fixes allmodconfig build breakages on arm and arm64. Also making the vexpress power reset driver a module.
Cheers,
Anders
Quoted 6 lines
Anders Roxell (5):
power: vexpress: addsuppress_bind_attrsto true
power: vexpress: cleanup: usebuiltin_platform_driverRevert "ARM: vexpress: Don't selectVEXPRESS_CONFIG"
power: reset: vexpress: fix build issue
power: vexpress: make the reset driver a module
IMO, patches 3 and 4 should be applied to fix the kconfig issues. Making the driver a module can be addressed separately.
Rob
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 18 lines · Rob Herring
Quoted 9 lines · Anders Roxell
Hi,
This patchset contains a bugfixe, a cleanup and fixes allmodconfig build breakages on arm and arm64. Also making the vexpress power reset driver a module.
Cheers,
AndersQuoted 6 lines
Anders Roxell (5):
power: vexpress: addsuppress_bind_attrsto true
power: vexpress: cleanup: usebuiltin_platform_driverRevert "ARM: vexpress: Don't selectVEXPRESS_CONFIG"
power: reset: vexpress: fix build issue
power: vexpress: make the reset driver a module
Quoted 2 lines
IMO, patches 3 and 4 should be applied to fix the kconfig issues. Making the driver a module can be addressed separately.
I've applied patches 1 through 4 now but left the last one.
If we can find someone to write and test a .remove callback, I'll prefer that for v5.9, otherwise I'd consider taking Anders' version instead.
Arnd