forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/hwmon/ibmpowernv.c
....@@ -1,19 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * IBM PowerNV platform sensors for temperature/fan/voltage/power
34 * Copyright (C) 2014 IBM
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License, or
8
- * (at your option) any later version.
9
- *
10
- * This program is distributed in the hope that it will be useful,
11
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
- * GNU General Public License for more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program.
175 */
186
197 #define DRVNAME "ibmpowernv"
....@@ -198,7 +186,7 @@
198186 u32 id;
199187 size_t n;
200188
201
- n = snprintf(sdata->label, sizeof(sdata->label), "%s", label);
189
+ n = scnprintf(sdata->label, sizeof(sdata->label), "%s", label);
202190
203191 /*
204192 * Core temp pretty print
....@@ -211,11 +199,11 @@
211199 * The digital thermal sensors are associated
212200 * with a core.
213201 */
214
- n += snprintf(sdata->label + n,
202
+ n += scnprintf(sdata->label + n,
215203 sizeof(sdata->label) - n, " %d",
216204 cpuid);
217205 else
218
- n += snprintf(sdata->label + n,
206
+ n += scnprintf(sdata->label + n,
219207 sizeof(sdata->label) - n, " phy%d", id);
220208 }
221209
....@@ -223,7 +211,7 @@
223211 * Membuffer pretty print
224212 */
225213 if (!of_property_read_u32(np, "ibm,chip-id", &id))
226
- n += snprintf(sdata->label + n, sizeof(sdata->label) - n,
214
+ n += scnprintf(sdata->label + n, sizeof(sdata->label) - n,
227215 " %d", id & 0xffff);
228216 }
229217
....@@ -457,9 +445,6 @@
457445 for_each_child_of_node(opal, np) {
458446 const char *label;
459447
460
- if (np->name == NULL)
461
- continue;
462
-
463448 type = get_sensor_type(np);
464449 if (type == MAX_SENSOR_TYPE)
465450 continue;
....@@ -588,9 +573,6 @@
588573 const char *label;
589574 enum sensors type;
590575
591
- if (np->name == NULL)
592
- continue;
593
-
594576 type = get_sensor_type(np);
595577 if (type == MAX_SENSOR_TYPE)
596578 continue;
....@@ -602,8 +584,8 @@
602584 if (of_property_read_u32(np, "sensor-id", &sensor_id) &&
603585 of_property_read_u32(np, "sensor-data", &sensor_id)) {
604586 dev_info(&pdev->dev,
605
- "'sensor-id' missing in the node '%s'\n",
606
- np->name);
587
+ "'sensor-id' missing in the node '%pOFn'\n",
588
+ np);
607589 continue;
608590 }
609591