diff mbox series

[v2,4/6] mfd: tps65219: Specify restart mode

Message ID 20230809-pca9450-reboot-v2-4-b98b4f8139d5@skidata.com
State New
Headers show
Series regulator: pca9450: register restart handlers | expand

Commit Message

Benjamin Bara Aug. 9, 2023, 7:24 p.m. UTC
From: Benjamin Bara <benjamin.bara@skidata.com>

The current restart handler registration does not specify whether the
restart is a cold or a warm one. Instead, cold ones are typically
registered with a HIGH prio. Now, as do_kernel_restart() knows about the
type, the priorization is implicitly done (cold restarts are executed
first) and the reboot_mode kernel parameter (which is currently mostly
ignored) can be respected.

Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
---
v2:
- improve commit message
---
 drivers/mfd/tps65219.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

Comments

Lee Jones Aug. 18, 2023, 4:10 p.m. UTC | #1
On Wed, 09 Aug 2023, Benjamin Bara wrote:

> From: Benjamin Bara <benjamin.bara@skidata.com>
> 
> The current restart handler registration does not specify whether the
> restart is a cold or a warm one. Instead, cold ones are typically
> registered with a HIGH prio. Now, as do_kernel_restart() knows about the
> type, the priorization is implicitly done (cold restarts are executed
> first) and the reboot_mode kernel parameter (which is currently mostly
> ignored) can be respected.
> 
> Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
> ---
> v2:
> - improve commit message
> ---
>  drivers/mfd/tps65219.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mfd/tps65219.c b/drivers/mfd/tps65219.c
> index 0e0c42e4fdfc..85752b93256e 100644
> --- a/drivers/mfd/tps65219.c
> +++ b/drivers/mfd/tps65219.c
> @@ -278,12 +278,21 @@ static int tps65219_probe(struct i2c_client *client)
>  		}
>  	}
>  
> -	ret = devm_register_restart_handler(tps->dev,
> -					    tps65219_restart_handler,
> -					    tps);
> +	ret = devm_register_cold_restart_handler(tps->dev,
> +						 tps65219_restart_handler,
> +						 tps);
>  
>  	if (ret) {
> -		dev_err(tps->dev, "cannot register restart handler, %d\n", ret);
> +		dev_err(tps->dev, "cannot register cold restart handler, %d\n", ret);
> +		return ret;
> +	}
> +
> +	ret = devm_register_warm_restart_handler(tps->dev,
> +						 tps65219_restart_handler,
> +						 tps);
> +

Sorry, why do we have to now register 2 restart handlers?

Seems like a regression?

> +	if (ret) {
> +		dev_err(tps->dev, "cannot register warm restart handler, %d\n", ret);
>  		return ret;
>  	}
>  
> 
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/mfd/tps65219.c b/drivers/mfd/tps65219.c
index 0e0c42e4fdfc..85752b93256e 100644
--- a/drivers/mfd/tps65219.c
+++ b/drivers/mfd/tps65219.c
@@ -278,12 +278,21 @@  static int tps65219_probe(struct i2c_client *client)
 		}
 	}
 
-	ret = devm_register_restart_handler(tps->dev,
-					    tps65219_restart_handler,
-					    tps);
+	ret = devm_register_cold_restart_handler(tps->dev,
+						 tps65219_restart_handler,
+						 tps);
 
 	if (ret) {
-		dev_err(tps->dev, "cannot register restart handler, %d\n", ret);
+		dev_err(tps->dev, "cannot register cold restart handler, %d\n", ret);
+		return ret;
+	}
+
+	ret = devm_register_warm_restart_handler(tps->dev,
+						 tps65219_restart_handler,
+						 tps);
+
+	if (ret) {
+		dev_err(tps->dev, "cannot register warm restart handler, %d\n", ret);
 		return ret;
 	}