mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
reset: npcm: Use devm_register_sys_off_handler()
Function register_restart_handler() is deprecated. Using this new API removes our need to keep and manage a struct notifier_block and to later unregister the handler. Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
This commit is contained in:
committed by
Philipp Zabel
parent
42d03696a0
commit
71c021cd88
@@ -89,7 +89,6 @@ static const struct npcm_reset_info npxm8xx_reset_info[] = {
|
||||
|
||||
struct npcm_rc_data {
|
||||
struct reset_controller_dev rcdev;
|
||||
struct notifier_block restart_nb;
|
||||
const struct npcm_reset_info *info;
|
||||
struct regmap *gcr_regmap;
|
||||
u32 sw_reset_number;
|
||||
@@ -100,11 +99,9 @@ struct npcm_rc_data {
|
||||
|
||||
#define to_rc_data(p) container_of(p, struct npcm_rc_data, rcdev)
|
||||
|
||||
static int npcm_rc_restart(struct notifier_block *nb, unsigned long mode,
|
||||
void *cmd)
|
||||
static int npcm_rc_restart(struct sys_off_data *data)
|
||||
{
|
||||
struct npcm_rc_data *rc = container_of(nb, struct npcm_rc_data,
|
||||
restart_nb);
|
||||
struct npcm_rc_data *rc = data->cb_data;
|
||||
|
||||
writel(NPCM_SWRST << rc->sw_reset_number, rc->base + NPCM_SWRSTR);
|
||||
mdelay(1000);
|
||||
@@ -472,9 +469,8 @@ static int npcm_rc_probe(struct platform_device *pdev)
|
||||
if (!of_property_read_u32(pdev->dev.of_node, "nuvoton,sw-reset-number",
|
||||
&rc->sw_reset_number)) {
|
||||
if (rc->sw_reset_number && rc->sw_reset_number < 5) {
|
||||
rc->restart_nb.priority = 192;
|
||||
rc->restart_nb.notifier_call = npcm_rc_restart;
|
||||
ret = register_restart_handler(&rc->restart_nb);
|
||||
ret = devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_RESTART, 192,
|
||||
npcm_rc_restart, rc);
|
||||
if (ret) {
|
||||
dev_warn(&pdev->dev, "failed to register restart handler\n");
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user