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>
This commit is contained in:
parent
0867276eb1
commit
ba1188ea8b
@ -21,22 +21,14 @@
|
||||
|
||||
static void __iomem *sysc_base2;
|
||||
|
||||
static int rmobile_reset_handler(struct notifier_block *this,
|
||||
unsigned long mode, void *cmd)
|
||||
static int rmobile_reset_handler(struct sys_off_data *data)
|
||||
{
|
||||
pr_debug("%s %lu\n", __func__, mode);
|
||||
|
||||
/* Let's assume we have acquired the HPB semaphore */
|
||||
writel(RESCNT2_PRES, sysc_base2 + RESCNT2);
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static struct notifier_block rmobile_reset_nb = {
|
||||
.notifier_call = rmobile_reset_handler,
|
||||
.priority = 192,
|
||||
};
|
||||
|
||||
static int rmobile_reset_probe(struct platform_device *pdev)
|
||||
{
|
||||
int error;
|
||||
@ -45,7 +37,11 @@ static int rmobile_reset_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(sysc_base2))
|
||||
return PTR_ERR(sysc_base2);
|
||||
|
||||
error = register_restart_handler(&rmobile_reset_nb);
|
||||
error = devm_register_sys_off_handler(&pdev->dev,
|
||||
SYS_OFF_MODE_RESTART,
|
||||
SYS_OFF_PRIO_HIGH,
|
||||
rmobile_reset_handler,
|
||||
NULL);
|
||||
if (error) {
|
||||
dev_err(&pdev->dev,
|
||||
"cannot register restart handler (err=%d)\n", error);
|
||||
@ -55,11 +51,6 @@ static int rmobile_reset_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rmobile_reset_remove(struct platform_device *pdev)
|
||||
{
|
||||
unregister_restart_handler(&rmobile_reset_nb);
|
||||
}
|
||||
|
||||
static const struct of_device_id rmobile_reset_of_match[] = {
|
||||
{ .compatible = "renesas,sysc-rmobile", },
|
||||
{ /* sentinel */ }
|
||||
@ -68,7 +59,6 @@ MODULE_DEVICE_TABLE(of, rmobile_reset_of_match);
|
||||
|
||||
static struct platform_driver rmobile_reset_driver = {
|
||||
.probe = rmobile_reset_probe,
|
||||
.remove_new = rmobile_reset_remove,
|
||||
.driver = {
|
||||
.name = "rmobile_reset",
|
||||
.of_match_table = rmobile_reset_of_match,
|
||||
|
Loading…
Reference in New Issue
Block a user