Commit 87540403 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hwmon-for-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon updates from Guenter Roeck:
 "The big change in this series is for the most part automatic:
  Introducing SENSOR[_DEVICE]_ATTR_{RO,RW,WO} variants and conversion of
  various drivers to use it. This is similar to DEVICE_ATTR variants.

  Other than that, we have

   - Some conversions of S_<PERMS> with octal values, also automated

   - Added support for Hygon Dhyana CPUs to k10temp driver

   - Added support for STLM75 to lm75 driver

   - B57891S0103 to ntc_thermistor

   - Added pm-runtime support to ina3221 driver

   - Support for PowerPC On-Chip Controller (OCC)

   - Various minor bug fices and improvements"

* tag 'hwmon-for-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (80 commits)
  hwmon: (lm80) fix a missing check of bus read in lm80 probe
  hwmon: (lm80) fix a missing check of the status of SMBus read
  hwmon: (asus_atk0110) Fix debugfs_simple_attr.cocci warnings
  hwmon: (ftsteutates) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (fschmd) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (emc6w201) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (emc2103) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (emc1403) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (ds620) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (ds1621) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (dell-smm-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (da9055-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (da9052-hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (coretemp) Replace S_<PERMS> with octal values
  hwmon: (asus_atk0110) Replace S_<PERMS> with octal values
  hwmon: (aspeed-pwm-tacho) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (applesmc) Replace S_<PERMS> with octal values
  hwmon: (amc6821) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (adt7x10) Use permission specific SENSOR[_DEVICE]_ATTR variants
  hwmon: (adt7475) Use permission specific SENSOR[_DEVICE]_ATTR variants
  ...
parents 1984f65c 9aa3aa15
Device-tree bindings for FSI-attached POWER9 On-Chip Controller (OCC)
---------------------------------------------------------------------
This is the binding for the P9 On-Chip Controller accessed over FSI from a
service processor. See fsi.txt for details on bindings for FSI slave and CFAM
nodes. The OCC is not an FSI slave device itself, rather it is accessed
through the SBE fifo.
Required properties:
- compatible = "ibm,p9-occ"
Examples:
occ {
compatible = "ibm,p9-occ";
};
adm1275 properties
Required properties:
- compatible: Must be one of the supported compatible strings:
- "adi,adm1075" for adm1075
- "adi,adm1272" for adm1272
- "adi,adm1275" for adm1275
- "adi,adm1276" for adm1276
- "adi,adm1278" for adm1278
- "adi,adm1293" for adm1293
- "adi,adm1294" for adm1294
- reg: I2C address
Optional properties:
- shunt-resistor-micro-ohms
Shunt resistor value in micro-Ohm
Example:
adm1272@10 {
compatible = "adi,adm1272";
reg = <0x10>;
shunt-resistor-micro-ohms = <500>;
};
...@@ -23,6 +23,7 @@ Required node properties: ...@@ -23,6 +23,7 @@ Required node properties:
"onnn,nct1008" "onnn,nct1008"
"winbond,w83l771" "winbond,w83l771"
"nxp,sa56004" "nxp,sa56004"
"ti,tmp451"
- reg: I2C bus address of the device - reg: I2C bus address of the device
......
...@@ -4,6 +4,7 @@ NTC Thermistor hwmon sensors ...@@ -4,6 +4,7 @@ NTC Thermistor hwmon sensors
Requires node properties: Requires node properties:
- "compatible" value : one of - "compatible" value : one of
"epcos,b57330v2103" "epcos,b57330v2103"
"epcos,b57891s0103"
"murata,ncp15wb473" "murata,ncp15wb473"
"murata,ncp18wb473" "murata,ncp18wb473"
"murata,ncp21wb473" "murata,ncp21wb473"
......
...@@ -7,6 +7,10 @@ Requires node properties: ...@@ -7,6 +7,10 @@ Requires node properties:
- compatible : "ti,tmp108" - compatible : "ti,tmp108"
- reg : the I2C address of the device. This is 0x48, 0x49, 0x4a, or 0x4b. - reg : the I2C address of the device. This is 0x48, 0x49, 0x4a, or 0x4b.
Optional properties:
- interrupts: Reference to the TMP108 alert interrupt.
- #thermal-sensor-cells: should be set to 0.
Example: Example:
tmp108@48 { tmp108@48 {
compatible = "ti,tmp108"; compatible = "ti,tmp108";
......
Device-tree bindings for I2C-based On-Chip Controller hwmon device
------------------------------------------------------------------
Required properties:
- compatible = "ibm,p8-occ-hwmon";
- reg = <I2C address>; : I2C bus address
Examples:
i2c-bus@100 {
#address-cells = <1>;
#size-cells = <0>;
clock-frequency = <100000>;
< more properties >
occ-hwmon@1 {
compatible = "ibm,p8-occ-hwmon";
reg = <0x50>;
};
occ-hwmon@2 {
compatible = "ibm,p8-occ-hwmon";
reg = <0x51>;
};
};
...@@ -58,6 +58,9 @@ The ADM1075, unlike many other PMBus devices, does not support internal voltage ...@@ -58,6 +58,9 @@ The ADM1075, unlike many other PMBus devices, does not support internal voltage
or current scaling. Reported voltages, currents, and power are raw measurements, or current scaling. Reported voltages, currents, and power are raw measurements,
and will typically have to be scaled. and will typically have to be scaled.
The shunt value in micro-ohms can be set via device tree at compile-time. Please
refer to the Documentation/devicetree/bindings/hwmon/adm1275.txt for bindings
if the device tree is used.
Platform data support Platform data support
--------------------- ---------------------
......
...@@ -79,6 +79,18 @@ ADT7490: ...@@ -79,6 +79,18 @@ ADT7490:
* 2 GPIO pins (not implemented) * 2 GPIO pins (not implemented)
* system acoustics optimizations (not implemented) * system acoustics optimizations (not implemented)
Sysfs Mapping
-------------
ADT7490 ADT7476 ADT7475 ADT7473
------- ------- ------- -------
in0 2.5VIN (22) 2.5VIN (22) - -
in1 VCCP (23) VCCP (23) VCCP (14) VCCP (14)
in2 VCC (4) VCC (4) VCC (4) VCC (3)
in3 5VIN (20) 5VIN (20)
in4 12VIN (21) 12VIN (21)
in5 VTT (8)
Special Features Special Features
---------------- ----------------
......
...@@ -299,17 +299,25 @@ functions is used. ...@@ -299,17 +299,25 @@ functions is used.
The header file linux/hwmon-sysfs.h provides a number of useful macros to The header file linux/hwmon-sysfs.h provides a number of useful macros to
declare and use hardware monitoring sysfs attributes. declare and use hardware monitoring sysfs attributes.
In many cases, you can use the exsting define DEVICE_ATTR to declare such In many cases, you can use the exsting define DEVICE_ATTR or its variants
attributes. This is feasible if an attribute has no additional context. However, DEVICE_ATTR_{RW,RO,WO} to declare such attributes. This is feasible if an
in many cases there will be additional information such as a sensor index which attribute has no additional context. However, in many cases there will be
will need to be passed to the sysfs attribute handling function. additional information such as a sensor index which will need to be passed
to the sysfs attribute handling function.
SENSOR_DEVICE_ATTR and SENSOR_DEVICE_ATTR_2 can be used to define attributes SENSOR_DEVICE_ATTR and SENSOR_DEVICE_ATTR_2 can be used to define attributes
which need such additional context information. SENSOR_DEVICE_ATTR requires which need such additional context information. SENSOR_DEVICE_ATTR requires
one additional argument, SENSOR_DEVICE_ATTR_2 requires two. one additional argument, SENSOR_DEVICE_ATTR_2 requires two.
SENSOR_DEVICE_ATTR defines a struct sensor_device_attribute variable. Simplified variants of SENSOR_DEVICE_ATTR and SENSOR_DEVICE_ATTR_2 are available
This structure has the following fields. and should be used if standard attribute permissions and function names are
feasible. Standard permissions are 0644 for SENSOR_DEVICE_ATTR[_2]_RW,
0444 for SENSOR_DEVICE_ATTR[_2]_RO, and 0200 for SENSOR_DEVICE_ATTR[_2]_WO.
Standard functions, similar to DEVICE_ATTR_{RW,RO,WO}, have _show and _store
appended to the provided function name.
SENSOR_DEVICE_ATTR and its variants define a struct sensor_device_attribute
variable. This structure has the following fields.
struct sensor_device_attribute { struct sensor_device_attribute {
struct device_attribute dev_attr; struct device_attribute dev_attr;
...@@ -320,8 +328,8 @@ You can use to_sensor_dev_attr to get the pointer to this structure from the ...@@ -320,8 +328,8 @@ You can use to_sensor_dev_attr to get the pointer to this structure from the
attribute read or write function. Its parameter is the device to which the attribute read or write function. Its parameter is the device to which the
attribute is attached. attribute is attached.
SENSOR_DEVICE_ATTR_2 defines a struct sensor_device_attribute_2 variable, SENSOR_DEVICE_ATTR_2 and its variants define a struct sensor_device_attribute_2
which is defined as follows. variable, which is defined as follows.
struct sensor_device_attribute_2 { struct sensor_device_attribute_2 {
struct device_attribute dev_attr; struct device_attribute dev_attr;
......
...@@ -62,3 +62,18 @@ bus and shunt voltage conversion times multiplied by the averaging rate. We ...@@ -62,3 +62,18 @@ bus and shunt voltage conversion times multiplied by the averaging rate. We
don't touch the conversion times and only modify the number of averages. The don't touch the conversion times and only modify the number of averages. The
lower limit of the update_interval is 2 ms, the upper limit is 2253 ms. lower limit of the update_interval is 2 ms, the upper limit is 2253 ms.
The actual programmed interval may vary from the desired value. The actual programmed interval may vary from the desired value.
General sysfs entries
-------------
in0_input Shunt voltage(mV) channel
in1_input Bus voltage(mV) channel
curr1_input Current(mA) measurement channel
power1_input Power(uW) measurement channel
shunt_resistor Shunt resistance(uOhm) channel
Sysfs entries for ina226, ina230 and ina231 only
-------------
update_interval data conversion time; affects number of samples used
to average results for shunt and bus voltages.
...@@ -42,6 +42,11 @@ Supported chips: ...@@ -42,6 +42,11 @@ Supported chips:
Addresses scanned: none Addresses scanned: none
Datasheet: Publicly available at the ST website Datasheet: Publicly available at the ST website
http://www.st.com/internet/analog/product/121769.jsp http://www.st.com/internet/analog/product/121769.jsp
* ST Microelectronics STLM75
Prefix: 'stlm75'
Addresses scanned: none
Datasheet: Publicly available at the ST website
https://www.st.com/resource/en/datasheet/stlm75.pdf
* Texas Instruments TMP100, TMP101, TMP105, TMP112, TMP75, TMP75C, TMP175, TMP275 * Texas Instruments TMP100, TMP101, TMP105, TMP112, TMP75, TMP75C, TMP175, TMP275
Prefixes: 'tmp100', 'tmp101', 'tmp105', 'tmp112', 'tmp175', 'tmp75', 'tmp75c', 'tmp275' Prefixes: 'tmp100', 'tmp101', 'tmp105', 'tmp112', 'tmp175', 'tmp75', 'tmp75c', 'tmp275'
Addresses scanned: none Addresses scanned: none
......
Kernel driver occ-hwmon
=======================
Supported chips:
* POWER8
* POWER9
Author: Eddie James <eajames@linux.ibm.com>
Description
-----------
This driver supports hardware monitoring for the On-Chip Controller (OCC)
embedded on POWER processors. The OCC is a device that collects and aggregates
sensor data from the processor and the system. The OCC can provide the raw
sensor data as well as perform thermal and power management on the system.
The P8 version of this driver is a client driver of I2C. It may be probed
manually if an "ibm,p8-occ-hwmon" compatible device is found under the
appropriate I2C bus node in the device-tree.
The P9 version of this driver is a client driver of the FSI-based OCC driver.
It will be probed automatically by the FSI-based OCC driver.
Sysfs entries
-------------
The following attributes are supported. All attributes are read-only unless
specified.
The OCC sensor ID is an integer that represents the unique identifier of the
sensor with respect to the OCC. For example, a temperature sensor for the third
DIMM slot in the system may have a sensor ID of 7. This mapping is unavailable
to the device driver, which must therefore export the sensor ID as-is.
Some entries are only present with certain OCC sensor versions or only on
certain OCCs in the system. The version number is not exported to the user
but can be inferred.
temp[1-n]_label OCC sensor ID.
[with temperature sensor version 1]
temp[1-n]_input Measured temperature of the component in millidegrees
Celsius.
[with temperature sensor version >= 2]
temp[1-n]_type The FRU (Field Replaceable Unit) type
(represented by an integer) for the component
that this sensor measures.
temp[1-n]_fault Temperature sensor fault boolean; 1 to indicate
that a fault is present or 0 to indicate that
no fault is present.
[with type == 3 (FRU type is VRM)]
temp[1-n]_alarm VRM temperature alarm boolean; 1 to indicate
alarm, 0 to indicate no alarm
[else]
temp[1-n]_input Measured temperature of the component in
millidegrees Celsius.
freq[1-n]_label OCC sensor ID.
freq[1-n]_input Measured frequency of the component in MHz.
power[1-n]_input Latest measured power reading of the component in
microwatts.
power[1-n]_average Average power of the component in microwatts.
power[1-n]_average_interval The amount of time over which the power average
was taken in microseconds.
[with power sensor version < 2]
power[1-n]_label OCC sensor ID.
[with power sensor version >= 2]
power[1-n]_label OCC sensor ID + function ID + channel in the form
of a string, delimited by underscores, i.e. "0_15_1".
Both the function ID and channel are integers that
further identify the power sensor.
[with power sensor version 0xa0]
power[1-n]_label OCC sensor ID + sensor type in the form of a string,
delimited by an underscore, i.e. "0_system". Sensor
type will be one of "system", "proc", "vdd" or "vdn".
For this sensor version, OCC sensor ID will be the same
for all power sensors.
[present only on "master" OCC; represents the whole system power; only one of
this type of power sensor will be present]
power[1-n]_label "system"
power[1-n]_input Latest system output power in microwatts.
power[1-n]_cap Current system power cap in microwatts.
power[1-n]_cap_not_redundant System power cap in microwatts when
there is not redundant power.
power[1-n]_cap_max Maximum power cap that the OCC can enforce in
microwatts.
power[1-n]_cap_min Minimum power cap that the OCC can enforce in
microwatts.
power[1-n]_cap_user The power cap set by the user, in microwatts.
This attribute will return 0 if no user power
cap has been set. This attribute is read-write,
but writing any precision below watts will be
ignored, i.e. requesting a power cap of
500900000 microwatts will result in a power cap
request of 500 watts.
[with caps sensor version > 1]
power[1-n]_cap_user_source Indicates how the user power cap was
set. This is an integer that maps to
system or firmware components that can
set the user power cap.
The following "extn" sensors are exported as a way for the OCC to provide data
that doesn't fit anywhere else. The meaning of these sensors is entirely
dependent on their data, and cannot be statically defined.
extn[1-n]_label ASCII ID or OCC sensor ID.
extn[1-n]_flags This is one byte hexadecimal value. Bit 7 indicates the
type of the label attribute; 1 for sensor ID, 0 for
ASCII ID. Other bits are reserved.
extn[1-n]_input 6 bytes of hexadecimal data, with a meaning defined by
the sensor ID.
...@@ -65,4 +65,14 @@ config FSI_SBEFIFO ...@@ -65,4 +65,14 @@ config FSI_SBEFIFO
a pipe-like FSI device for communicating with the self boot engine a pipe-like FSI device for communicating with the self boot engine
(SBE) on POWER processors. (SBE) on POWER processors.
config FSI_OCC
tristate "OCC SBEFIFO client device driver"
depends on FSI_SBEFIFO
---help---
This option enables an SBEFIFO based On-Chip Controller (OCC) device
driver. The OCC is a device embedded on a POWER processor that collects
and aggregates sensor data from the processor and system. The OCC can
provide the raw sensor data as well as perform thermal and power
management on the system.
endif endif
...@@ -5,3 +5,4 @@ obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o ...@@ -5,3 +5,4 @@ obj-$(CONFIG_FSI_MASTER_GPIO) += fsi-master-gpio.o
obj-$(CONFIG_FSI_MASTER_AST_CF) += fsi-master-ast-cf.o obj-$(CONFIG_FSI_MASTER_AST_CF) += fsi-master-ast-cf.o
obj-$(CONFIG_FSI_SCOM) += fsi-scom.o obj-$(CONFIG_FSI_SCOM) += fsi-scom.o
obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o obj-$(CONFIG_FSI_SBEFIFO) += fsi-sbefifo.o
obj-$(CONFIG_FSI_OCC) += fsi-occ.o
This diff is collapsed.
This diff is collapsed.
...@@ -178,6 +178,7 @@ obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o ...@@ -178,6 +178,7 @@ obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o
obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o
obj-$(CONFIG_SENSORS_XGENE) += xgene-hwmon.o obj-$(CONFIG_SENSORS_XGENE) += xgene-hwmon.o
obj-$(CONFIG_SENSORS_OCC) += occ/
obj-$(CONFIG_PMBUS) += pmbus/ obj-$(CONFIG_PMBUS) += pmbus/
ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG ccflags-$(CONFIG_HWMON_DEBUG_CHIP) := -DDEBUG
......
...@@ -121,7 +121,7 @@ static void gpadc_monitor(struct work_struct *work) ...@@ -121,7 +121,7 @@ static void gpadc_monitor(struct work_struct *work)
} }
/* HWMON sysfs interfaces */ /* HWMON sysfs interfaces */
static ssize_t show_name(struct device *dev, struct device_attribute *devattr, static ssize_t name_show(struct device *dev, struct device_attribute *devattr,
char *buf) char *buf)
{ {
struct abx500_temp *data = dev_get_drvdata(dev); struct abx500_temp *data = dev_get_drvdata(dev);
...@@ -129,7 +129,7 @@ static ssize_t show_name(struct device *dev, struct device_attribute *devattr, ...@@ -129,7 +129,7 @@ static ssize_t show_name(struct device *dev, struct device_attribute *devattr,
return data->ops.show_name(dev, devattr, buf); return data->ops.show_name(dev, devattr, buf);
} }
static ssize_t show_label(struct device *dev, static ssize_t label_show(struct device *dev,
struct device_attribute *devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
struct abx500_temp *data = dev_get_drvdata(dev); struct abx500_temp *data = dev_get_drvdata(dev);
...@@ -137,7 +137,7 @@ static ssize_t show_label(struct device *dev, ...@@ -137,7 +137,7 @@ static ssize_t show_label(struct device *dev,
return data->ops.show_label(dev, devattr, buf); return data->ops.show_label(dev, devattr, buf);
} }
static ssize_t show_input(struct device *dev, static ssize_t input_show(struct device *dev,
struct device_attribute *devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
int ret, temp; int ret, temp;
...@@ -153,8 +153,8 @@ static ssize_t show_input(struct device *dev, ...@@ -153,8 +153,8 @@ static ssize_t show_input(struct device *dev,
} }
/* Set functions (RW nodes) */ /* Set functions (RW nodes) */
static ssize_t set_min(struct device *dev, struct device_attribute *devattr, static ssize_t min_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long val; unsigned long val;
struct abx500_temp *data = dev_get_drvdata(dev); struct abx500_temp *data = dev_get_drvdata(dev);
...@@ -173,8 +173,8 @@ static ssize_t set_min(struct device *dev, struct device_attribute *devattr, ...@@ -173,8 +173,8 @@ static ssize_t set_min(struct device *dev, struct device_attribute *devattr,
return count; return count;
} }
static ssize_t set_max(struct device *dev, struct device_attribute *devattr, static ssize_t max_store(struct device *dev, struct device_attribute *devattr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long val; unsigned long val;
struct abx500_temp *data = dev_get_drvdata(dev); struct abx500_temp *data = dev_get_drvdata(dev);
...@@ -193,9 +193,9 @@ static ssize_t set_max(struct device *dev, struct device_attribute *devattr, ...@@ -193,9 +193,9 @@ static ssize_t set_max(struct device *dev, struct device_attribute *devattr,
return count; return count;
} }
static ssize_t set_max_hyst(struct device *dev, static ssize_t max_hyst_store(struct device *dev,
struct device_attribute *devattr, struct device_attribute *devattr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
unsigned long val; unsigned long val;
struct abx500_temp *data = dev_get_drvdata(dev); struct abx500_temp *data = dev_get_drvdata(dev);
...@@ -215,8 +215,8 @@ static ssize_t set_max_hyst(struct device *dev, ...@@ -215,8 +215,8 @@ static ssize_t set_max_hyst(struct device *dev,
} }
/* Show functions (RO nodes) */ /* Show functions (RO nodes) */
static ssize_t show_min(struct device *dev, static ssize_t min_show(struct device *dev, struct device_attribute *devattr,
struct device_attribute *devattr, char *buf) char *buf)
{ {
struct abx500_temp *data = dev_get_drvdata(dev); struct abx500_temp *data = dev_get_drvdata(dev);
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
...@@ -224,8 +224,8 @@ static ssize_t show_min(struct device *dev, ...@@ -224,8 +224,8 @@ static ssize_t show_min(struct device *dev,
return sprintf(buf, "%lu\n", data->min[attr->index]); return sprintf(buf, "%lu\n", data->min[attr->index]);
} }
static ssize_t show_max(struct device *dev, static ssize_t max_show(struct device *dev, struct device_attribute *devattr,
struct device_attribute *devattr, char *buf) char *buf)
{ {
struct abx500_temp *data = dev_get_drvdata(dev); struct abx500_temp *data = dev_get_drvdata(dev);
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
...@@ -233,7 +233,7 @@ static ssize_t show_max(struct device *dev, ...@@ -233,7 +233,7 @@ static ssize_t show_max(struct device *dev,
return sprintf(buf, "%lu\n", data->max[attr->index]); return sprintf(buf, "%lu\n", data->max[attr->index]);
} }
static ssize_t show_max_hyst(struct device *dev, static ssize_t max_hyst_show(struct device *dev,
struct device_attribute *devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
struct abx500_temp *data = dev_get_drvdata(dev); struct abx500_temp *data = dev_get_drvdata(dev);
...@@ -242,7 +242,7 @@ static ssize_t show_max_hyst(struct device *dev, ...@@ -242,7 +242,7 @@ static ssize_t show_max_hyst(struct device *dev,
return sprintf(buf, "%lu\n", data->max_hyst[attr->index]); return sprintf(buf, "%lu\n", data->max_hyst[attr->index]);
} }
static ssize_t show_min_alarm(struct device *dev, static ssize_t min_alarm_show(struct device *dev,
struct device_attribute *devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
struct abx500_temp *data = dev_get_drvdata(dev); struct abx500_temp *data = dev_get_drvdata(dev);
...@@ -251,7 +251,7 @@ static ssize_t show_min_alarm(struct device *dev, ...@@ -251,7 +251,7 @@ static ssize_t show_min_alarm(struct device *dev,
return sprintf(buf, "%d\n", data->min_alarm[attr->index]); return sprintf(buf, "%d\n", data->min_alarm[attr->index]);
} }
static ssize_t show_max_alarm(struct device *dev, static ssize_t max_alarm_show(struct device *dev,
struct device_attribute *devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
struct abx500_temp *data = dev_get_drvdata(dev); struct abx500_temp *data = dev_get_drvdata(dev);
...@@ -273,47 +273,43 @@ static umode_t abx500_attrs_visible(struct kobject *kobj, ...@@ -273,47 +273,43 @@ static umode_t abx500_attrs_visible(struct kobject *kobj,
} }
/* Chip name, required by hwmon */ /* Chip name, required by hwmon */
static SENSOR_DEVICE_ATTR(name, S_IRUGO, show_name, NULL, 0); static SENSOR_DEVICE_ATTR_RO(name, name, 0);
/* GPADC - SENSOR1 */ /* GPADC - SENSOR1 */
static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, 0); static SENSOR_DEVICE_ATTR_RO(temp1_label, label, 0);
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_input, NULL, 0); static SENSOR_DEVICE_ATTR_RO(temp1_input, input, 0);
static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_min, set_min, 0); static SENSOR_DEVICE_ATTR_RW(temp1_min, min, 0);
static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_max, set_max, 0); static SENSOR_DEVICE_ATTR_RW(temp1_max, max, 0);
static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, max_hyst, 0);
show_max_hyst, set_max_hyst, 0); static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, min_alarm, 0);
static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_min_alarm, NULL, 0); static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, max_alarm, 0);
static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_max_alarm, NULL, 0);
/* GPADC - SENSOR2 */ /* GPADC - SENSOR2 */
static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, show_label, NULL, 1); static SENSOR_DEVICE_ATTR_RO(temp2_label, label, 1);
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_input, NULL, 1); static SENSOR_DEVICE_ATTR_RO(temp2_input, input, 1);
static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_min, set_min, 1); static SENSOR_DEVICE_ATTR_RW(temp2_min, min, 1);
static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_max, set_max, 1); static SENSOR_DEVICE_ATTR_RW(temp2_max, max, 1);
static SENSOR_DEVICE_ATTR(temp2_max_hyst, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RW(temp2_max_hyst, max_hyst, 1);
show_max_hyst, set_max_hyst, 1); static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, min_alarm, 1);
static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_min_alarm, NULL, 1); static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, max_alarm, 1);
static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_max_alarm, NULL, 1);
/* GPADC - SENSOR3 */ /* GPADC - SENSOR3 */
static SENSOR_DEVICE_ATTR(temp3_label, S_IRUGO, show_label, NULL, 2); static SENSOR_DEVICE_ATTR_RO(temp3_label, label, 2);
static SENSOR_DEVICE_ATTR(temp3_input, S_IRUGO, show_input, NULL, 2); static SENSOR_DEVICE_ATTR_RO(temp3_input, input, 2);
static SENSOR_DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO, show_min, set_min, 2); static SENSOR_DEVICE_ATTR_RW(temp3_min, min, 2);
static SENSOR_DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, show_max, set_max, 2); static SENSOR_DEVICE_ATTR_RW(temp3_max, max, 2);
static SENSOR_DEVICE_ATTR(temp3_max_hyst, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RW(temp3_max_hyst, max_hyst, 2);
show_max_hyst, set_max_hyst, 2); static SENSOR_DEVICE_ATTR_RO(temp3_min_alarm, min_alarm, 2);
static SENSOR_DEVICE_ATTR(temp3_min_alarm, S_IRUGO, show_min_alarm, NULL, 2); static SENSOR_DEVICE_ATTR_RO(temp3_max_alarm, max_alarm, 2);
static SENSOR_DEVICE_ATTR(temp3_max_alarm, S_IRUGO, show_max_alarm, NULL, 2);
/* GPADC - SENSOR4 */ /* GPADC - SENSOR4 */
static SENSOR_DEVICE_ATTR(temp4_label, S_IRUGO, show_label, NULL, 3); static SENSOR_DEVICE_ATTR_RO(temp4_label, label, 3);
static SENSOR_DEVICE_ATTR(temp4_input, S_IRUGO, show_input, NULL, 3); static SENSOR_DEVICE_ATTR_RO(temp4_input, input, 3);
static SENSOR_DEVICE_ATTR(temp4_min, S_IWUSR | S_IRUGO, show_min, set_min, 3); static SENSOR_DEVICE_ATTR_RW(temp4_min, min, 3);
static SENSOR_DEVICE_ATTR(temp4_max, S_IWUSR | S_IRUGO, show_max, set_max, 3); static SENSOR_DEVICE_ATTR_RW(temp4_max, max, 3);
static SENSOR_DEVICE_ATTR(temp4_max_hyst, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RW(temp4_max_hyst, max_hyst, 3);
show_max_hyst, set_max_hyst, 3); static SENSOR_DEVICE_ATTR_RO(temp4_min_alarm, min_alarm, 3);
static SENSOR_DEVICE_ATTR(temp4_min_alarm, S_IRUGO, show_min_alarm, NULL, 3); static SENSOR_DEVICE_ATTR_RO(temp4_max_alarm, max_alarm, 3);
static SENSOR_DEVICE_ATTR(temp4_max_alarm, S_IRUGO, show_max_alarm, NULL, 3);
static struct attribute *abx500_temp_attributes[] = { static struct attribute *abx500_temp_attributes[] = {
&sensor_dev_attr_name.dev_attr.attr, &sensor_dev_attr_name.dev_attr.attr,
......
...@@ -638,12 +638,12 @@ static int register_attrs(struct acpi_power_meter_resource *resource, ...@@ -638,12 +638,12 @@ static int register_attrs(struct acpi_power_meter_resource *resource,
while (attrs->label) { while (attrs->label) {
sensors->dev_attr.attr.name = attrs->label; sensors->dev_attr.attr.name = attrs->label;
sensors->dev_attr.attr.mode = S_IRUGO; sensors->dev_attr.attr.mode = 0444;
sensors->dev_attr.show = attrs->show; sensors->dev_attr.show = attrs->show;
sensors->index = attrs->index; sensors->index = attrs->index;
if (attrs->set) { if (attrs->set) {
sensors->dev_attr.attr.mode |= S_IWUSR; sensors->dev_attr.attr.mode |= 0200;
sensors->dev_attr.store = attrs->set; sensors->dev_attr.store = attrs->set;
} }
......
...@@ -53,9 +53,9 @@ static int ad7314_spi_read(struct ad7314_data *chip) ...@@ -53,9 +53,9 @@ static int ad7314_spi_read(struct ad7314_data *chip)
return be16_to_cpu(chip->rx); return be16_to_cpu(chip->rx);
} }
static ssize_t ad7314_show_temperature(struct device *dev, static ssize_t ad7314_temperature_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct ad7314_data *chip = dev_get_drvdata(dev); struct ad7314_data *chip = dev_get_drvdata(dev);
s16 data; s16 data;
...@@ -87,8 +87,7 @@ static ssize_t ad7314_show_temperature(struct device *dev, ...@@ -87,8 +87,7 @@ static ssize_t ad7314_show_temperature(struct device *dev,
} }
} }
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, static SENSOR_DEVICE_ATTR_RO(temp1_input, ad7314_temperature, 0);
ad7314_show_temperature, NULL, 0);
static struct attribute *ad7314_attrs[] = { static struct attribute *ad7314_attrs[] = {
&sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,
......
...@@ -107,25 +107,25 @@ static struct ad7414_data *ad7414_update_device(struct device *dev) ...@@ -107,25 +107,25 @@ static struct ad7414_data *ad7414_update_device(struct device *dev)
return data; return data;
} }
static ssize_t show_temp_input(struct device *dev, static ssize_t temp_input_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct ad7414_data *data = ad7414_update_device(dev); struct ad7414_data *data = ad7414_update_device(dev);
return sprintf(buf, "%d\n", ad7414_temp_from_reg(data->temp_input)); return sprintf(buf, "%d\n", ad7414_temp_from_reg(data->temp_input));
} }
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0); static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0);
static ssize_t show_max_min(struct device *dev, struct device_attribute *attr, static ssize_t max_min_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
int index = to_sensor_dev_attr(attr)->index; int index = to_sensor_dev_attr(attr)->index;
struct ad7414_data *data = ad7414_update_device(dev); struct ad7414_data *data = ad7414_update_device(dev);
return sprintf(buf, "%d\n", data->temps[index] * 1000); return sprintf(buf, "%d\n", data->temps[index] * 1000);
} }
static ssize_t set_max_min(struct device *dev, static ssize_t max_min_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr, const char *buf,
const char *buf, size_t count) size_t count)
{ {
struct ad7414_data *data = dev_get_drvdata(dev); struct ad7414_data *data = dev_get_drvdata(dev);
struct i2c_client *client = data->client; struct i2c_client *client = data->client;
...@@ -147,12 +147,10 @@ static ssize_t set_max_min(struct device *dev, ...@@ -147,12 +147,10 @@ static ssize_t set_max_min(struct device *dev,
return count; return count;
} }
static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RW(temp1_max, max_min, 0);
show_max_min, set_max_min, 0); static SENSOR_DEVICE_ATTR_RW(temp1_min, max_min, 1);
static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO,
show_max_min, set_max_min, 1);
static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, static ssize_t alarm_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
int bitnr = to_sensor_dev_attr(attr)->index; int bitnr = to_sensor_dev_attr(attr)->index;
...@@ -161,8 +159,8 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, ...@@ -161,8 +159,8 @@ static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%d\n", value); return sprintf(buf, "%d\n", value);
} }
static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 3); static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, 3);
static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 4); static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 4);
static struct attribute *ad7414_attrs[] = { static struct attribute *ad7414_attrs[] = {
&sensor_dev_attr_temp1_input.dev_attr.attr, &sensor_dev_attr_temp1_input.dev_attr.attr,
......
...@@ -103,8 +103,8 @@ static struct ad7418_data *ad7418_update_device(struct device *dev) ...@@ -103,8 +103,8 @@ static struct ad7418_data *ad7418_update_device(struct device *dev)
return data; return data;
} }
static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, static ssize_t temp_show(struct device *dev, struct device_attribute *devattr,
char *buf) char *buf)
{ {
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct ad7418_data *data = ad7418_update_device(dev); struct ad7418_data *data = ad7418_update_device(dev);
...@@ -112,7 +112,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr, ...@@ -112,7 +112,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
LM75_TEMP_FROM_REG(data->temp[attr->index])); LM75_TEMP_FROM_REG(data->temp[attr->index]));
} }
static ssize_t show_adc(struct device *dev, struct device_attribute *devattr, static ssize_t adc_show(struct device *dev, struct device_attribute *devattr,
char *buf) char *buf)
{ {
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
...@@ -122,8 +122,9 @@ static ssize_t show_adc(struct device *dev, struct device_attribute *devattr, ...@@ -122,8 +122,9 @@ static ssize_t show_adc(struct device *dev, struct device_attribute *devattr,
((data->in[attr->index] >> 6) * 2500 + 512) / 1024); ((data->in[attr->index] >> 6) * 2500 + 512) / 1024);
} }
static ssize_t set_temp(struct device *dev, struct device_attribute *devattr, static ssize_t temp_store(struct device *dev,
const char *buf, size_t count) struct device_attribute *devattr, const char *buf,
size_t count)
{ {
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct ad7418_data *data = dev_get_drvdata(dev); struct ad7418_data *data = dev_get_drvdata(dev);
...@@ -143,16 +144,14 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr, ...@@ -143,16 +144,14 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr,
return count; return count;
} }
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, temp, 1);
show_temp, set_temp, 1); static SENSOR_DEVICE_ATTR_RW(temp1_max, temp, 2);
static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
show_temp, set_temp, 2);
static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_adc, NULL, 0); static SENSOR_DEVICE_ATTR_RO(in1_input, adc, 0);
static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_adc, NULL, 1); static SENSOR_DEVICE_ATTR_RO(in2_input, adc, 1);
static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_adc, NULL, 2); static SENSOR_DEVICE_ATTR_RO(in3_input, adc, 2);
static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_adc, NULL, 3); static SENSOR_DEVICE_ATTR_RO(in4_input, adc, 3);
static struct attribute *ad7416_attrs[] = { static struct attribute *ad7416_attrs[] = {
&sensor_dev_attr_temp1_max.dev_attr.attr, &sensor_dev_attr_temp1_max.dev_attr.attr,
......
...@@ -153,8 +153,8 @@ static struct adc128_data *adc128_update_device(struct device *dev) ...@@ -153,8 +153,8 @@ static struct adc128_data *adc128_update_device(struct device *dev)
return ret; return ret;
} }
static ssize_t adc128_show_in(struct device *dev, struct device_attribute *attr, static ssize_t adc128_in_show(struct device *dev,
char *buf) struct device_attribute *attr, char *buf)
{ {
struct adc128_data *data = adc128_update_device(dev); struct adc128_data *data = adc128_update_device(dev);
int index = to_sensor_dev_attr_2(attr)->index; int index = to_sensor_dev_attr_2(attr)->index;
...@@ -168,8 +168,9 @@ static ssize_t adc128_show_in(struct device *dev, struct device_attribute *attr, ...@@ -168,8 +168,9 @@ static ssize_t adc128_show_in(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%d\n", val); return sprintf(buf, "%d\n", val);
} }
static ssize_t adc128_set_in(struct device *dev, struct device_attribute *attr, static ssize_t adc128_in_store(struct device *dev,
const char *buf, size_t count) struct device_attribute *attr, const char *buf,
size_t count)
{ {
struct adc128_data *data = dev_get_drvdata(dev); struct adc128_data *data = dev_get_drvdata(dev);
int index = to_sensor_dev_attr_2(attr)->index; int index = to_sensor_dev_attr_2(attr)->index;
...@@ -193,7 +194,7 @@ static ssize_t adc128_set_in(struct device *dev, struct device_attribute *attr, ...@@ -193,7 +194,7 @@ static ssize_t adc128_set_in(struct device *dev, struct device_attribute *attr,
return count; return count;
} }
static ssize_t adc128_show_temp(struct device *dev, static ssize_t adc128_temp_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct adc128_data *data = adc128_update_device(dev); struct adc128_data *data = adc128_update_device(dev);
...@@ -207,9 +208,9 @@ static ssize_t adc128_show_temp(struct device *dev, ...@@ -207,9 +208,9 @@ static ssize_t adc128_show_temp(struct device *dev,
return sprintf(buf, "%d\n", temp * 500);/* 0.5 degrees C resolution */ return sprintf(buf, "%d\n", temp * 500);/* 0.5 degrees C resolution */
} }
static ssize_t adc128_set_temp(struct device *dev, static ssize_t adc128_temp_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct adc128_data *data = dev_get_drvdata(dev); struct adc128_data *data = dev_get_drvdata(dev);
int index = to_sensor_dev_attr(attr)->index; int index = to_sensor_dev_attr(attr)->index;
...@@ -233,7 +234,7 @@ static ssize_t adc128_set_temp(struct device *dev, ...@@ -233,7 +234,7 @@ static ssize_t adc128_set_temp(struct device *dev,
return count; return count;
} }
static ssize_t adc128_show_alarm(struct device *dev, static ssize_t adc128_alarm_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct adc128_data *data = adc128_update_device(dev); struct adc128_data *data = adc128_update_device(dev);
...@@ -272,77 +273,51 @@ static umode_t adc128_is_visible(struct kobject *kobj, ...@@ -272,77 +273,51 @@ static umode_t adc128_is_visible(struct kobject *kobj,
return attr->mode; return attr->mode;
} }
static SENSOR_DEVICE_ATTR_2(in0_input, S_IRUGO, static SENSOR_DEVICE_ATTR_2_RO(in0_input, adc128_in, 0, 0);
adc128_show_in, NULL, 0, 0); static SENSOR_DEVICE_ATTR_2_RW(in0_min, adc128_in, 0, 1);
static SENSOR_DEVICE_ATTR_2(in0_min, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_2_RW(in0_max, adc128_in, 0, 2);
adc128_show_in, adc128_set_in, 0, 1);
static SENSOR_DEVICE_ATTR_2(in0_max, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_2_RO(in1_input, adc128_in, 1, 0);
adc128_show_in, adc128_set_in, 0, 2); static SENSOR_DEVICE_ATTR_2_RW(in1_min, adc128_in, 1, 1);
static SENSOR_DEVICE_ATTR_2_RW(in1_max, adc128_in, 1, 2);
static SENSOR_DEVICE_ATTR_2(in1_input, S_IRUGO,
adc128_show_in, NULL, 1, 0); static SENSOR_DEVICE_ATTR_2_RO(in2_input, adc128_in, 2, 0);
static SENSOR_DEVICE_ATTR_2(in1_min, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_2_RW(in2_min, adc128_in, 2, 1);
adc128_show_in, adc128_set_in, 1, 1); static SENSOR_DEVICE_ATTR_2_RW(in2_max, adc128_in, 2, 2);
static SENSOR_DEVICE_ATTR_2(in1_max, S_IWUSR | S_IRUGO,
adc128_show_in, adc128_set_in, 1, 2); static SENSOR_DEVICE_ATTR_2_RO(in3_input, adc128_in, 3, 0);
static SENSOR_DEVICE_ATTR_2_RW(in3_min, adc128_in, 3, 1);
static SENSOR_DEVICE_ATTR_2(in2_input, S_IRUGO, static SENSOR_DEVICE_ATTR_2_RW(in3_max, adc128_in, 3, 2);
adc128_show_in, NULL, 2, 0);
static SENSOR_DEVICE_ATTR_2(in2_min, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_2_RO(in4_input, adc128_in, 4, 0);
adc128_show_in, adc128_set_in, 2, 1); static SENSOR_DEVICE_ATTR_2_RW(in4_min, adc128_in, 4, 1);
static SENSOR_DEVICE_ATTR_2(in2_max, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_2_RW(in4_max, adc128_in, 4, 2);
adc128_show_in, adc128_set_in, 2, 2);
static SENSOR_DEVICE_ATTR_2_RO(in5_input, adc128_in, 5, 0);
static SENSOR_DEVICE_ATTR_2(in3_input, S_IRUGO, static SENSOR_DEVICE_ATTR_2_RW(in5_min, adc128_in, 5, 1);
adc128_show_in, NULL, 3, 0); static SENSOR_DEVICE_ATTR_2_RW(in5_max, adc128_in, 5, 2);
static SENSOR_DEVICE_ATTR_2(in3_min, S_IWUSR | S_IRUGO,
adc128_show_in, adc128_set_in, 3, 1); static SENSOR_DEVICE_ATTR_2_RO(in6_input, adc128_in, 6, 0);
static SENSOR_DEVICE_ATTR_2(in3_max, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_2_RW(in6_min, adc128_in, 6, 1);
adc128_show_in, adc128_set_in, 3, 2); static SENSOR_DEVICE_ATTR_2_RW(in6_max, adc128_in, 6, 2);
static SENSOR_DEVICE_ATTR_2(in4_input, S_IRUGO, static SENSOR_DEVICE_ATTR_2_RO(in7_input, adc128_in, 7, 0);
adc128_show_in, NULL, 4, 0); static SENSOR_DEVICE_ATTR_2_RW(in7_min, adc128_in, 7, 1);
static SENSOR_DEVICE_ATTR_2(in4_min, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_2_RW(in7_max, adc128_in, 7, 2);
adc128_show_in, adc128_set_in, 4, 1);
static SENSOR_DEVICE_ATTR_2(in4_max, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RO(temp1_input, adc128_temp, 0);
adc128_show_in, adc128_set_in, 4, 2); static SENSOR_DEVICE_ATTR_RW(temp1_max, adc128_temp, 1);
static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, adc128_temp, 2);
static SENSOR_DEVICE_ATTR_2(in5_input, S_IRUGO,
adc128_show_in, NULL, 5, 0); static SENSOR_DEVICE_ATTR_RO(in0_alarm, adc128_alarm, 0);
static SENSOR_DEVICE_ATTR_2(in5_min, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RO(in1_alarm, adc128_alarm, 1);
adc128_show_in, adc128_set_in, 5, 1); static SENSOR_DEVICE_ATTR_RO(in2_alarm, adc128_alarm, 2);
static SENSOR_DEVICE_ATTR_2(in5_max, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RO(in3_alarm, adc128_alarm, 3);
adc128_show_in, adc128_set_in, 5, 2); static SENSOR_DEVICE_ATTR_RO(in4_alarm, adc128_alarm, 4);
static SENSOR_DEVICE_ATTR_RO(in5_alarm, adc128_alarm, 5);
static SENSOR_DEVICE_ATTR_2(in6_input, S_IRUGO, static SENSOR_DEVICE_ATTR_RO(in6_alarm, adc128_alarm, 6);
adc128_show_in, NULL, 6, 0); static SENSOR_DEVICE_ATTR_RO(in7_alarm, adc128_alarm, 7);
static SENSOR_DEVICE_ATTR_2(in6_min, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, adc128_alarm, 7);
adc128_show_in, adc128_set_in, 6, 1);
static SENSOR_DEVICE_ATTR_2(in6_max, S_IWUSR | S_IRUGO,
adc128_show_in, adc128_set_in, 6, 2);
static SENSOR_DEVICE_ATTR_2(in7_input, S_IRUGO,
adc128_show_in, NULL, 7, 0);
static SENSOR_DEVICE_ATTR_2(in7_min, S_IWUSR | S_IRUGO,
adc128_show_in, adc128_set_in, 7, 1);
static SENSOR_DEVICE_ATTR_2(in7_max, S_IWUSR | S_IRUGO,
adc128_show_in, adc128_set_in, 7, 2);
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, adc128_show_temp, NULL, 0);
static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
adc128_show_temp, adc128_set_temp, 1);
static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO,
adc128_show_temp, adc128_set_temp, 2);
static SENSOR_DEVICE_ATTR(in0_alarm, S_IRUGO, adc128_show_alarm, NULL, 0);
static SENSOR_DEVICE_ATTR(in1_alarm, S_IRUGO, adc128_show_alarm, NULL, 1);
static SENSOR_DEVICE_ATTR(in2_alarm, S_IRUGO, adc128_show_alarm, NULL, 2);
static SENSOR_DEVICE_ATTR(in3_alarm, S_IRUGO, adc128_show_alarm, NULL, 3);
static SENSOR_DEVICE_ATTR(in4_alarm, S_IRUGO, adc128_show_alarm, NULL, 4);
static SENSOR_DEVICE_ATTR(in5_alarm, S_IRUGO, adc128_show_alarm, NULL, 5);
static SENSOR_DEVICE_ATTR(in6_alarm, S_IRUGO, adc128_show_alarm, NULL, 6);
static SENSOR_DEVICE_ATTR(in7_alarm, S_IRUGO, adc128_show_alarm, NULL, 7);
static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, adc128_show_alarm, NULL, 7);
static struct attribute *adc128_attrs[] = { static struct attribute *adc128_attrs[] = {
&sensor_dev_attr_in0_alarm.dev_attr.attr, &sensor_dev_attr_in0_alarm.dev_attr.attr,
......
...@@ -57,8 +57,8 @@ struct adcxx { ...@@ -57,8 +57,8 @@ struct adcxx {
}; };
/* sysfs hook function */ /* sysfs hook function */
static ssize_t adcxx_read(struct device *dev, static ssize_t adcxx_show(struct device *dev,
struct device_attribute *devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
struct spi_device *spi = to_spi_device(dev); struct spi_device *spi = to_spi_device(dev);
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
...@@ -94,15 +94,15 @@ static ssize_t adcxx_read(struct device *dev, ...@@ -94,15 +94,15 @@ static ssize_t adcxx_read(struct device *dev,
return status; return status;
} }
static ssize_t adcxx_show_min(struct device *dev, static ssize_t adcxx_min_show(struct device *dev,
struct device_attribute *devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
/* The minimum reference is 0 for this chip family */ /* The minimum reference is 0 for this chip family */
return sprintf(buf, "0\n"); return sprintf(buf, "0\n");
} }
static ssize_t adcxx_show_max(struct device *dev, static ssize_t adcxx_max_show(struct device *dev,
struct device_attribute *devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
struct spi_device *spi = to_spi_device(dev); struct spi_device *spi = to_spi_device(dev);
struct adcxx *adc = spi_get_drvdata(spi); struct adcxx *adc = spi_get_drvdata(spi);
...@@ -118,8 +118,9 @@ static ssize_t adcxx_show_max(struct device *dev, ...@@ -118,8 +118,9 @@ static ssize_t adcxx_show_max(struct device *dev,
return sprintf(buf, "%d\n", reference); return sprintf(buf, "%d\n", reference);
} }
static ssize_t adcxx_set_max(struct device *dev, static ssize_t adcxx_max_store(struct device *dev,
struct device_attribute *devattr, const char *buf, size_t count) struct device_attribute *devattr,
const char *buf, size_t count)
{ {
struct spi_device *spi = to_spi_device(dev); struct spi_device *spi = to_spi_device(dev);
struct adcxx *adc = spi_get_drvdata(spi); struct adcxx *adc = spi_get_drvdata(spi);
...@@ -138,25 +139,24 @@ static ssize_t adcxx_set_max(struct device *dev, ...@@ -138,25 +139,24 @@ static ssize_t adcxx_set_max(struct device *dev,
return count; return count;
} }
static ssize_t adcxx_show_name(struct device *dev, struct device_attribute static ssize_t adcxx_name_show(struct device *dev,
*devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
return sprintf(buf, "%s\n", to_spi_device(dev)->modalias); return sprintf(buf, "%s\n", to_spi_device(dev)->modalias);
} }
static struct sensor_device_attribute ad_input[] = { static struct sensor_device_attribute ad_input[] = {
SENSOR_ATTR(name, S_IRUGO, adcxx_show_name, NULL, 0), SENSOR_ATTR_RO(name, adcxx_name, 0),
SENSOR_ATTR(in_min, S_IRUGO, adcxx_show_min, NULL, 0), SENSOR_ATTR_RO(in_min, adcxx_min, 0),
SENSOR_ATTR(in_max, S_IWUSR | S_IRUGO, adcxx_show_max, SENSOR_ATTR_RW(in_max, adcxx_max, 0),
adcxx_set_max, 0), SENSOR_ATTR_RO(in0_input, adcxx, 0),
SENSOR_ATTR(in0_input, S_IRUGO, adcxx_read, NULL, 0), SENSOR_ATTR_RO(in1_input, adcxx, 1),
SENSOR_ATTR(in1_input, S_IRUGO, adcxx_read, NULL, 1), SENSOR_ATTR_RO(in2_input, adcxx, 2),
SENSOR_ATTR(in2_input, S_IRUGO, adcxx_read, NULL, 2), SENSOR_ATTR_RO(in3_input, adcxx, 3),
SENSOR_ATTR(in3_input, S_IRUGO, adcxx_read, NULL, 3), SENSOR_ATTR_RO(in4_input, adcxx, 4),
SENSOR_ATTR(in4_input, S_IRUGO, adcxx_read, NULL, 4), SENSOR_ATTR_RO(in5_input, adcxx, 5),
SENSOR_ATTR(in5_input, S_IRUGO, adcxx_read, NULL, 5), SENSOR_ATTR_RO(in6_input, adcxx, 6),
SENSOR_ATTR(in6_input, S_IRUGO, adcxx_read, NULL, 6), SENSOR_ATTR_RO(in7_input, adcxx, 7),
SENSOR_ATTR(in7_input, S_IRUGO, adcxx_read, NULL, 7),
}; };
/*----------------------------------------------------------------------*/ /*----------------------------------------------------------------------*/
......
...@@ -156,8 +156,8 @@ static struct adm1021_data *adm1021_update_device(struct device *dev) ...@@ -156,8 +156,8 @@ static struct adm1021_data *adm1021_update_device(struct device *dev)
return data; return data;
} }
static ssize_t show_temp(struct device *dev, static ssize_t temp_show(struct device *dev, struct device_attribute *devattr,
struct device_attribute *devattr, char *buf) char *buf)
{ {
int index = to_sensor_dev_attr(devattr)->index; int index = to_sensor_dev_attr(devattr)->index;
struct adm1021_data *data = adm1021_update_device(dev); struct adm1021_data *data = adm1021_update_device(dev);
...@@ -165,7 +165,7 @@ static ssize_t show_temp(struct device *dev, ...@@ -165,7 +165,7 @@ static ssize_t show_temp(struct device *dev,
return sprintf(buf, "%d\n", data->temp[index]); return sprintf(buf, "%d\n", data->temp[index]);
} }
static ssize_t show_temp_max(struct device *dev, static ssize_t temp_max_show(struct device *dev,
struct device_attribute *devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
int index = to_sensor_dev_attr(devattr)->index; int index = to_sensor_dev_attr(devattr)->index;
...@@ -174,7 +174,7 @@ static ssize_t show_temp_max(struct device *dev, ...@@ -174,7 +174,7 @@ static ssize_t show_temp_max(struct device *dev,
return sprintf(buf, "%d\n", data->temp_max[index]); return sprintf(buf, "%d\n", data->temp_max[index]);
} }
static ssize_t show_temp_min(struct device *dev, static ssize_t temp_min_show(struct device *dev,
struct device_attribute *devattr, char *buf) struct device_attribute *devattr, char *buf)
{ {
int index = to_sensor_dev_attr(devattr)->index; int index = to_sensor_dev_attr(devattr)->index;
...@@ -183,7 +183,7 @@ static ssize_t show_temp_min(struct device *dev, ...@@ -183,7 +183,7 @@ static ssize_t show_temp_min(struct device *dev,
return sprintf(buf, "%d\n", data->temp_min[index]); return sprintf(buf, "%d\n", data->temp_min[index]);
} }
static ssize_t show_alarm(struct device *dev, struct device_attribute *attr, static ssize_t alarm_show(struct device *dev, struct device_attribute *attr,
char *buf) char *buf)
{ {
int index = to_sensor_dev_attr(attr)->index; int index = to_sensor_dev_attr(attr)->index;
...@@ -199,9 +199,9 @@ static ssize_t alarms_show(struct device *dev, ...@@ -199,9 +199,9 @@ static ssize_t alarms_show(struct device *dev,
return sprintf(buf, "%u\n", data->alarms); return sprintf(buf, "%u\n", data->alarms);
} }
static ssize_t set_temp_max(struct device *dev, static ssize_t temp_max_store(struct device *dev,
struct device_attribute *devattr, struct device_attribute *devattr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int index = to_sensor_dev_attr(devattr)->index; int index = to_sensor_dev_attr(devattr)->index;
struct adm1021_data *data = dev_get_drvdata(dev); struct adm1021_data *data = dev_get_drvdata(dev);
...@@ -225,9 +225,9 @@ static ssize_t set_temp_max(struct device *dev, ...@@ -225,9 +225,9 @@ static ssize_t set_temp_max(struct device *dev,
return count; return count;
} }
static ssize_t set_temp_min(struct device *dev, static ssize_t temp_min_store(struct device *dev,
struct device_attribute *devattr, struct device_attribute *devattr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int index = to_sensor_dev_attr(devattr)->index; int index = to_sensor_dev_attr(devattr)->index;
struct adm1021_data *data = dev_get_drvdata(dev); struct adm1021_data *data = dev_get_drvdata(dev);
...@@ -287,21 +287,17 @@ static ssize_t low_power_store(struct device *dev, ...@@ -287,21 +287,17 @@ static ssize_t low_power_store(struct device *dev,
} }
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL, 0); static SENSOR_DEVICE_ATTR_RO(temp1_input, temp, 0);
static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, static SENSOR_DEVICE_ATTR_RW(temp1_max, temp_max, 0);
set_temp_max, 0); static SENSOR_DEVICE_ATTR_RW(temp1_min, temp_min, 0);
static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp_min, static SENSOR_DEVICE_ATTR_RO(temp2_input, temp, 1);
set_temp_min, 0); static SENSOR_DEVICE_ATTR_RW(temp2_max, temp_max, 1);
static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_temp, NULL, 1); static SENSOR_DEVICE_ATTR_RW(temp2_min, temp_min, 1);
static SENSOR_DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_temp_max, static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 6);
set_temp_max, 1); static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, 5);
static SENSOR_DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_temp_min, static SENSOR_DEVICE_ATTR_RO(temp2_max_alarm, alarm, 4);
set_temp_min, 1); static SENSOR_DEVICE_ATTR_RO(temp2_min_alarm, alarm, 3);
static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6); static SENSOR_DEVICE_ATTR_RO(temp2_fault, alarm, 2);
static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 5);
static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4);
static SENSOR_DEVICE_ATTR(temp2_min_alarm, S_IRUGO, show_alarm, NULL, 3);
static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2);
static DEVICE_ATTR_RO(alarms); static DEVICE_ATTR_RO(alarms);
static DEVICE_ATTR_RW(low_power); static DEVICE_ATTR_RW(low_power);
......
...@@ -133,8 +133,8 @@ static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel, ...@@ -133,8 +133,8 @@ static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel,
} }
/* sysfs callback function */ /* sysfs callback function */
static ssize_t show_in(struct device *dev, struct device_attribute *da, static ssize_t in_show(struct device *dev, struct device_attribute *da,
char *buf) char *buf)
{ {
struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
...@@ -149,14 +149,14 @@ static ssize_t show_in(struct device *dev, struct device_attribute *da, ...@@ -149,14 +149,14 @@ static ssize_t show_in(struct device *dev, struct device_attribute *da,
} }
static const struct sensor_device_attribute ads1015_in[] = { static const struct sensor_device_attribute ads1015_in[] = {
SENSOR_ATTR(in0_input, S_IRUGO, show_in, NULL, 0), SENSOR_ATTR_RO(in0_input, in, 0),
SENSOR_ATTR(in1_input, S_IRUGO, show_in, NULL, 1), SENSOR_ATTR_RO(in1_input, in, 1),
SENSOR_ATTR(in2_input, S_IRUGO, show_in, NULL, 2), SENSOR_ATTR_RO(in2_input, in, 2),
SENSOR_ATTR(in3_input, S_IRUGO, show_in, NULL, 3), SENSOR_ATTR_RO(in3_input, in, 3),
SENSOR_ATTR(in4_input, S_IRUGO, show_in, NULL, 4), SENSOR_ATTR_RO(in4_input, in, 4),
SENSOR_ATTR(in5_input, S_IRUGO, show_in, NULL, 5), SENSOR_ATTR_RO(in5_input, in, 5),
SENSOR_ATTR(in6_input, S_IRUGO, show_in, NULL, 6), SENSOR_ATTR_RO(in6_input, in, 6),
SENSOR_ATTR(in7_input, S_IRUGO, show_in, NULL, 7), SENSOR_ATTR_RO(in7_input, in, 7),
}; };
/* /*
......
...@@ -62,8 +62,8 @@ static inline u8 ads7828_cmd_byte(u8 cmd, int ch) ...@@ -62,8 +62,8 @@ static inline u8 ads7828_cmd_byte(u8 cmd, int ch)
} }
/* sysfs callback function */ /* sysfs callback function */
static ssize_t ads7828_show_in(struct device *dev, struct device_attribute *da, static ssize_t ads7828_in_show(struct device *dev,
char *buf) struct device_attribute *da, char *buf)
{ {
struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct ads7828_data *data = dev_get_drvdata(dev); struct ads7828_data *data = dev_get_drvdata(dev);
...@@ -79,14 +79,14 @@ static ssize_t ads7828_show_in(struct device *dev, struct device_attribute *da, ...@@ -79,14 +79,14 @@ static ssize_t ads7828_show_in(struct device *dev, struct device_attribute *da,
DIV_ROUND_CLOSEST(regval * data->lsb_resol, 1000)); DIV_ROUND_CLOSEST(regval * data->lsb_resol, 1000));
} }
static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, ads7828_show_in, NULL, 0); static SENSOR_DEVICE_ATTR_RO(in0_input, ads7828_in, 0);
static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, ads7828_show_in, NULL, 1); static SENSOR_DEVICE_ATTR_RO(in1_input, ads7828_in, 1);
static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, ads7828_show_in, NULL, 2); static SENSOR_DEVICE_ATTR_RO(in2_input, ads7828_in, 2);
static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, ads7828_show_in, NULL, 3); static SENSOR_DEVICE_ATTR_RO(in3_input, ads7828_in, 3);
static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, ads7828_show_in, NULL, 4); static SENSOR_DEVICE_ATTR_RO(in4_input, ads7828_in, 4);
static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, ads7828_show_in, NULL, 5); static SENSOR_DEVICE_ATTR_RO(in5_input, ads7828_in, 5);
static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, ads7828_show_in, NULL, 6); static SENSOR_DEVICE_ATTR_RO(in6_input, ads7828_in, 6);
static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, ads7828_show_in, NULL, 7); static SENSOR_DEVICE_ATTR_RO(in7_input, ads7828_in, 7);
static struct attribute *ads7828_attrs[] = { static struct attribute *ads7828_attrs[] = {
&sensor_dev_attr_in0_input.dev_attr.attr, &sensor_dev_attr_in0_input.dev_attr.attr,
......
...@@ -96,8 +96,8 @@ static int ads7871_write_reg8(struct spi_device *spi, int reg, u8 val) ...@@ -96,8 +96,8 @@ static int ads7871_write_reg8(struct spi_device *spi, int reg, u8 val)
return spi_write(spi, tmp, sizeof(tmp)); return spi_write(spi, tmp, sizeof(tmp));
} }
static ssize_t show_voltage(struct device *dev, static ssize_t voltage_show(struct device *dev, struct device_attribute *da,
struct device_attribute *da, char *buf) char *buf)
{ {
struct ads7871_data *pdata = dev_get_drvdata(dev); struct ads7871_data *pdata = dev_get_drvdata(dev);
struct spi_device *spi = pdata->spi; struct spi_device *spi = pdata->spi;
...@@ -138,14 +138,14 @@ static ssize_t show_voltage(struct device *dev, ...@@ -138,14 +138,14 @@ static ssize_t show_voltage(struct device *dev,
} }
} }
static SENSOR_DEVICE_ATTR(in0_input, S_IRUGO, show_voltage, NULL, 0); static SENSOR_DEVICE_ATTR_RO(in0_input, voltage, 0);
static SENSOR_DEVICE_ATTR(in1_input, S_IRUGO, show_voltage, NULL, 1); static SENSOR_DEVICE_ATTR_RO(in1_input, voltage, 1);
static SENSOR_DEVICE_ATTR(in2_input, S_IRUGO, show_voltage, NULL, 2); static SENSOR_DEVICE_ATTR_RO(in2_input, voltage, 2);
static SENSOR_DEVICE_ATTR(in3_input, S_IRUGO, show_voltage, NULL, 3); static SENSOR_DEVICE_ATTR_RO(in3_input, voltage, 3);
static SENSOR_DEVICE_ATTR(in4_input, S_IRUGO, show_voltage, NULL, 4); static SENSOR_DEVICE_ATTR_RO(in4_input, voltage, 4);
static SENSOR_DEVICE_ATTR(in5_input, S_IRUGO, show_voltage, NULL, 5); static SENSOR_DEVICE_ATTR_RO(in5_input, voltage, 5);
static SENSOR_DEVICE_ATTR(in6_input, S_IRUGO, show_voltage, NULL, 6); static SENSOR_DEVICE_ATTR_RO(in6_input, voltage, 6);
static SENSOR_DEVICE_ATTR(in7_input, S_IRUGO, show_voltage, NULL, 7); static SENSOR_DEVICE_ATTR_RO(in7_input, voltage, 7);
static struct attribute *ads7871_attrs[] = { static struct attribute *ads7871_attrs[] = {
&sensor_dev_attr_in0_input.dev_attr.attr, &sensor_dev_attr_in0_input.dev_attr.attr,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -230,9 +230,8 @@ static int ADT7X10_REG_TO_TEMP(struct adt7x10_data *data, s16 reg) ...@@ -230,9 +230,8 @@ static int ADT7X10_REG_TO_TEMP(struct adt7x10_data *data, s16 reg)
/* sysfs attributes for hwmon */ /* sysfs attributes for hwmon */
static ssize_t adt7x10_show_temp(struct device *dev, static ssize_t adt7x10_temp_show(struct device *dev,
struct device_attribute *da, struct device_attribute *da, char *buf)
char *buf)
{ {
struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct adt7x10_data *data = dev_get_drvdata(dev); struct adt7x10_data *data = dev_get_drvdata(dev);
...@@ -250,9 +249,9 @@ static ssize_t adt7x10_show_temp(struct device *dev, ...@@ -250,9 +249,9 @@ static ssize_t adt7x10_show_temp(struct device *dev,
data->temp[attr->index])); data->temp[attr->index]));
} }
static ssize_t adt7x10_set_temp(struct device *dev, static ssize_t adt7x10_temp_store(struct device *dev,
struct device_attribute *da, struct device_attribute *da,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct adt7x10_data *data = dev_get_drvdata(dev); struct adt7x10_data *data = dev_get_drvdata(dev);
...@@ -273,9 +272,8 @@ static ssize_t adt7x10_set_temp(struct device *dev, ...@@ -273,9 +272,8 @@ static ssize_t adt7x10_set_temp(struct device *dev,
return count; return count;
} }
static ssize_t adt7x10_show_t_hyst(struct device *dev, static ssize_t adt7x10_t_hyst_show(struct device *dev,
struct device_attribute *da, struct device_attribute *da, char *buf)
char *buf)
{ {
struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
struct adt7x10_data *data = dev_get_drvdata(dev); struct adt7x10_data *data = dev_get_drvdata(dev);
...@@ -294,9 +292,9 @@ static ssize_t adt7x10_show_t_hyst(struct device *dev, ...@@ -294,9 +292,9 @@ static ssize_t adt7x10_show_t_hyst(struct device *dev,
ADT7X10_REG_TO_TEMP(data, data->temp[nr]) - hyst); ADT7X10_REG_TO_TEMP(data, data->temp[nr]) - hyst);
} }
static ssize_t adt7x10_set_t_hyst(struct device *dev, static ssize_t adt7x10_t_hyst_store(struct device *dev,
struct device_attribute *da, struct device_attribute *da,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct adt7x10_data *data = dev_get_drvdata(dev); struct adt7x10_data *data = dev_get_drvdata(dev);
int limit, ret; int limit, ret;
...@@ -317,9 +315,8 @@ static ssize_t adt7x10_set_t_hyst(struct device *dev, ...@@ -317,9 +315,8 @@ static ssize_t adt7x10_set_t_hyst(struct device *dev,
return count; return count;
} }
static ssize_t adt7x10_show_alarm(struct device *dev, static ssize_t adt7x10_alarm_show(struct device *dev,
struct device_attribute *da, struct device_attribute *da, char *buf)
char *buf)
{ {
struct sensor_device_attribute *attr = to_sensor_dev_attr(da); struct sensor_device_attribute *attr = to_sensor_dev_attr(da);
int ret; int ret;
...@@ -339,25 +336,19 @@ static ssize_t name_show(struct device *dev, struct device_attribute *da, ...@@ -339,25 +336,19 @@ static ssize_t name_show(struct device *dev, struct device_attribute *da,
return sprintf(buf, "%s\n", data->name); return sprintf(buf, "%s\n", data->name);
} }
static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, adt7x10_show_temp, NULL, 0); static SENSOR_DEVICE_ATTR_RO(temp1_input, adt7x10_temp, 0);
static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RW(temp1_max, adt7x10_temp, 1);
adt7x10_show_temp, adt7x10_set_temp, 1); static SENSOR_DEVICE_ATTR_RW(temp1_min, adt7x10_temp, 2);
static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RW(temp1_crit, adt7x10_temp, 3);
adt7x10_show_temp, adt7x10_set_temp, 2); static SENSOR_DEVICE_ATTR_RW(temp1_max_hyst, adt7x10_t_hyst, 1);
static SENSOR_DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RO(temp1_min_hyst, adt7x10_t_hyst, 2);
adt7x10_show_temp, adt7x10_set_temp, 3); static SENSOR_DEVICE_ATTR_RO(temp1_crit_hyst, adt7x10_t_hyst, 3);
static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO, static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, adt7x10_alarm,
adt7x10_show_t_hyst, adt7x10_set_t_hyst, 1); ADT7X10_STAT_T_LOW);
static SENSOR_DEVICE_ATTR(temp1_min_hyst, S_IRUGO, static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, adt7x10_alarm,
adt7x10_show_t_hyst, NULL, 2); ADT7X10_STAT_T_HIGH);
static SENSOR_DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, static SENSOR_DEVICE_ATTR_RO(temp1_crit_alarm, adt7x10_alarm,
adt7x10_show_t_hyst, NULL, 3); ADT7X10_STAT_T_CRIT);
static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, adt7x10_show_alarm,
NULL, ADT7X10_STAT_T_LOW);
static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, adt7x10_show_alarm,
NULL, ADT7X10_STAT_T_HIGH);
static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, adt7x10_show_alarm,
NULL, ADT7X10_STAT_T_CRIT);
static DEVICE_ATTR_RO(name); static DEVICE_ATTR_RO(name);
static struct attribute *adt7x10_attributes[] = { static struct attribute *adt7x10_attributes[] = {
......
This diff is collapsed.
...@@ -1128,7 +1128,7 @@ static int applesmc_create_nodes(struct applesmc_node_group *groups, int num) ...@@ -1128,7 +1128,7 @@ static int applesmc_create_nodes(struct applesmc_node_group *groups, int num)
attr = &node->sda.dev_attr.attr; attr = &node->sda.dev_attr.attr;
sysfs_attr_init(attr); sysfs_attr_init(attr);
attr->name = node->name; attr->name = node->name;
attr->mode = S_IRUGO | (grp->store ? S_IWUSR : 0); attr->mode = 0444 | (grp->store ? 0200 : 0);
ret = sysfs_create_file(&pdev->dev.kobj, attr); ret = sysfs_create_file(&pdev->dev.kobj, attr);
if (ret) { if (ret) {
attr->name = NULL; attr->name = NULL;
......
This diff is collapsed.
...@@ -681,10 +681,8 @@ static int atk_debugfs_gitm_get(void *p, u64 *val) ...@@ -681,10 +681,8 @@ static int atk_debugfs_gitm_get(void *p, u64 *val)
return err; return err;
} }
DEFINE_SIMPLE_ATTRIBUTE(atk_debugfs_gitm, DEFINE_DEBUGFS_ATTRIBUTE(atk_debugfs_gitm, atk_debugfs_gitm_get, NULL,
atk_debugfs_gitm_get, "0x%08llx\n");
NULL,
"0x%08llx\n");
static int atk_acpi_print(char *buf, size_t sz, union acpi_object *obj) static int atk_acpi_print(char *buf, size_t sz, union acpi_object *obj)
{ {
...@@ -799,17 +797,17 @@ static void atk_debugfs_init(struct atk_data *data) ...@@ -799,17 +797,17 @@ static void atk_debugfs_init(struct atk_data *data)
if (!d || IS_ERR(d)) if (!d || IS_ERR(d))
return; return;
f = debugfs_create_x32("id", S_IRUSR | S_IWUSR, d, &data->debugfs.id); f = debugfs_create_x32("id", 0600, d, &data->debugfs.id);
if (!f || IS_ERR(f)) if (!f || IS_ERR(f))
goto cleanup; goto cleanup;
f = debugfs_create_file("gitm", S_IRUSR, d, data, f = debugfs_create_file_unsafe("gitm", 0400, d, data,
&atk_debugfs_gitm); &atk_debugfs_gitm);
if (!f || IS_ERR(f)) if (!f || IS_ERR(f))
goto cleanup; goto cleanup;
f = debugfs_create_file("ggrp", S_IRUSR, d, data, f = debugfs_create_file("ggrp", 0400, d, data,
&atk_debugfs_ggrp_fops); &atk_debugfs_ggrp_fops);
if (!f || IS_ERR(f)) if (!f || IS_ERR(f))
goto cleanup; goto cleanup;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -1120,7 +1120,6 @@ static int lm63_probe(struct i2c_client *client, ...@@ -1120,7 +1120,6 @@ static int lm63_probe(struct i2c_client *client,
data->kind = (enum chips)of_device_get_match_data(&client->dev); data->kind = (enum chips)of_device_get_match_data(&client->dev);
else else
data->kind = id->driver_data; data->kind = id->driver_data;
data->kind = id->driver_data;
if (data->kind == lm64) if (data->kind == lm64)
data->temp2_offset = 16000; data->temp2_offset = 16000;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment