diff options
author | Benjamin Bara <benjamin.bara@skidata.com> | 2023-07-15 10:53:25 +0300 |
---|---|---|
committer | Lee Jones <lee@kernel.org> | 2023-07-28 13:33:09 +0300 |
commit | db2d6038c5e795cab4f0a8d3e86b4f7e33338629 (patch) | |
tree | 6b318ccae04af4045ba2b81632021e9a4b11c1ce /kernel/reboot.c | |
parent | aa49c90894d06e18a1ee7c095edbd2f37c232d02 (diff) | |
download | linux-db2d6038c5e795cab4f0a8d3e86b4f7e33338629.tar.xz |
kernel/reboot: Add device to sys_off_handler
If the dev is known (e.g. a devm-based sys_off_handler is used), it can
be passed to the handler's callback to have it available there.
Otherwise, cb_data might be set to the dev in most of the cases.
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
Link: https://lore.kernel.org/r/20230327-tegra-pmic-reboot-v7-3-18699d5dcd76@skidata.com
Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'kernel/reboot.c')
-rw-r--r-- | kernel/reboot.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/reboot.c b/kernel/reboot.c index 6ebef11c8876..395a0ea3c7a8 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -55,6 +55,7 @@ struct sys_off_handler { enum sys_off_mode mode; bool blocking; void *list; + struct device *dev; }; /* @@ -324,6 +325,7 @@ static int sys_off_notify(struct notifier_block *nb, data.cb_data = handler->cb_data; data.mode = mode; data.cmd = cmd; + data.dev = handler->dev; return handler->sys_off_cb(&data); } @@ -511,6 +513,7 @@ int devm_register_sys_off_handler(struct device *dev, handler = register_sys_off_handler(mode, priority, callback, cb_data); if (IS_ERR(handler)) return PTR_ERR(handler); + handler->dev = dev; return devm_add_action_or_reset(dev, devm_unregister_sys_off_handler, handler); |