| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * drivers/hwmon/nsa320-hwmon.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 7 | 8 | * Copyright (C) 2016 Adam Baker <linux@baker-net.org.uk> |
|---|
| 8 | 9 | * based on a board file driver |
|---|
| 9 | 10 | * Copyright (C) 2012 Peter Schildmann <linux@schildmann.info> |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 12 | | - * under the terms of the GNU General Public License v2 as published by the |
|---|
| 13 | | - * Free Software Foundation. |
|---|
| 14 | | - * |
|---|
| 15 | | - * This program is distributed in the hope that it will be useful, but WITHOUT |
|---|
| 16 | | - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|---|
| 17 | | - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
|---|
| 18 | | - * more details. |
|---|
| 19 | 11 | */ |
|---|
| 20 | 12 | |
|---|
| 21 | 13 | #include <linux/bitops.h> |
|---|
| .. | .. |
|---|
| 114 | 106 | return mcu_data; |
|---|
| 115 | 107 | } |
|---|
| 116 | 108 | |
|---|
| 117 | | -static ssize_t show_label(struct device *dev, |
|---|
| 118 | | - struct device_attribute *attr, char *buf) |
|---|
| 109 | +static ssize_t label_show(struct device *dev, struct device_attribute *attr, |
|---|
| 110 | + char *buf) |
|---|
| 119 | 111 | { |
|---|
| 120 | 112 | int channel = to_sensor_dev_attr(attr)->index; |
|---|
| 121 | 113 | |
|---|
| .. | .. |
|---|
| 144 | 136 | return sprintf(buf, "%d\n", ((mcu_data & 0xff0000) >> 16) * 100); |
|---|
| 145 | 137 | } |
|---|
| 146 | 138 | |
|---|
| 147 | | -static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, NSA320_TEMP); |
|---|
| 139 | +static SENSOR_DEVICE_ATTR_RO(temp1_label, label, NSA320_TEMP); |
|---|
| 148 | 140 | static DEVICE_ATTR_RO(temp1_input); |
|---|
| 149 | | -static SENSOR_DEVICE_ATTR(fan1_label, S_IRUGO, show_label, NULL, NSA320_FAN); |
|---|
| 141 | +static SENSOR_DEVICE_ATTR_RO(fan1_label, label, NSA320_FAN); |
|---|
| 150 | 142 | static DEVICE_ATTR_RO(fan1_input); |
|---|
| 151 | 143 | |
|---|
| 152 | 144 | static struct attribute *nsa320_attrs[] = { |
|---|