Commit graph

388 commits

Author SHA1 Message Date
Geert Uytterhoeven
3da8d71754 power: reset: rmobile-reset: Make sysc_base2 local
The static global variable sysc_base2 is no longer used outside the
probe method and the reset handler, so it can be converted to a local
variable, and passed to the reset handler via its callback data.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/35f04935c48ae55dc562071e0a1d6fca65234a58.1708944642.git.geert+renesas@glider.be
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-26 15:09:11 +01:00
Geert Uytterhoeven
6f005ab7f5 power: reset: rmobile-reset: Map correct MMIO resource
The registers related to reset generation are located in the second
register block.  However, the conversion to device life-cycle managed
ioremap function accidentally changed the mapping to the first register
block.

Fixes: 0867276eb1 ("power: reset: rmobile-reset: Use devm_platform_ioremap_resource() helper")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/3b267fb1b303f63248934a1a77bee319e1c44879.1708458882.git.geert+renesas@glider.be
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-21 21:17:58 +01:00
Dan Carpenter
62f4b33bf2 power: reset: xgene-reboot: Fix a NULL vs IS_ERR() test
The devm_platform_ioremap_resource() function returns error points.  It
never returns NULL.  Update the check accordingly.

Fixes: 7ddfd33c6e ("power: reset: xgene-reboot: Use devm_platform_ioremap_resource() helper")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/fe1b90d0-7234-4e03-accc-69a119f6a7eb@moroto.mountain
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-21 21:13:37 +01:00
Andrew Davis
14c5678720 power: reset: syscon-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

This also makes our data struct per-device and not global, which allows
for more than one instance of this device.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240212162831.67838-20-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
ffa2128312 power: reset: syscon-poweroff: Move device data into a struct
Currently all these device data elements are top level global variables.
Move these into a struct. This will be used in the next patch when
the global variable usage is removed. Doing this in two steps makes
the patches easier to read.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240212162831.67838-19-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
c3ede0b6f7 power: reset: restart-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-18-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
b6475c3f81 power: reset: gemini-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-17-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
348fde771c power: reset: as3722-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-16-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
77b61173c2 power: reset: regulator-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-15-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
00ae86ebf8 power: reset: msm-poweroff: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-14-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
b5711ff917 power: reset: msm-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use this helper to register sys_off handler. Drivers should move away from
setting pm_power_off directly as it only allows for one handler. The new
way allows for trying multiple if the first one doesn't work.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-13-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:26 +01:00
Andrew Davis
6ab9137719 power: reset: mt6323-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20240212162831.67838-12-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
ba1188ea8b power: reset: rmobile-reset: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-11-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
0867276eb1 power: reset: rmobile-reset: Use devm_platform_ioremap_resource() helper
Use device life-cycle managed ioremap function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-10-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
ad8d7b8002 power: reset: axxia-reset: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-9-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
45079f206e power: reset: brcm-kona-reset: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20240212162831.67838-8-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
11d2642e14 power: reset: tps65086-restart: Remove unneeded device data struct
We only need one member of the struct tps65086_restart, pass that
tps65086_restart_notify() directly. Remove that struct and its
allocation.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-7-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
e68b71812e power: reset: tps65086-restart: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-6-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
6af1ee0285 power: reset: xgene-reboot: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-5-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
7ddfd33c6e power: reset: xgene-reboot: Use devm_platform_ioremap_resource() helper
Use device life-cycle managed ioremap function to simplify probe and
exit paths.

While here add __iomem to the returned pointer to fix a sparse warning.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240212162831.67838-4-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:25 +01:00
Andrew Davis
ab1439b051 power: reset: atc260x-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20240212162831.67838-3-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:24 +01:00
Andrew Davis
f22e835028 power: reset: atc260x-poweroff: Use devm_register_sys_off_handler(RESTART)
Use device life-cycle managed register function to simplify probe and
exit paths.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20240212162831.67838-2-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2024-02-13 02:17:24 +01:00
Nathan Chancellor
195c316786 power: reset: at91: Drop '__init' from at91_wakeup_status()
When building with clang, there are two section mismatch warnings:

  WARNING: modpost: vmlinux: section mismatch in reference: at91_poweroff_probe+0x7c (section: .text) -> at91_wakeup_status (section: .init.text)
  WARNING: modpost: vmlinux: section mismatch in reference: at91_shdwc_probe+0xcc (section: .text) -> at91_wakeup_status (section: .init.text)

Drop '__init' from at91_wakeup_status() to clear up the mismatch.

Fixes: dde74a5de8 ("power: reset: at91-sama5d2_shdwc: Stop using module_platform_driver_probe()")
Fixes: 099806de68 ("power: reset: at91-poweroff: Stop using module_platform_driver_probe()")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-12-24 23:43:10 +01:00
Andrew Davis
c04c4ebd45 power: reset: gpio-restart: Use devm_register_sys_off_handler()
Use device life-cycle managed register function to simplify probe error
path and eliminate need for explicit remove function.

Signed-off-by: Andrew Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-12-24 22:54:01 +01:00
Uwe Kleine-König
054eb23775 power: reset: at91-sama5d2_shdwc: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20231105094712.3706799-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:40 +01:00
Uwe Kleine-König
20cea2b59a power: reset: at91-reset: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20231105094712.3706799-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:40 +01:00
Uwe Kleine-König
0bf7207e09 power: reset: tps65086-restart: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Returning an error if unregister_restart_handler() failed has no effect
but triggering another error message. So converting this driver to
.remove_new() has no effect but to suppress the duplicated error message.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231104211501.3676352-30-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:40 +01:00
Uwe Kleine-König
2973706c41 power: reset: syscon-poweroff: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231104211501.3676352-29-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:39 +01:00
Uwe Kleine-König
30d26d2be8 power: reset: rmobile-reset: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231104211501.3676352-28-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:39 +01:00
Uwe Kleine-König
aedd4da0aa power: reset: restart-poweroff: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231104211501.3676352-27-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:39 +01:00
Uwe Kleine-König
6f7be7b2f1 power: reset: regulator-poweroff: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231104211501.3676352-26-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:39 +01:00
Uwe Kleine-König
1a0457ab2c power: reset: qnap-poweroff: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231104211501.3676352-25-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:39 +01:00
Uwe Kleine-König
99f7fa6c7c power: reset: mt6323-poweroff: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20231104211501.3676352-24-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:38 +01:00
Uwe Kleine-König
6642b13206 power: reset: ltc2952-poweroff: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231104211501.3676352-23-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:38 +01:00
Uwe Kleine-König
6f539f3151 power: reset: atc260x-poweroff: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231104211501.3676352-22-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:38 +01:00
Uwe Kleine-König
a31438ece3 power: reset: at91-poweroff: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20231104211501.3676352-21-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:38 +01:00
Uwe Kleine-König
904e582f0c power: reset: as3722-poweroff: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231104211501.3676352-20-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:38 +01:00
Uwe Kleine-König
dde74a5de8 power: reset: at91-sama5d2_shdwc: Stop using module_platform_driver_probe()
On today's platforms the benefit of platform_driver_probe() isn't that
relevant any more. It allows to drop some code after booting (or module
loading) for .probe() and discard the .remove() function completely if
the driver is built-in. This typically saves a few 100k.

The downside of platform_driver_probe() is that the driver cannot be
bound and unbound at runtime which is ancient and so slightly
complicates testing. There are also thoughts to deprecate
platform_driver_probe() because it adds some complexity in the driver
core for little gain. Also many drivers don't use it correctly. This
driver for example misses to mark the driver struct with __ref which is
needed to suppress a (W=1) modpost warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20231104211501.3676352-19-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:38 +01:00
Uwe Kleine-König
12389c657b power: reset: at91-reset: Stop using module_platform_driver_probe()
On today's platforms the benefit of platform_driver_probe() isn't that
relevant any more. It allows to drop some code after booting (or module
loading) for .probe() and discard the .remove() function completely if
the driver is built-in. This typically saves a few 100k.

The downside of platform_driver_probe() is that the driver cannot be
bound and unbound at runtime which is ancient and so slightly
complicates testing. There are also thoughts to deprecate
platform_driver_probe() because it adds some complexity in the driver
core for little gain. Also many drivers don't use it correctly. This
driver for example misses to mark the driver struct with __ref which is
needed to suppress a (W=1) modpost warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20231104211501.3676352-18-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:38 +01:00
Uwe Kleine-König
099806de68 power: reset: at91-poweroff: Stop using module_platform_driver_probe()
On today's platforms the benefit of platform_driver_probe() isn't that
relevant any more. It allows to drop some code after booting (or module
loading) for .probe() and discard the .remove() function completely if
the driver is built-in. This typically saves a few 100k.

The downside of platform_driver_probe() is that the driver cannot be
bound and unbound at runtime which is ancient and so slightly
complicates testing. There are also thoughts to deprecate
platform_driver_probe() because it adds some complexity in the driver
core for little gain. Also many drivers don't use it correctly. This
driver for example misses to mark the driver struct with __ref which is
needed to suppress a (W=1) modpost warning.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Link: https://lore.kernel.org/r/20231104211501.3676352-17-u.kleine-koenig@pengutronix.de
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:15:37 +01:00
Asmaa Mnebhi
b9afaa069e power: reset: pwr-mlxbf: support graceful reboot instead of emergency reset
Replace the soft reset with a graceful reboot.
An acpi event will be triggered by the irq in the pwr-mlxbf.c
to trigger the graceful reboot.

Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com>
Link: https://lore.kernel.org/r/20231030203058.8056-1-asmaa@nvidia.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-11-15 23:04:48 +01:00
Rob Herring
469d31745b power: reset: vexpress: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20231009172923.2457844-19-robh@kernel.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-10-21 00:57:55 +02:00
Sebastian Reichel
e186bd1ac2 Power Supply Fixes for 6.6 cycle
* qcom_battmgr: endianness fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmUon44ACgkQ2O7X88g7
 +pqxjg/9E0CIfgV4Pb4wThCiauAp8f331uNAIrY2elWAycKCX/VGumyojtZf3gYR
 M96EWKyP43QWP134xfDDmM63GARU9n8DDostib2NI3ul1j4rZ2czeuvEwrhC+LH0
 QLaZ30uwR2WDaSkbSyIFpeR8lVA7OjrQwonC17uWfaKE5qS+SYoFux5RK/LFulwK
 9dlcvrtCim86qWemqWPH4kKYCTCH72wxQSOviMg2vQ4y0XjxVSPqrFssQmgr/FnO
 TsDp7hQTk6E5K78GyWYRwZB+deNwNvCajOqDd6W7idSbaUi7iBUY87qpFDZA5ghe
 q3MWlaE11qqspf3nNYiaJADn8QESZDZvr95LwtkbEAo0m6LWgytCYpNfAlRM+g1J
 iP9rlt8A8y05DURvUl/y/JJEkM++MvJ/XMylbwtfcT8Xmf/UMqC8O4M4H6MZmeCN
 Cq8Ql3m5ozEh3IBXtbiGHu0i3uPTBE6URb7Ob9lkecsFRzj72BpzaS/o6g4bm8uN
 qwO61PXB9Yx61gemnGCpm9R0pgxgwwznDk0JTVhF9qZ82geiap0OXnwIqXVPK/sU
 0FRK26j5Xf2tH2IqHED8fNkhSc1cjJnMRp5LPYgu3Y1fhD2aBYDywQjdyAUai2B9
 89VL5M5gbe9+144mrLFLdreek3A9QOBWG9uz1i1R/ThyLNf32a0=
 =DSYH
 -----END PGP SIGNATURE-----

Merge power-supply fixes for 6.6 cycle

Merge power-supply fixes for the 6.6 cycle, so that changes
to the vexpress driver apply cleanly.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-10-21 00:55:43 +02:00
Peter Robinson
3c693ac29e power: reset: brcmstb: Depend on actual SoC dependencies
Depend on the explicit SoC defines rather than generic
architectures like most of the rest of the HW drivers do.
This makes the drivers only available for the HW and for
compile testing.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: linux-pm@vger.kernel.org
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20231009135833.17880-3-pbrobinson@gmail.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-10-13 02:33:00 +02:00
Stefan Eichenberger
d03d2a8cde power: reset: gpio-poweroff: make sys handler priority configurable
Add a priority property equal to gpio-restart to allow increasing the
priority of the gpio-poweroff handler.

Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Link: https://lore.kernel.org/r/20231006130428.11259-5-francesco@dolcini.it
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-10-13 02:22:36 +02:00
Stefan Eichenberger
b16d9f4973 power: reset: gpio-poweroff: use sys-off handler API
Use the new sys-off handler API for gpio-poweroff. This allows us to
have more than one poweroff handler and prioritise them.

Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Link: https://lore.kernel.org/r/20231006130428.11259-3-francesco@dolcini.it
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-10-13 02:22:36 +02:00
Stefan Eichenberger
13b4c69646 power: reset: gpio-poweroff: use a struct to store the module variables
Use a struct to store the module variables. This is required to later
move to notifier_blocks where we can have several instances.

Signed-off-by: Stefan Eichenberger <stefan.eichenberger@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Link: https://lore.kernel.org/r/20231006130428.11259-2-francesco@dolcini.it
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-10-13 02:22:36 +02:00
Krzysztof Kozlowski
92bbb93aaa power: reset: syscon-poweroff: get regmap from parent node
Just like syscon-reboot device, the syscon-poweroff is supposed to be a
child of syscon node, thus we can take the same approach as
syscon-poweroff: deprecate the 'regmap' field in favor of taking it from
the parent's node.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230901120057.47018-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-09-12 21:07:14 +02:00
Krzysztof Kozlowski
6f9c8a1338 power: reset: syscon-poweroff: simplify pdev->dev usage
Make the probe() code a bit simpler and shorter by storing all the
'&pdev->dev' as 'dev'.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230901120057.47018-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-09-12 21:07:14 +02:00
Yang Yingliang
5b69b5f209 power: reset: syscon-poweroff: use builtin_platform_driver() to simplify code
The syscon_poweroff_register() doesn't do anything special, so it can use the
builtin_platform_driver() macro to eliminate boilerplate code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230807131951.3443880-6-yangyingliang@huawei.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-09-12 20:25:54 +02:00