| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ads7871 - driver for TI ADS7871 A/D converter |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2010 Paul Thomas <pthomas8589@gmail.com> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 7 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 8 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 9 | | - * GNU General Public License for more details. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 12 | | - * it under the terms of the GNU General Public License version 2 or |
|---|
| 13 | | - * later as publishhed by the Free Software Foundation. |
|---|
| 14 | 6 | * |
|---|
| 15 | 7 | * You need to have something like this in struct spi_board_info |
|---|
| 16 | 8 | * { |
|---|
| .. | .. |
|---|
| 96 | 88 | return spi_write(spi, tmp, sizeof(tmp)); |
|---|
| 97 | 89 | } |
|---|
| 98 | 90 | |
|---|
| 99 | | -static ssize_t show_voltage(struct device *dev, |
|---|
| 100 | | - struct device_attribute *da, char *buf) |
|---|
| 91 | +static ssize_t voltage_show(struct device *dev, struct device_attribute *da, |
|---|
| 92 | + char *buf) |
|---|
| 101 | 93 | { |
|---|
| 102 | 94 | struct ads7871_data *pdata = dev_get_drvdata(dev); |
|---|
| 103 | 95 | struct spi_device *spi = pdata->spi; |
|---|
| .. | .. |
|---|
| 138 | 130 | } |
|---|
| 139 | 131 | } |
|---|
| 140 | 132 | |
|---|
| 141 | | -static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); |
|---|
| 142 | | -static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); |
|---|
| 143 | | -static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); |
|---|
| 144 | | -static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_voltage, NULL, 3); |
|---|
| 145 | | -static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_voltage, NULL, 4); |
|---|
| 146 | | -static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5); |
|---|
| 147 | | -static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); |
|---|
| 148 | | -static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); |
|---|
| 133 | +static SENSOR_DEVICE_ATTR_RO(in0_input, voltage, 0); |
|---|
| 134 | +static SENSOR_DEVICE_ATTR_RO(in1_input, voltage, 1); |
|---|
| 135 | +static SENSOR_DEVICE_ATTR_RO(in2_input, voltage, 2); |
|---|
| 136 | +static SENSOR_DEVICE_ATTR_RO(in3_input, voltage, 3); |
|---|
| 137 | +static SENSOR_DEVICE_ATTR_RO(in4_input, voltage, 4); |
|---|
| 138 | +static SENSOR_DEVICE_ATTR_RO(in5_input, voltage, 5); |
|---|
| 139 | +static SENSOR_DEVICE_ATTR_RO(in6_input, voltage, 6); |
|---|
| 140 | +static SENSOR_DEVICE_ATTR_RO(in7_input, voltage, 7); |
|---|
| 149 | 141 | |
|---|
| 150 | 142 | static struct attribute *ads7871_attrs[] = { |
|---|
| 151 | 143 | &sensor_dev_attr_in0_input.dev_attr.attr, |
|---|