linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zhi Li <lizhi01@loongson.cn>
To: chenhc@lemote.com, jiaxun.yang@flygoat.com,
	tsbogend@alpha.franken.de, lixuefeng@loongson.cn
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 3/3] MIPS: Loongson: Fix boot warning about hwmon_device_register()
Date: Thu,  9 Jul 2020 11:55:21 +0800	[thread overview]
Message-ID: <1594266921-28971-4-git-send-email-lizhi01@loongson.cn> (raw)
In-Reply-To: <1594266921-28971-1-git-send-email-lizhi01@loongson.cn>

Replace hwmon_device_register() with hwmon_device_register_with_info()
to fix the following boot warning :

[    9.029924] Loongson Hwmon Enter...
[    9.106850] (NULL device *): hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().

Signed-off-by: Zhi Li <lizhi01@loongson.cn>
---
 drivers/platform/mips/cpu_hwmon.c | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/drivers/platform/mips/cpu_hwmon.c b/drivers/platform/mips/cpu_hwmon.c
index c9f35e5..386389f 100644
--- a/drivers/platform/mips/cpu_hwmon.c
+++ b/drivers/platform/mips/cpu_hwmon.c
@@ -55,9 +55,7 @@ int loongson3_cpu_temp(int cpu)
 static int nr_packages;
 static struct device *cpu_hwmon_dev;
 
-static ssize_t get_hwmon_name(struct device *dev,
-			struct device_attribute *attr, char *buf);
-static SENSOR_DEVICE_ATTR(name, 0444, get_hwmon_name, NULL, 0);
+static SENSOR_DEVICE_ATTR(name, 0444, NULL, NULL, 0);
 
 static struct attribute *cpu_hwmon_attributes[] = {
 	&sensor_dev_attr_name.dev_attr.attr,
@@ -69,13 +67,6 @@ static struct attribute_group cpu_hwmon_attribute_group = {
 	.attrs = cpu_hwmon_attributes,
 };
 
-/* Hwmon device get name */
-static ssize_t get_hwmon_name(struct device *dev,
-			struct device_attribute *attr, char *buf)
-{
-	return sprintf(buf, "cpu-hwmon\n");
-}
-
 static ssize_t get_cpu_temp(struct device *dev,
 			struct device_attribute *attr, char *buf);
 static ssize_t cpu_temp_label(struct device *dev,
@@ -176,7 +167,7 @@ static int __init loongson_hwmon_init(void)
 		csr_temp_enable = csr_readl(LOONGSON_CSR_FEATURES) &
 				  LOONGSON_CSRF_TEMP;
 
-	cpu_hwmon_dev = hwmon_device_register(NULL);
+	cpu_hwmon_dev = hwmon_device_register_with_info(NULL, "cpu_hwmon", NULL, NULL, NULL);
 	if (IS_ERR(cpu_hwmon_dev)) {
 		ret = PTR_ERR(cpu_hwmon_dev);
 		pr_err("hwmon_device_register fail!\n");
@@ -186,13 +177,6 @@ static int __init loongson_hwmon_init(void)
 	nr_packages = loongson_sysconf.nr_cpus /
 		loongson_sysconf.cores_per_package;
 
-	ret = sysfs_create_group(&cpu_hwmon_dev->kobj,
-				&cpu_hwmon_attribute_group);
-	if (ret) {
-		pr_err("fail to create loongson hwmon!\n");
-		goto fail_sysfs_create_group_hwmon;
-	}
-
 	ret = create_sysfs_cputemp_files(&cpu_hwmon_dev->kobj);
 	if (ret) {
 		pr_err("fail to create cpu temperature interface!\n");
@@ -207,8 +191,6 @@ static int __init loongson_hwmon_init(void)
 fail_create_sysfs_cputemp_files:
 	sysfs_remove_group(&cpu_hwmon_dev->kobj,
 				&cpu_hwmon_attribute_group);
-
-fail_sysfs_create_group_hwmon:
 	hwmon_device_unregister(cpu_hwmon_dev);
 
 fail_hwmon_device_register:
-- 
2.1.0


  parent reply	other threads:[~2020-07-09  3:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09  3:55 [PATCH v3 0/3] MIPS: Loongson: Fix some issues of cpu_hwmon.c Zhi Li
2020-07-09  3:55 ` [PATCH v3 1/3] MIPS: Loongson: Cleanup cpu_hwmon.c Zhi Li
2020-07-09  3:55 ` [PATCH v3 2/3] MIPS: Loongson: Reduce possible loop times and add log in do_thermal_timer() Zhi Li
2020-07-09  3:55 ` Zhi Li [this message]
2020-07-16  9:45 ` [PATCH v3 0/3] MIPS: Loongson: Fix some issues of cpu_hwmon.c Thomas Bogendoerfer

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=1594266921-28971-4-git-send-email-lizhi01@loongson.cn \
    --to=lizhi01@loongson.cn \
    --cc=chenhc@lemote.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=tsbogend@alpha.franken.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).