hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/hwmon/ibmpex.c
....@@ -1,22 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * A hwmon driver for the IBM PowerExecutive temperature/power sensors
34 * Copyright (C) 2007 IBM
45 *
56 * Author: Darrick J. Wong <darrick.wong@oracle.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
207 */
218
229 #include <linux/ipmi.h>
....@@ -84,7 +71,7 @@
8471
8572 struct ipmi_addr address;
8673 struct completion read_complete;
87
- ipmi_user_t user;
74
+ struct ipmi_user *user;
8875 int interface;
8976
9077 struct kernel_ipmi_msg tx_message;
....@@ -269,12 +256,12 @@
269256 return NULL;
270257 }
271258
272
-static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
259
+static ssize_t name_show(struct device *dev, struct device_attribute *devattr,
273260 char *buf)
274261 {
275262 return sprintf(buf, "%s\n", DRVNAME);
276263 }
277
-static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0);
264
+static SENSOR_DEVICE_ATTR_RO(name, name, 0);
278265
279266 static ssize_t ibmpex_show_sensor(struct device *dev,
280267 struct device_attribute *devattr,
....@@ -289,10 +276,9 @@
289276 data->sensors[attr->index].values[attr->nr] * mult);
290277 }
291278
292
-static ssize_t ibmpex_reset_high_low(struct device *dev,
279
+static ssize_t ibmpex_high_low_store(struct device *dev,
293280 struct device_attribute *devattr,
294
- const char *buf,
295
- size_t count)
281
+ const char *buf, size_t count)
296282 {
297283 struct ibmpex_bmc_data *data = dev_get_drvdata(dev);
298284
....@@ -301,8 +287,7 @@
301287 return count;
302288 }
303289
304
-static SENSOR_DEVICE_ATTR(reset_high_low, S_IWUSR, NULL,
305
- ibmpex_reset_high_low, 0);
290
+static SENSOR_DEVICE_ATTR_WO(reset_high_low, ibmpex_high_low, 0);
306291
307292 static int is_power_sensor(const char *sensor_id, int len)
308293 {
....@@ -358,7 +343,7 @@
358343
359344 sysfs_attr_init(&data->sensors[sensor].attr[func].dev_attr.attr);
360345 data->sensors[sensor].attr[func].dev_attr.attr.name = n;
361
- data->sensors[sensor].attr[func].dev_attr.attr.mode = S_IRUGO;
346
+ data->sensors[sensor].attr[func].dev_attr.attr.mode = 0444;
362347 data->sensors[sensor].attr[func].dev_attr.show = ibmpex_show_sensor;
363348 data->sensors[sensor].attr[func].index = sensor;
364349 data->sensors[sensor].attr[func].nr = func;
....@@ -517,6 +502,7 @@
517502 return;
518503
519504 out_register:
505
+ list_del(&data->list);
520506 hwmon_device_unregister(data->hwmon_dev);
521507 out_user:
522508 ipmi_destroy_user(data->user);