Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: Loongson: Fix boot warning about hwmon_device_register()

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>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>

authored by

Zhi Li and committed by
Thomas Bogendoerfer
f59dc511 17cbb070

+2 -20
+2 -20
drivers/platform/mips/cpu_hwmon.c
··· 55 55 static int nr_packages; 56 56 static struct device *cpu_hwmon_dev; 57 57 58 - static ssize_t get_hwmon_name(struct device *dev, 59 - struct device_attribute *attr, char *buf); 60 - static SENSOR_DEVICE_ATTR(name, 0444, get_hwmon_name, NULL, 0); 58 + static SENSOR_DEVICE_ATTR(name, 0444, NULL, NULL, 0); 61 59 62 60 static struct attribute *cpu_hwmon_attributes[] = { 63 61 &sensor_dev_attr_name.dev_attr.attr, ··· 66 68 static struct attribute_group cpu_hwmon_attribute_group = { 67 69 .attrs = cpu_hwmon_attributes, 68 70 }; 69 - 70 - /* Hwmon device get name */ 71 - static ssize_t get_hwmon_name(struct device *dev, 72 - struct device_attribute *attr, char *buf) 73 - { 74 - return sprintf(buf, "cpu-hwmon\n"); 75 - } 76 71 77 72 static ssize_t get_cpu_temp(struct device *dev, 78 73 struct device_attribute *attr, char *buf); ··· 167 176 csr_temp_enable = csr_readl(LOONGSON_CSR_FEATURES) & 168 177 LOONGSON_CSRF_TEMP; 169 178 170 - cpu_hwmon_dev = hwmon_device_register(NULL); 179 + cpu_hwmon_dev = hwmon_device_register_with_info(NULL, "cpu_hwmon", NULL, NULL, NULL); 171 180 if (IS_ERR(cpu_hwmon_dev)) { 172 181 ret = PTR_ERR(cpu_hwmon_dev); 173 182 pr_err("hwmon_device_register fail!\n"); ··· 176 185 177 186 nr_packages = loongson_sysconf.nr_cpus / 178 187 loongson_sysconf.cores_per_package; 179 - 180 - ret = sysfs_create_group(&cpu_hwmon_dev->kobj, 181 - &cpu_hwmon_attribute_group); 182 - if (ret) { 183 - pr_err("fail to create loongson hwmon!\n"); 184 - goto fail_sysfs_create_group_hwmon; 185 - } 186 188 187 189 ret = create_sysfs_cputemp_files(&cpu_hwmon_dev->kobj); 188 190 if (ret) { ··· 191 207 fail_create_sysfs_cputemp_files: 192 208 sysfs_remove_group(&cpu_hwmon_dev->kobj, 193 209 &cpu_hwmon_attribute_group); 194 - 195 - fail_sysfs_create_group_hwmon: 196 210 hwmon_device_unregister(cpu_hwmon_dev); 197 211 198 212 fail_hwmon_device_register: