hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/hwmon/jc42.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * jc42.c - driver for Jedec JC42.4 compliant temperature sensors
34 *
....@@ -6,20 +7,6 @@
67 * Derived from lm77.c by Andras BALI <drewie@freemail.hu>.
78 *
89 * JC42.4 compliant temperature sensors are typically used on memory modules.
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2 of the License, or
13
- * (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful,
16
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
- * GNU General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program; if not, write to the Free Software
22
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2310 */
2411
2512 #include <linux/bitops.h>
....@@ -390,21 +377,21 @@
390377 {
391378 const struct jc42_data *data = _data;
392379 unsigned int config = data->config;
393
- umode_t mode = S_IRUGO;
380
+ umode_t mode = 0444;
394381
395382 switch (attr) {
396383 case hwmon_temp_min:
397384 case hwmon_temp_max:
398385 if (!(config & JC42_CFG_EVENT_LOCK))
399
- mode |= S_IWUSR;
386
+ mode |= 0200;
400387 break;
401388 case hwmon_temp_crit:
402389 if (!(config & JC42_CFG_TCRIT_LOCK))
403
- mode |= S_IWUSR;
390
+ mode |= 0200;
404391 break;
405392 case hwmon_temp_crit_hyst:
406393 if (!(config & (JC42_CFG_EVENT_LOCK | JC42_CFG_TCRIT_LOCK)))
407
- mode |= S_IWUSR;
394
+ mode |= 0200;
408395 break;
409396 case hwmon_temp_input:
410397 case hwmon_temp_max_hyst:
....@@ -451,20 +438,12 @@
451438 return -ENODEV;
452439 }
453440
454
-static const u32 jc42_temp_config[] = {
455
- HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX | HWMON_T_CRIT |
456
- HWMON_T_MAX_HYST | HWMON_T_CRIT_HYST |
457
- HWMON_T_MIN_ALARM | HWMON_T_MAX_ALARM | HWMON_T_CRIT_ALARM,
458
- 0
459
-};
460
-
461
-static const struct hwmon_channel_info jc42_temp = {
462
- .type = hwmon_temp,
463
- .config = jc42_temp_config,
464
-};
465
-
466441 static const struct hwmon_channel_info *jc42_info[] = {
467
- &jc42_temp,
442
+ HWMON_CHANNEL_INFO(temp,
443
+ HWMON_T_INPUT | HWMON_T_MIN | HWMON_T_MAX |
444
+ HWMON_T_CRIT | HWMON_T_MAX_HYST |
445
+ HWMON_T_CRIT_HYST | HWMON_T_MIN_ALARM |
446
+ HWMON_T_MAX_ALARM | HWMON_T_CRIT_ALARM),
468447 NULL
469448 };
470449
....@@ -479,7 +458,7 @@
479458 .info = jc42_info,
480459 };
481460
482
-static int jc42_probe(struct i2c_client *client, const struct i2c_device_id *id)
461
+static int jc42_probe(struct i2c_client *client)
483462 {
484463 struct device *dev = &client->dev;
485464 struct device *hwmon_dev;
....@@ -602,7 +581,7 @@
602581 .pm = JC42_DEV_PM_OPS,
603582 .of_match_table = of_match_ptr(jc42_of_ids),
604583 },
605
- .probe = jc42_probe,
584
+ .probe_new = jc42_probe,
606585 .remove = jc42_remove,
607586 .id_table = jc42_id,
608587 .detect = jc42_detect,