All of lore.kernel.org
 help / color / mirror / Atom feed
From: W_Armin@gmx.de
To: pali@kernel.org
Cc: linux@roeck-us.net, jdelvare@suse.com, linux-hwmon@vger.kernel.org
Subject: [PATCH v2 3/6] hwmon: (dell-smm-hwmon) Use devm_add_action_or_reset()
Date: Fri, 28 May 2021 19:37:13 +0200	[thread overview]
Message-ID: <20210528173716.10975-4-W_Armin@gmx.de> (raw)
In-Reply-To: <20210528173716.10975-1-W_Armin@gmx.de>

From: Armin Wolf <W_Armin@gmx.de>

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>
---
 drivers/hwmon/dell-smm-hwmon.c | 28 +++++++++-------------------
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c
index deba8819164d..ed2c42badf1a 100644
--- a/drivers/hwmon/dell-smm-hwmon.c
+++ b/drivers/hwmon/dell-smm-hwmon.c
@@ -605,24 +605,22 @@ static const struct proc_ops i8k_proc_ops = {
 	.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);
 }

 #else

-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)
 {
 }

@@ -1287,14 +1285,7 @@ static int __init dell_smm_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;

-	i8k_init_procfs();
-
-	return 0;
-}
-
-static int dell_smm_remove(struct platform_device *pdev)
-{
-	i8k_exit_procfs();
+	i8k_init_procfs(&pdev->dev);

 	return 0;
 }
@@ -1303,7 +1294,6 @@ static struct platform_driver dell_smm_driver = {
 	.driver		= {
 		.name	= KBUILD_MODNAME,
 	},
-	.remove		= dell_smm_remove,
 };

 static struct platform_device *dell_smm_device;
--
2.20.1


  parent reply	other threads:[~2021-05-28 17:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28 17:37 [PATCH v2 0/6] Convert to new hwmon registration api W_Armin
2021-05-28 17:37 ` [PATCH v2 1/6] hwmon: (dell-smm-hwmon) Use platform device W_Armin
2021-05-28 18:53   ` Pali Rohár
2021-05-28 21:00     ` Armin Wolf
2021-05-28 17:37 ` [PATCH v2 2/6] hwmon: (dell-smm-hwmon) Mark functions as __init W_Armin
2021-05-28 18:56   ` Pali Rohár
2021-05-28 17:37 ` W_Armin [this message]
2021-05-28 19:02   ` [PATCH v2 3/6] hwmon: (dell-smm-hwmon) Use devm_add_action_or_reset() Pali Rohár
2021-05-28 17:37 ` [PATCH v2 4/6] hwmon: (dell-smm-hwmon) Move variables into a driver private data structure W_Armin
2021-05-28 17:37 ` [PATCH v2 5/6] hwmon: (dell-smm-hwmon) Convert to devm_hwmon_device_register_with_info() W_Armin
2021-05-28 17:37 ` [PATCH v2 6/6] hwmon: (dell-smm-hwmon) Update docs W_Armin
2021-05-28 17:53   ` Pali Rohár
2021-05-28 20:41     ` Armin Wolf
     [not found]     ` <90260e4f-7e3f-20af-7706-add965ae9192@gmx.de>
2021-05-28 21:10       ` Pali Rohár
2021-05-30 13:14       ` Guenter Roeck
2021-05-28 18:32 ` [PATCH v2 0/6] Convert to new hwmon registration api Pali Rohár
2021-05-28 18:40   ` Pali Rohár

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210528173716.10975-4-W_Armin@gmx.de \
    --to=w_armin@gmx.de \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=pali@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.