.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * A hwmon driver for the IBM PowerExecutive temperature/power sensors |
---|
3 | 4 | * Copyright (C) 2007 IBM |
---|
4 | 5 | * |
---|
5 | 6 | * 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 |
---|
20 | 7 | */ |
---|
21 | 8 | |
---|
22 | 9 | #include <linux/ipmi.h> |
---|
.. | .. |
---|
84 | 71 | |
---|
85 | 72 | struct ipmi_addr address; |
---|
86 | 73 | struct completion read_complete; |
---|
87 | | - ipmi_user_t user; |
---|
| 74 | + struct ipmi_user *user; |
---|
88 | 75 | int interface; |
---|
89 | 76 | |
---|
90 | 77 | struct kernel_ipmi_msg tx_message; |
---|
.. | .. |
---|
269 | 256 | return NULL; |
---|
270 | 257 | } |
---|
271 | 258 | |
---|
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, |
---|
273 | 260 | char *buf) |
---|
274 | 261 | { |
---|
275 | 262 | return sprintf(buf, "%s\n", DRVNAME); |
---|
276 | 263 | } |
---|
277 | | -static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); |
---|
| 264 | +static SENSOR_DEVICE_ATTR_RO(name, name, 0); |
---|
278 | 265 | |
---|
279 | 266 | static ssize_t ibmpex_show_sensor(struct device *dev, |
---|
280 | 267 | struct device_attribute *devattr, |
---|
.. | .. |
---|
289 | 276 | data->sensors[attr->index].values[attr->nr] * mult); |
---|
290 | 277 | } |
---|
291 | 278 | |
---|
292 | | -static ssize_t ibmpex_reset_high_low(struct device *dev, |
---|
| 279 | +static ssize_t ibmpex_high_low_store(struct device *dev, |
---|
293 | 280 | struct device_attribute *devattr, |
---|
294 | | - const char *buf, |
---|
295 | | - size_t count) |
---|
| 281 | + const char *buf, size_t count) |
---|
296 | 282 | { |
---|
297 | 283 | struct ibmpex_bmc_data *data = dev_get_drvdata(dev); |
---|
298 | 284 | |
---|
.. | .. |
---|
301 | 287 | return count; |
---|
302 | 288 | } |
---|
303 | 289 | |
---|
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); |
---|
306 | 291 | |
---|
307 | 292 | static int is_power_sensor(const char *sensor_id, int len) |
---|
308 | 293 | { |
---|
.. | .. |
---|
358 | 343 | |
---|
359 | 344 | sysfs_attr_init(&data->sensors[sensor].attr[func].dev_attr.attr); |
---|
360 | 345 | 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; |
---|
362 | 347 | data->sensors[sensor].attr[func].dev_attr.show = ibmpex_show_sensor; |
---|
363 | 348 | data->sensors[sensor].attr[func].index = sensor; |
---|
364 | 349 | data->sensors[sensor].attr[func].nr = func; |
---|
.. | .. |
---|
517 | 502 | return; |
---|
518 | 503 | |
---|
519 | 504 | out_register: |
---|
| 505 | + list_del(&data->list); |
---|
520 | 506 | hwmon_device_unregister(data->hwmon_dev); |
---|
521 | 507 | out_user: |
---|
522 | 508 | ipmi_destroy_user(data->user); |
---|