Use devm_add_action_or_reset() for calling i8k_exit_procfs()
so the remove() function in dell_smm_driver can be omitted.
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Pali Rohár <pali@kernel.org>
Tested-by: Pali Rohár <pali@kernel.org>
Link: https://lore.kernel.org/r/20210728221557.8891-4-W_Armin@gmx.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
.proc_ioctl = i8k_ioctl,
};
.proc_ioctl = i8k_ioctl,
};
-static void __init i8k_init_procfs(void)
+static void i8k_exit_procfs(void *param)
- /* Register the proc entry */
- proc_create("i8k", 0, NULL, &i8k_proc_ops);
+ remove_proc_entry("i8k", NULL);
-static void __exit i8k_exit_procfs(void)
+static void __init i8k_init_procfs(struct device *dev)
- remove_proc_entry("i8k", NULL);
+ /* Register the proc entry */
+ proc_create("i8k", 0, NULL, &i8k_proc_ops);
+
+ devm_add_action_or_reset(dev, i8k_exit_procfs, NULL);
-static inline void __init i8k_init_procfs(void)
-{
-}
-
-static inline void __exit i8k_exit_procfs(void)
+static void __init i8k_init_procfs(struct device *dev)
- i8k_init_procfs();
-
- return 0;
-}
-
-static int dell_smm_remove(struct platform_device *pdev)
-{
- i8k_exit_procfs();
+ i8k_init_procfs(&pdev->dev);
.driver = {
.name = KBUILD_MODNAME,
},
.driver = {
.name = KBUILD_MODNAME,
},
- .remove = dell_smm_remove,
};
static struct platform_device *dell_smm_device;
};
static struct platform_device *dell_smm_device;