.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * MEN 14F021P00 Board Management Controller (BMC) hwmon driver. |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * driver through sysfs. |
---|
7 | 8 | * |
---|
8 | 9 | * Copyright (C) 2014 MEN Mikro Elektronik Nuernberg GmbH |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or modify it |
---|
11 | | - * under the terms of the GNU General Public License as published by the |
---|
12 | | - * Free Software Foundation; either version 2 of the License, or (at your |
---|
13 | | - * option) any later version. |
---|
14 | 10 | */ |
---|
15 | 11 | |
---|
16 | 12 | #include <linux/module.h> |
---|
.. | .. |
---|
101 | 97 | } |
---|
102 | 98 | |
---|
103 | 99 | static ssize_t |
---|
104 | | -show_label(struct device *dev, struct device_attribute *devattr, char *buf) |
---|
| 100 | +label_show(struct device *dev, struct device_attribute *devattr, char *buf) |
---|
105 | 101 | { |
---|
106 | 102 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
---|
107 | 103 | |
---|
.. | .. |
---|
109 | 105 | } |
---|
110 | 106 | |
---|
111 | 107 | static ssize_t |
---|
112 | | -show_in(struct device *dev, struct device_attribute *devattr, char *buf) |
---|
| 108 | +in_show(struct device *dev, struct device_attribute *devattr, char *buf) |
---|
113 | 109 | { |
---|
114 | 110 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
---|
115 | 111 | struct menf21bmc_hwmon *drv_data = menf21bmc_hwmon_update(dev); |
---|
.. | .. |
---|
121 | 117 | } |
---|
122 | 118 | |
---|
123 | 119 | static ssize_t |
---|
124 | | -show_min(struct device *dev, struct device_attribute *devattr, char *buf) |
---|
| 120 | +min_show(struct device *dev, struct device_attribute *devattr, char *buf) |
---|
125 | 121 | { |
---|
126 | 122 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
---|
127 | 123 | struct menf21bmc_hwmon *drv_data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
130 | 126 | } |
---|
131 | 127 | |
---|
132 | 128 | static ssize_t |
---|
133 | | -show_max(struct device *dev, struct device_attribute *devattr, char *buf) |
---|
| 129 | +max_show(struct device *dev, struct device_attribute *devattr, char *buf) |
---|
134 | 130 | { |
---|
135 | 131 | struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); |
---|
136 | 132 | struct menf21bmc_hwmon *drv_data = dev_get_drvdata(dev); |
---|
.. | .. |
---|
138 | 134 | return sprintf(buf, "%d\n", drv_data->in_max[attr->index]); |
---|
139 | 135 | } |
---|
140 | 136 | |
---|
141 | | -#define create_voltage_sysfs(idx) \ |
---|
142 | | -static SENSOR_DEVICE_ATTR(in##idx##_input, S_IRUGO, \ |
---|
143 | | - show_in, NULL, idx); \ |
---|
144 | | -static SENSOR_DEVICE_ATTR(in##idx##_min, S_IRUGO, \ |
---|
145 | | - show_min, NULL, idx); \ |
---|
146 | | -static SENSOR_DEVICE_ATTR(in##idx##_max, S_IRUGO, \ |
---|
147 | | - show_max, NULL, idx); \ |
---|
148 | | -static SENSOR_DEVICE_ATTR(in##idx##_label, S_IRUGO, \ |
---|
149 | | - show_label, NULL, idx); |
---|
150 | | - |
---|
151 | | -create_voltage_sysfs(0); |
---|
152 | | -create_voltage_sysfs(1); |
---|
153 | | -create_voltage_sysfs(2); |
---|
154 | | -create_voltage_sysfs(3); |
---|
155 | | -create_voltage_sysfs(4); |
---|
| 137 | +static SENSOR_DEVICE_ATTR_RO(in0_input, in, 0); |
---|
| 138 | +static SENSOR_DEVICE_ATTR_RO(in0_min, min, 0); |
---|
| 139 | +static SENSOR_DEVICE_ATTR_RO(in0_max, max, 0); |
---|
| 140 | +static SENSOR_DEVICE_ATTR_RO(in0_label, label, 0); |
---|
| 141 | +static SENSOR_DEVICE_ATTR_RO(in1_input, in, 1); |
---|
| 142 | +static SENSOR_DEVICE_ATTR_RO(in1_min, min, 1); |
---|
| 143 | +static SENSOR_DEVICE_ATTR_RO(in1_max, max, 1); |
---|
| 144 | +static SENSOR_DEVICE_ATTR_RO(in1_label, label, 1); |
---|
| 145 | +static SENSOR_DEVICE_ATTR_RO(in2_input, in, 2); |
---|
| 146 | +static SENSOR_DEVICE_ATTR_RO(in2_min, min, 2); |
---|
| 147 | +static SENSOR_DEVICE_ATTR_RO(in2_max, max, 2); |
---|
| 148 | +static SENSOR_DEVICE_ATTR_RO(in2_label, label, 2); |
---|
| 149 | +static SENSOR_DEVICE_ATTR_RO(in3_input, in, 3); |
---|
| 150 | +static SENSOR_DEVICE_ATTR_RO(in3_min, min, 3); |
---|
| 151 | +static SENSOR_DEVICE_ATTR_RO(in3_max, max, 3); |
---|
| 152 | +static SENSOR_DEVICE_ATTR_RO(in3_label, label, 3); |
---|
| 153 | +static SENSOR_DEVICE_ATTR_RO(in4_input, in, 4); |
---|
| 154 | +static SENSOR_DEVICE_ATTR_RO(in4_min, min, 4); |
---|
| 155 | +static SENSOR_DEVICE_ATTR_RO(in4_max, max, 4); |
---|
| 156 | +static SENSOR_DEVICE_ATTR_RO(in4_label, label, 4); |
---|
156 | 157 | |
---|
157 | 158 | static struct attribute *menf21bmc_hwmon_attrs[] = { |
---|
158 | 159 | &sensor_dev_attr_in0_input.dev_attr.attr, |
---|