Skip to content

Commit c0e5a43

Browse files
glneonmenon
authored andcommitted
firmware: ti_sci: Use devm_register_restart_handler()
Use device life-cycle managed register function to simplify probe. Signed-off-by: Andrew Davis <[email protected]> Reviewed-by: Gabriel Somlo <[email protected]> Reviewed-by: Markus Schneider-Pargmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Nishanth Menon <[email protected]>
1 parent 4cece76 commit c0e5a43

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

drivers/firmware/ti_sci.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ struct ti_sci_desc {
8787
* struct ti_sci_info - Structure representing a TI SCI instance
8888
* @dev: Device pointer
8989
* @desc: SoC description for this instance
90-
* @nb: Reboot Notifier block
9190
* @d: Debugfs file entry
9291
* @debug_region: Memory region where the debug message are available
9392
* @debug_region_size: Debug region size
@@ -103,7 +102,6 @@ struct ti_sci_desc {
103102
*/
104103
struct ti_sci_info {
105104
struct device *dev;
106-
struct notifier_block nb;
107105
const struct ti_sci_desc *desc;
108106
struct dentry *d;
109107
void __iomem *debug_region;
@@ -122,7 +120,6 @@ struct ti_sci_info {
122120

123121
#define cl_to_ti_sci_info(c) container_of(c, struct ti_sci_info, cl)
124122
#define handle_to_ti_sci_info(h) container_of(h, struct ti_sci_info, handle)
125-
#define reboot_to_ti_sci_info(n) container_of(n, struct ti_sci_info, nb)
126123

127124
#ifdef CONFIG_DEBUG_FS
128125

@@ -3254,10 +3251,9 @@ devm_ti_sci_get_resource(const struct ti_sci_handle *handle, struct device *dev,
32543251
}
32553252
EXPORT_SYMBOL_GPL(devm_ti_sci_get_resource);
32563253

3257-
static int tisci_reboot_handler(struct notifier_block *nb, unsigned long mode,
3258-
void *cmd)
3254+
static int tisci_reboot_handler(struct sys_off_data *data)
32593255
{
3260-
struct ti_sci_info *info = reboot_to_ti_sci_info(nb);
3256+
struct ti_sci_info *info = data->cb_data;
32613257
const struct ti_sci_handle *handle = &info->handle;
32623258

32633259
ti_sci_cmd_core_reboot(handle);
@@ -3400,10 +3396,9 @@ static int ti_sci_probe(struct platform_device *pdev)
34003396
ti_sci_setup_ops(info);
34013397

34023398
if (reboot) {
3403-
info->nb.notifier_call = tisci_reboot_handler;
3404-
info->nb.priority = 128;
3405-
3406-
ret = register_restart_handler(&info->nb);
3399+
ret = devm_register_restart_handler(dev,
3400+
tisci_reboot_handler,
3401+
info);
34073402
if (ret) {
34083403
dev_err(dev, "reboot registration fail(%d)\n", ret);
34093404
goto out;

0 commit comments

Comments
 (0)