mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
power: reset: gemini-poweroff: Use devm_register_sys_off_handler(POWER_OFF)
Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20240212162831.67838-17-afd@ti.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
parent
348fde771c
commit
b6475c3f81
@ -70,12 +70,9 @@ static irqreturn_t gemini_powerbutton_interrupt(int irq, void *data)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
/* This callback needs this static local as it has void as argument */
|
||||
static struct gemini_powercon *gpw_poweroff;
|
||||
|
||||
static void gemini_poweroff(void)
|
||||
static int gemini_poweroff(struct sys_off_data *data)
|
||||
{
|
||||
struct gemini_powercon *gpw = gpw_poweroff;
|
||||
struct gemini_powercon *gpw = data->cb_data;
|
||||
u32 val;
|
||||
|
||||
dev_crit(gpw->dev, "Gemini power off\n");
|
||||
@ -86,6 +83,8 @@ static void gemini_poweroff(void)
|
||||
val &= ~GEMINI_CTRL_ENABLE;
|
||||
val |= GEMINI_CTRL_SHUTDOWN;
|
||||
writel(val, gpw->base + GEMINI_PWC_CTRLREG);
|
||||
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static int gemini_poweroff_probe(struct platform_device *pdev)
|
||||
@ -148,8 +147,11 @@ static int gemini_poweroff_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
pm_power_off = gemini_poweroff;
|
||||
gpw_poweroff = gpw;
|
||||
ret = devm_register_sys_off_handler(dev, SYS_OFF_MODE_POWER_OFF,
|
||||
SYS_OFF_PRIO_DEFAULT,
|
||||
gemini_poweroff, gpw);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev_info(dev, "Gemini poweroff driver registered\n");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user