[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240212162831.67838-11-afd@ti.com>
Date: Mon, 12 Feb 2024 10:28:22 -0600
From: Andrew Davis <afd@...com>
To: Sebastian Reichel <sre@...nel.org>,
Manivannan Sadhasivam
<manivannan.sadhasivam@...aro.org>,
Cristian Ciocaltea
<cristian.ciocaltea@...il.com>,
Florian Fainelli
<florian.fainelli@...adcom.com>,
Ray Jui <rjui@...adcom.com>, Scott Branden
<sbranden@...adcom.com>,
Bjorn Andersson <andersson@...nel.org>,
Konrad
Dybcio <konrad.dybcio@...aro.org>,
Sean Wang <sean.wang@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>
CC: <linux-pm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-actions@...ts.infradead.org>, <linux-arm-msm@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>, Andrew Davis <afd@...com>
Subject: [PATCH v4 10/19] 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@...com>
---
drivers/power/reset/rmobile-reset.c | 22 ++++++----------------
1 file changed, 6 insertions(+), 16 deletions(-)
diff --git a/drivers/power/reset/rmobile-reset.c b/drivers/power/reset/rmobile-reset.c
index 29c17ed2d4de9..80265608c18e0 100644
--- a/drivers/power/reset/rmobile-reset.c
+++ b/drivers/power/reset/rmobile-reset.c
@@ -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,
--
2.39.2
Powered by blists - more mailing lists