power: reset: brcmstb: Use devm_register_sys_off_handler()
authorAndrew Davis <afd@ti.com>
Mon, 10 Jun 2024 14:28:35 +0000 (09:28 -0500)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Tue, 27 Aug 2024 17:35:23 +0000 (19:35 +0200)
Function register_restart_handler() is deprecated. Using this new API
removes our need to keep and manage a struct notifier_block.

Signed-off-by: Andrew Davis <afd@ti.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
Acked-by: Florian Fainelli <florian.fainelli@broadcom.com>
Link: https://lore.kernel.org/r/20240610142836.168603-4-afd@ti.com
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/reset/brcmstb-reboot.c

index fd583bd309568c4ac9ffc64a21be718cd0989e27..0524ee53d6bae9fc1b9a4ee1c3ecd7dba776c6c8 100644 (file)
@@ -29,8 +29,7 @@ struct reset_reg_mask {
 
 static const struct reset_reg_mask *reset_masks;
 
-static int brcmstb_restart_handler(struct notifier_block *this,
-                                  unsigned long mode, void *cmd)
+static int brcmstb_restart_handler(struct sys_off_data *data)
 {
        int rc;
        u32 tmp;
@@ -65,11 +64,6 @@ static int brcmstb_restart_handler(struct notifier_block *this,
        return NOTIFY_DONE;
 }
 
-static struct notifier_block brcmstb_restart_nb = {
-       .notifier_call = brcmstb_restart_handler,
-       .priority = 128,
-};
-
 static const struct reset_reg_mask reset_bits_40nm = {
        .rst_src_en_mask = BIT(0),
        .sw_mstr_rst_mask = BIT(0),
@@ -100,7 +94,8 @@ static int brcmstb_reboot_probe(struct platform_device *pdev)
        rst_src_en = args[0];
        sw_mstr_rst = args[1];
 
-       rc = register_restart_handler(&brcmstb_restart_nb);
+       rc = devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART,
+                                          128, brcmstb_restart_handler, NULL);
        if (rc)
                dev_err(&pdev->dev,
                        "cannot register restart handler (err=%d)\n", rc);