OSDN Git Service

tomoyo/tomoyo-test1.git
5 years agohwmon: (occ) Add more details to Kconfig help text
Eddie James [Tue, 16 Apr 2019 15:54:28 +0000 (15:54 +0000)]
hwmon: (occ) Add more details to Kconfig help text

The help text needs to spell out how the driver runs on a BMC, as it
previously seemed to indicate it ran on a POWER processor.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (occ) Prevent sysfs error attribute from returning error
Eddie James [Tue, 16 Apr 2019 15:43:49 +0000 (15:43 +0000)]
hwmon: (occ) Prevent sysfs error attribute from returning error

The error sysfs attribute returns the stored error state of the OCC and
doesn't depend on the OCC poll response. Therefore, split the error
attribute into it's own function to avoid failing out of the function if
the poll response fails.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (occ) Store error condition for rate-limited polls
Eddie James [Tue, 16 Apr 2019 15:43:48 +0000 (15:43 +0000)]
hwmon: (occ) Store error condition for rate-limited polls

The OCC driver limits the rate of sending poll commands to the OCC. If a
user reads a hwmon entry after a poll response resulted in an error and
is rate-limited, the error is invisible to the user. Fix this by storing
the last error and returning that in the rate-limited case.

Signed-off-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ina3221) Add averaging mode support
Nicolin Chen [Tue, 16 Apr 2019 19:41:31 +0000 (12:41 -0700)]
hwmon: (ina3221) Add averaging mode support

The CONFIG register has a 3-bit averaging mode field for users
to setup the number of samples that are collected and averaged
together. This is very useful to filter noise from sensor data.

This patch adds a 'samples' sysfs node using hwmon_chip_samples
of hwmon core, and updates wait time calculation by taking this
samples value into account.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pmbus/isl68137) Add driver for Intersil ISL68137 PWM Controller
Maxim Sloyko [Mon, 15 Apr 2019 22:28:07 +0000 (15:28 -0700)]
hwmon: (pmbus/isl68137) Add driver for Intersil ISL68137 PWM Controller

Intersil ISL68137 is a digital output 7-phase configurable PWM
controller with an AVSBus interface.

Signed-off-by: Maxim Sloyko <maxims@google.com>
Signed-off-by: Robert Lippert <rlippert@google.com>
Signed-off-by: Patrick Venture <venture@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agopmbus: support for custom sysfs attributes
krzysztof.adamski@nokia.com [Mon, 15 Apr 2019 21:44:05 +0000 (14:44 -0700)]
pmbus: support for custom sysfs attributes

This patch makes it possible to pass custom struct attribute_group array
via the pmbus_driver_info struct so that those can be added to the
attribute groups passed to hwmon_device_register_with_groups().

This makes it possible to register custom sysfs attributes by PMBUS
drivers similar to how you can do this with most other busses/classes.

Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: Add support for samples attributes
Guenter Roeck [Mon, 15 Apr 2019 20:23:48 +0000 (13:23 -0700)]
hwmon: Add support for samples attributes

Add support for the new samples attributes to the hwmon core.

Cc: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm25066) Support SAMPLES_FOR_AVG register
Adamski, Krzysztof (Nokia - PL/Wroclaw) [Sun, 14 Apr 2019 21:59:19 +0000 (21:59 +0000)]
hwmon: (lm25066) Support SAMPLES_FOR_AVG register

Manufacturer specific SAMPLES_FOR_AVG register allows setting the number
of samples used in computing the average values (PMBUS_VIRT_READ_*_AVG).
The number we write is an exponent of base 2 of the number of samples so
for example writing 3 will result in 8 samples average.

Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: Document the samples attributes
Adamski, Krzysztof (Nokia - PL/Wroclaw) [Sun, 14 Apr 2019 21:58:40 +0000 (21:58 +0000)]
hwmon: Document the samples attributes

Document new ABI attributes: {in,power,curr,temp}_samples and samples.

Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pmbus) Introduce PMBUS_VIRT_*_SAMPLES registers
Adamski, Krzysztof (Nokia - PL/Wroclaw) [Sun, 14 Apr 2019 21:58:18 +0000 (21:58 +0000)]
hwmon: (pmbus) Introduce PMBUS_VIRT_*_SAMPLES registers

Those virtual registers can be used to export manufacturer specific
functionality for controlling the number of samples for average values
reported by the device.

Signed-off-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ir38064) delete incorrect line
Patrick Venture [Mon, 15 Apr 2019 14:17:28 +0000 (07:17 -0700)]
hwmon: (ir38064) delete incorrect line

Delete line indicating the datasheet was not publicly available.  This
line was originally present as a default during the write-up and was
subsequently not removed once the datasheet was located.

Signed-off-by: Patrick Venture <venture@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pmbus_core) Replace S_<PERMS> with octal values
Guenter Roeck [Fri, 5 Apr 2019 19:39:26 +0000 (12:39 -0700)]
hwmon: (pmbus_core) Replace S_<PERMS> with octal values

Replace S_<PERMS> with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pmbus/ir38064) Add driver for Infineon IR38064 Voltage Regulator
Maxim Sloyko [Fri, 12 Apr 2019 20:37:56 +0000 (13:37 -0700)]
hwmon: (pmbus/ir38064) Add driver for Infineon IR38064 Voltage Regulator

Add the pmbus driver for the Infineon ir38064 voltage regulator.

VOUT_MODE is not supported by the device.  The driver fakes linear16
mode with exponent value -8.

The device supports VOUT_PEAK, IOUT_PEAK, and TEMPERATURE_PEAK, however
this driver does not enable them.

Signed-off-by: Maxim Sloyko <maxims@google.com>
Signed-off-by: Patrick Venture <venture@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ir35221) fix company name
Patrick Venture [Fri, 12 Apr 2019 16:27:42 +0000 (09:27 -0700)]
hwmon: (ir35221) fix company name

Fix the company name from "Infinion" to "Infineon."

Signed-off-by: Patrick Venture <venture@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pwm-fan) Report probe errors consistently
Robin Murphy [Fri, 12 Apr 2019 14:05:23 +0000 (15:05 +0100)]
hwmon: (pwm-fan) Report probe errors consistently

Printing the error code for a failure provides a head-start for
debugging, since it's often sufficient to pinpoint the origin of the
failure. We already do this for some probe-failure messages, so let's
make the rest of them consistent.

Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pwm-fan) Add RPM support via external interrupt
Stefan Wahren [Thu, 11 Apr 2019 13:30:11 +0000 (15:30 +0200)]
hwmon: (pwm-fan) Add RPM support via external interrupt

This adds RPM support to the pwm-fan driver in order to use with
fancontrol/pwmconfig. This feature is intended for fans with a tachometer
output signal, which generate a defined number of pulses per revolution.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
[groeck: Drop unused 'devattr' variable]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agoDocumentation: pwm-fan: Add description for RPM support
Stefan Wahren [Thu, 11 Apr 2019 13:30:10 +0000 (15:30 +0200)]
Documentation: pwm-fan: Add description for RPM support

This adds a short description for the new RPM support of the pwm-fan
driver.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agodt-bindings: hwmon: (pwm-fan) Add tachometer interrupt
Stefan Wahren [Thu, 11 Apr 2019 13:30:09 +0000 (15:30 +0200)]
dt-bindings: hwmon: (pwm-fan) Add tachometer interrupt

This adds the tachometer interrupt to the pwm-fan binding, which is
necessary for RPM support.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: OCC drivers are ARM-only
Jean Delvare [Wed, 10 Apr 2019 10:56:35 +0000 (12:56 +0200)]
hwmon: OCC drivers are ARM-only

These drivers are for a BMC inside PowerPC servers. The BMC runs on
ARM hardware, so only propose the drivers on this architecture, unless
build-testing.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Eddie James <eajames@linux.ibm.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (occ) Move common code to a separate module
Jean Delvare [Wed, 10 Apr 2019 10:47:26 +0000 (12:47 +0200)]
hwmon: (occ) Move common code to a separate module

Instead of duplicating the common code into the 2 (binary) drivers,
move the common code to a separate module. This is cleaner.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Eddie James <eajames@linux.ibm.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Tested-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (vt1211) Use request_muxed_region for Super-IO accesses
Guenter Roeck [Fri, 5 Apr 2019 15:53:08 +0000 (08:53 -0700)]
hwmon: (vt1211) Use request_muxed_region for Super-IO accesses

Super-IO accesses may fail on a system with no or unmapped LPC bus.

Also, other drivers may attempt to access the LPC bus at the same time,
resulting in undefined behavior.

Use request_muxed_region() to ensure that IO access on the requested
address space is supported, and to ensure that access by multiple drivers
is synchronized.

Fixes: 2219cd81a6cd ("hwmon/vt1211: Add probing of alternate config index port")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (w83627hf) Use request_muxed_region for Super-IO accesses
Guenter Roeck [Fri, 5 Apr 2019 15:44:41 +0000 (08:44 -0700)]
hwmon: (w83627hf) Use request_muxed_region for Super-IO accesses

Super-IO accesses may fail on a system with no or unmapped LPC bus.

Also, other drivers may attempt to access the LPC bus at the same time,
resulting in undefined behavior.

Use request_muxed_region() to ensure that IO access on the requested
address space is supported, and to ensure that access by multiple drivers
is synchronized.

Fixes: b72656dbc491 ("hwmon: (w83627hf) Stop using globals for I/O port numbers")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (smsc47m1) Use request_muxed_region for Super-IO accesses
Guenter Roeck [Thu, 4 Apr 2019 18:28:37 +0000 (11:28 -0700)]
hwmon: (smsc47m1) Use request_muxed_region for Super-IO accesses

Super-IO accesses may fail on a system with no or unmapped LPC bus.

Also, other drivers may attempt to access the LPC bus at the same time,
resulting in undefined behavior.

Use request_muxed_region() to ensure that IO access on the requested
address space is supported, and to ensure that access by multiple drivers
is synchronized.

Fixes: 8d5d45fb1468 ("I2C: Move hwmon drivers (2/3)")
Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reported-by: John Garry <john.garry@huawei.com>
Cc: John Garry <john.garry@huawei.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (adm1029) Use permission specific [SENSOR_][DEVICE_]ATTR variants
Guenter Roeck [Mon, 11 Mar 2019 17:15:45 +0000 (10:15 -0700)]
hwmon: (adm1029) Use permission specific [SENSOR_][DEVICE_]ATTR variants

Use [SENSOR_][DEVICE_]ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Cc: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (w83627hf) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 23:25:47 +0000 (15:25 -0800)]
hwmon: (w83627hf) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (smsc47m1) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 23:13:02 +0000 (15:13 -0800)]
hwmon: (smsc47m1) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (smsc47m192) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 22:46:16 +0000 (14:46 -0800)]
hwmon: (smsc47m192) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (vt8231) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 22:30:27 +0000 (14:30 -0800)]
hwmon: (vt8231) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Cc: Roger Lucas <vt8231@hiddenengine.co.uk>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (sis5595) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 22:28:50 +0000 (14:28 -0800)]
hwmon: (sis5595) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (menf21bmc_hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 22:16:57 +0000 (14:16 -0800)]
hwmon: (menf21bmc_hwmon) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Cc: Andreas Werner <andreas.werner@men.de>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (via686a) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 22:12:25 +0000 (14:12 -0800)]
hwmon: (via686a) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm85) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 18:40:33 +0000 (10:40 -0800)]
hwmon: (lm85) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm78) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 18:07:16 +0000 (10:07 -0800)]
hwmon: (lm78) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm87) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 04:47:57 +0000 (20:47 -0800)]
hwmon: (lm87) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (adm1031) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 04:37:22 +0000 (20:37 -0800)]
hwmon: (adm1031) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (thmc50) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 04:26:58 +0000 (20:26 -0800)]
hwmon: (thmc50) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (adm9240) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 04:18:52 +0000 (20:18 -0800)]
hwmon: (adm9240) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (adm1026) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 02:34:27 +0000 (18:34 -0800)]
hwmon: (adm1026) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (adm1025) Use permission specific SENSOR[_DEVICE]_ATTR variants
Guenter Roeck [Tue, 22 Jan 2019 02:33:47 +0000 (18:33 -0800)]
hwmon: (adm1025) Use permission specific SENSOR[_DEVICE]_ATTR variants

Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (smsc47b397) Use request_muxed_region for Super-IO accesses
Guenter Roeck [Thu, 4 Apr 2019 18:22:42 +0000 (11:22 -0700)]
hwmon: (smsc47b397) Use request_muxed_region for Super-IO accesses

Super-IO accesses may fail on a system with no or unmapped LPC bus.

Also, other drivers may attempt to access the LPC bus at the same time,
resulting in undefined behavior.

Use request_muxed_region() to ensure that IO access on the requested
address space is supported, and to ensure that access by multiple drivers
is synchronized.

Fixes: 8d5d45fb1468 ("I2C: Move hwmon drivers (2/3)")
Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reported-by: John Garry <john.garry@huawei.com>
Cc: John Garry <john.garry@huawei.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pc87427) Use request_muxed_region for Super-IO accesses
Guenter Roeck [Thu, 4 Apr 2019 18:16:20 +0000 (11:16 -0700)]
hwmon: (pc87427) Use request_muxed_region for Super-IO accesses

Super-IO accesses may fail on a system with no or unmapped LPC bus.

Also, other drivers may attempt to access the LPC bus at the same time,
resulting in undefined behavior.

Use request_muxed_region() to ensure that IO access on the requested
address space is supported, and to ensure that access by multiple drivers
is synchronized.

Fixes: ba224e2c4f0a7 ("hwmon: New PC87427 hardware monitoring driver")
Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reported-by: John Garry <john.garry@huawei.com>
Cc: John Garry <john.garry@huawei.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (f71805f) Use request_muxed_region for Super-IO accesses
Guenter Roeck [Thu, 4 Apr 2019 17:52:43 +0000 (10:52 -0700)]
hwmon: (f71805f) Use request_muxed_region for Super-IO accesses

Super-IO accesses may fail on a system with no or unmapped LPC bus.

Unable to handle kernel paging request at virtual address ffffffbffee0002e
pgd = ffffffc1d68d4000
[ffffffbffee0002e] *pgd=0000000000000000, *pud=0000000000000000
Internal error: Oops: 94000046 [#1] PREEMPT SMP
Modules linked in: f71805f(+) hwmon
CPU: 3 PID: 1659 Comm: insmod Not tainted 4.5.0+ #88
Hardware name: linux,dummy-virt (DT)
task: ffffffc1f6665400 ti: ffffffc1d6418000 task.ti: ffffffc1d6418000
PC is at f71805f_find+0x6c/0x358 [f71805f]

Also, other drivers may attempt to access the LPC bus at the same time,
resulting in undefined behavior.

Use request_muxed_region() to ensure that IO access on the requested
address space is supported, and to ensure that access by multiple
drivers is synchronized.

Fixes: e53004e20a58e ("hwmon: New f71805f driver")
Reported-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reported-by: John Garry <john.garry@huawei.com>
Cc: John Garry <john.garry@huawei.com>
Acked-by: John Garry <john.garry@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ina2xx) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 15:00:57 +0000 (08:00 -0700)]
hwmon: (ina2xx) Fix build warning

The following build warning is seen if CONFIG_OF is disabled.

drivers/hwmon/ina2xx.c:510:34: warning:
‘ina2xx_of_match’ defined but not used

Mark ina2xx_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm63) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 14:59:01 +0000 (07:59 -0700)]
hwmon: (lm63) Fix build warning

The following build warning is seen if CONFIG_OF is disabled.

drivers/hwmon/lm63.c:1156:34: warning:
‘lm63_of_match’ defined but not used

Mark lm63_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: lm95245: Fix build warnings
Guenter Roeck [Thu, 4 Apr 2019 14:52:05 +0000 (07:52 -0700)]
hwmon: lm95245: Fix build warnings

The following build warning is seen if CONFIG_OF is disabled.

drivers/hwmon/lm95245.c:626:34: warning:
‘lm95245_of_match’ defined but not used

Mark lm95245_of_match as __maybe_unused to fix the problem.

The following build warning is always seen.

drivers/hwmon/lm95245.c:95:17: warning:
‘lm95245_reg_address’ defined but not used

The array is no longer used since commit c0a4b9ec1b43 ("hwmon: (lm95245)
Use new hwmon registration API"). Remove it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (tmp421) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 14:50:26 +0000 (07:50 -0700)]
hwmon: (tmp421) Fix build warning

The following build warning is seen if CONFIG_OF is disabled.

drivers/hwmon/tmp421.c:73:34: warning:
‘tmp421_of_match’ defined but not used

Mark tmp421_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (stts751) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 14:48:55 +0000 (07:48 -0700)]
hwmon: (stts751) Fix build warning

The following build warning is seen if CONFIG_OF is disabled.

drivers/hwmon/stts751.c:88:34: warning:
‘stts751_of_match’ defined but not used

Mark stts751_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (max6621) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 14:47:04 +0000 (07:47 -0700)]
hwmon: (max6621) Fix build warning

The following build warning is seen if CONFIG_OF is disabled.

drivers/hwmon/max6621.c:573:34: warning:
‘max6621_of_match’ defined but not used

Mark max6621_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm85) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 14:44:40 +0000 (07:44 -0700)]
hwmon: (lm85) Fix build warning

The following build warning is seen if CONFIG_OF is disabled.

drivers/hwmon/lm85.c:1645:34: warning:
‘lm85_of_match’ defined but not used

Mark lm85_of_match as __maybe_unused to ix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (max6650) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:44:14 +0000 (06:44 -0700)]
hwmon: (max6650) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/max6650.c:137:34: warning:
‘max6650_dt_match’ defined but not used

Mark max6650_dt_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (max6697) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:42:50 +0000 (06:42 -0700)]
hwmon: (max6697) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/max6697.c:653:34: warning:
‘max6697_of_match’ defined but not used

Mark max6697_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ina209) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:41:19 +0000 (06:41 -0700)]
hwmon: (ina209) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/ina209.c:590:34: warning:
‘ina209_of_match’ defined but not used

Mark ina209_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm75) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:40:00 +0000 (06:40 -0700)]
hwmon: (lm75) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/lm75.c:446:34: warning:
‘lm75_of_match’ defined but not used

Mark lm75_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (w83773g) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:38:17 +0000 (06:38 -0700)]
hwmon: (w83773g) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/w83773g.c:47:34: warning:
‘w83773_of_match’ defined but not used

Mark w83773_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ads7828) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:36:51 +0000 (06:36 -0700)]
hwmon: (ads7828) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/ads7828.c:203:34: warning:
‘ads7828_of_match’ defined but not used

Mark ads7828_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (hih6130) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:35:28 +0000 (06:35 -0700)]
hwmon: (hih6130) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/hih6130.c:255:34: warning:
‘hih6130_of_match’ defined but not used

Mark hih6130_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (adt7475) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:33:42 +0000 (06:33 -0700)]
hwmon: (adt7475) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/adt7475.c:171:34: warning:
‘adt7475_of_match’ defined but not used

Mark adt7475_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ads1015) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:29:51 +0000 (06:29 -0700)]
hwmon: (ads1015) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/ads1015.c:310:34: warning:
‘ads1015_of_match’ defined but not used

Marking ads1015_of_match as __maybe_unused fixes the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (tmp103) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:28:34 +0000 (06:28 -0700)]
hwmon: (tmp103) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/tmp103.c:173:34: warning:
‘tmp103_of_match’ defined but not used

Marking tmp103_of_match as __maybe_unused fixes the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (tmp102) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:27:26 +0000 (06:27 -0700)]
hwmon: (tmp102) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/tmp102.c:324:34: warning:
‘tmp102_of_match’ defined but not used

Mark it as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ad7414) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:26:08 +0000 (06:26 -0700)]
hwmon: (ad7414) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/ad7414.c:218:34: warning:
‘ad7414_of_match’ defined but not used

Marking ad7414_of_match as __mayybe_unused fixes the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (adc128d818) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:23:59 +0000 (06:23 -0700)]
hwmon: (adc128d818) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/adc128d818.c:524:34: warning:
‘adc128_of_match’ defined but not used

Mark adc128_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm90) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:21:17 +0000 (06:21 -0700)]
hwmon: (lm90) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/lm90.c:239:34: warning:
‘lm90_of_match’ defined but not used

Mark lm90_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ltc4151) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:19:50 +0000 (06:19 -0700)]
hwmon: (ltc4151) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/ltc4151.c:211:34: warning:
‘ltc4151_match’ defined but not used

Mark ltc4151_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pmbus/ucd900) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:17:49 +0000 (06:17 -0700)]
hwmon: (pmbus/ucd900) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/pmbus/ucd9000.c:154:34: warning:
‘ucd9000_of_match’ defined but not used

Mark ucd9000_of_match as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pmbus/tps53679) Fix build warning
Guenter Roeck [Thu, 4 Apr 2019 13:16:46 +0000 (06:16 -0700)]
hwmon: (pmbus/tps53679) Fix build warning

If CONFIG_OF is not enabled, the following build warning is observed.

drivers/hwmon/pmbus/tps53679.c:100:34: warning:
‘tps53679_of_match’ defined but not used

Marking tps53679_of_match as __maybe_unused fixes the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pmbus/ucd9200): Mark ucd9200_of_match as maybe_unused
Guenter Roeck [Thu, 4 Apr 2019 13:13:31 +0000 (06:13 -0700)]
hwmon: (pmbus/ucd9200): Mark ucd9200_of_match as maybe_unused

If CONFIG_OF is not enabled, the following build warning is
observed.

drivers/hwmon/pmbus/ucd9200.c:50:34: warning:
‘ucd9200_of_match’ defined but not used

Mark it as __maybe_unused to fix the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (iio_hwmon) Simplify attr.name generation in iio_hwmon_probe()
Andrey Smirnov [Wed, 3 Apr 2019 04:28:11 +0000 (21:28 -0700)]
hwmon: (iio_hwmon) Simplify attr.name generation in iio_hwmon_probe()

Since every call to devm_kasprintf() in the switch statement is mostly
the same, we can move all of the shared code outside and capture
differencies with two helper variables. No functional change intended.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (jz4740) Use devm_platform_ioremap_resource
Guenter Roeck [Mon, 1 Apr 2019 17:36:41 +0000 (10:36 -0700)]
hwmon: (jz4740) Use devm_platform_ioremap_resource

The new helper devm_platform_ioremap_resource() wraps
platform_get_resource() and devm_ioremap_resource() together.
Use it to simplify the code.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (w83773g) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:51 +0000 (10:53 -0700)]
hwmon: (w83773g) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (tmp108) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:51 +0000 (10:53 -0700)]
hwmon: (tmp108) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (tmp102) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:50 +0000 (10:53 -0700)]
hwmon: (tmp102) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (raspberrypi-hwmon) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:50 +0000 (10:53 -0700)]
hwmon: (raspberrypi-hwmon) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (npcm750-pwm-fan) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:50 +0000 (10:53 -0700)]
hwmon: (npcm750-pwm-fan) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Cc: Avi Fishman <avifishman70@gmail.com>
Cc: Tomer Maimon <tmaimon77@gmail.com>
Cc: Patrick Venture <venture@google.com>
Cc: Nancy Yuen <yuenn@google.com>
Cc: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (mlxreg-fan) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:50 +0000 (10:53 -0700)]
hwmon: (mlxreg-fan) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (max6621) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:49 +0000 (10:53 -0700)]
hwmon: (max6621) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (max31790) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:49 +0000 (10:53 -0700)]
hwmon: (max31790) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ltq-cputemp) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:49 +0000 (10:53 -0700)]
hwmon: (ltq-cputemp) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ltc4245) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:48 +0000 (10:53 -0700)]
hwmon: (ltc4245) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm95245) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:48 +0000 (10:53 -0700)]
hwmon: (lm95245) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm95241) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:48 +0000 (10:53 -0700)]
hwmon: (lm95241) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm90) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:48 +0000 (10:53 -0700)]
hwmon: (lm90) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (lm75) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:47 +0000 (10:53 -0700)]
hwmon: (lm75) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (jc42) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:47 +0000 (10:53 -0700)]
hwmon: (jc42) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ina3221) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:47 +0000 (10:53 -0700)]
hwmon: (ina3221) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

The patch was post-edited to retain comments.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (adt7411) Use HWMON_CHANNEL_INFO macro
Guenter Roeck [Sun, 31 Mar 2019 17:53:46 +0000 (10:53 -0700)]
hwmon: (adt7411) Use HWMON_CHANNEL_INFO macro

The HWMON_CHANNEL_INFO macro simplifies the code, reduces the likelihood
of errors, and makes the code easier to read.

The conversion was done automatically with coccinelle. The semantic patch
used to make this change is as follows.

@r@
initializer list elements;
identifier i;
@@

-u32 i[] = {
-  elements,
-  0
-};

@s@
identifier r.i,j,ty;
@@

-struct hwmon_channel_info j = {
-       .type = ty,
-       .config = i,
-};

@script:ocaml t@
ty << s.ty;
elements << r.elements;
shorter;
elems;
@@

shorter :=
   make_ident (List.hd(List.rev (Str.split (Str.regexp "_") ty)));
elems :=
   make_ident
    (String.concat ","
     (List.map (fun x -> Printf.sprintf "\n\t\t\t   %s" x)
       (Str.split (Str.regexp " , ") elements)))

@@
identifier s.j,t.shorter;
identifier t.elems;
@@

- &j
+ HWMON_CHANNEL_INFO(shorter,elems)

This patch does not introduce functional changes. Many thanks to
Julia Lawall for providing the semantic patch.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: Documentation: Add usage example for HWMON_CHANNEL_INFO
Guenter Roeck [Sun, 31 Mar 2019 17:22:24 +0000 (10:22 -0700)]
hwmon: Documentation: Add usage example for HWMON_CHANNEL_INFO

The new HWMON_CHANNEL_INFO macro simplifies the code, reduces the
likelihood of errors, and makes the code easier to read. Add a usage
example to help driver writers to actually use it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (nct7904) Use new HWMON_CHANNEL_INFO() macro
Guenter Roeck [Fri, 29 Mar 2019 20:26:40 +0000 (13:26 -0700)]
hwmon: (nct7904) Use new HWMON_CHANNEL_INFO() macro

The new macro simplifies the code, reduces the likelihood of errors,
and makes the code easier to read.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: lochnagar: Add Lochnagar 2 hardware monitoring driver
Lucas Tanure [Thu, 28 Mar 2019 13:09:37 +0000 (13:09 +0000)]
hwmon: lochnagar: Add Lochnagar 2 hardware monitoring driver

Lochnagar is an evaluation and development board for Cirrus
Logic Smart CODEC and Amp devices. It allows the connection of
most Cirrus Logic devices on mini-cards, as well as allowing
connection of various application processor systems to provide a
full evaluation platform.

This driver adds support for the hardware monitoring features of
the Lochnagar 2 to the hwmon API. Monitoring is provided for
the board voltages, currents and temperature supported by the
board controller chip.

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: lochnagar: Add device tree binding document
Charles Keepax [Thu, 28 Mar 2019 13:09:36 +0000 (13:09 +0000)]
hwmon: lochnagar: Add device tree binding document

Lochnagar is an evaluation and development board for Cirrus
Logic Smart CODEC and Amp devices. It allows the connection of
most Cirrus Logic devices on mini-cards, as well as allowing
connection of various application processor systems to provide a
full evaluation platform. This driver supports the board
controller chip on the Lochnagar board.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (ntc_thermistor) Use new HWMON_CHANNEL_INFO() macro
Guenter Roeck [Wed, 20 Mar 2019 17:36:00 +0000 (10:36 -0700)]
hwmon: (ntc_thermistor) Use new HWMON_CHANNEL_INFO() macro

The new macro is indeed quite useful. Let's use it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: Add convience macro to define simple static sensors
Charles Keepax [Wed, 20 Mar 2019 14:58:17 +0000 (14:58 +0000)]
hwmon: Add convience macro to define simple static sensors

It takes a fair amount of boiler plate code to add new sensors, add a
macro that can be used to specify simple static sensors.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (mlxreg-fan) Add support for fan capability registers
Vadim Pasternak [Mon, 18 Mar 2019 16:10:28 +0000 (16:10 +0000)]
hwmon: (mlxreg-fan) Add support for fan capability registers

Add support for fan capability registers in order to distinct between
the systems which have minor fan configuration differences. This
reduces the amount of code used to describe such systems.
The capability registers provides system specific information about the
number of physically connected tachometers and system specific fan
speed scale parameter.
For example one system can be equipped with twelve fan tachometers,
while the other with for example, eight or six. Or one system should
use default fan speed divider value, while the other has a scale
parameter defined in hardware, which should be used for divider
setting.
Reading this information from the capability registers allows to use the
same fan structure for the systems with the such differences.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (occ) Fix extended status bits
Lei YU [Mon, 15 Apr 2019 10:37:20 +0000 (18:37 +0800)]
hwmon: (occ) Fix extended status bits

The occ's extended status is checked and shown as sysfs attributes. But
the code was incorrectly checking the "status" bits.
Fix it by checking the "ext_status" bits.

Cc: stable@vger.kernel.org
Fixes: df04ced684d4 ("hwmon (occ): Add sysfs attributes for additional OCC data")
Signed-off-by: Lei YU <mine260309@gmail.com>
Reviewed-by: Eddie James <eajames@linux.ibm.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agohwmon: (pwm-fan) Disable PWM if fetching cooling data fails
Stefan Wahren [Wed, 3 Apr 2019 12:48:33 +0000 (14:48 +0200)]
hwmon: (pwm-fan) Disable PWM if fetching cooling data fails

In case pwm_fan_of_get_cooling_data() fails we should disable the PWM
just like in the other error cases.

Fixes: 2e5219c77183 ("hwmon: (pwm-fan) Read PWM FAN configuration from device tree")
Cc: <stable@vger.kernel.org> # 4.14+
Reported-by: Guenter Rock <linux@roeck-us.net>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
5 years agoLinux 5.1-rc4 v5.1-rc4
Linus Torvalds [Mon, 8 Apr 2019 00:09:59 +0000 (14:09 -1000)]
Linux 5.1-rc4

5 years agoMerge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
Linus Torvalds [Sun, 7 Apr 2019 23:46:17 +0000 (13:46 -1000)]
Merge tag 'armsoc-fixes' of git://git./linux/kernel/git/soc/soc

Pull ARM SoC fixes from Olof Johansson:
 "A collection of fixes from the last few weeks. Most of them are
  smaller tweaks and fixes to DT and hardware descriptions for boards.
  Some of the more significant ones are:

   - eMMC and RGMII stability tweaks for rk3288

   - DDC fixes for Rock PI 4

   - Audio fixes for two TI am335x eval boards

   - D_CAN clock fix for am335x

   - Compilation fixes for clang

   - !HOTPLUG_CPU compilation fix for one of the new platforms this
     release (milbeaut)

   - A revert of a gpio fix for nomadik that instead was fixed in the
     gpio subsystem

   - Whitespace fix for the DT JSON schema (no tabs allowed)"

* tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (25 commits)
  ARM: milbeaut: fix build with !CONFIG_HOTPLUG_CPU
  ARM: iop: don't use using 64-bit DMA masks
  ARM: orion: don't use using 64-bit DMA masks
  Revert "ARM: dts: nomadik: Fix polarity of SPI CS"
  dt-bindings: cpu: Fix JSON schema
  arm/mach-at91/pm : fix possible object reference leak
  ARM: dts: at91: Fix typo in ISC_D0 on PC9
  ARM: dts: Fix dcan clkctrl clock for am3
  reset: meson-audio-arb: Fix missing .owner setting of reset_controller_dev
  dt-bindings: reset: meson-g12a: Add missing USB2 PHY resets
  ARM: dts: rockchip: Remove #address/#size-cells from rk3288-veyron gpio-keys
  ARM: dts: rockchip: Remove #address/#size-cells from rk3288 mipi_dsi
  ARM: dts: rockchip: Fix gpu opp node names for rk3288
  ARM: dts: am335x-evmsk: Correct the regulators for the audio codec
  ARM: dts: am335x-evm: Correct the regulators for the audio codec
  ARM: OMAP2+: add missing of_node_put after of_device_is_available
  ARM: OMAP1: ams-delta: Fix broken GPIO ID allocation
  arm64: dts: stratix10: add the sysmgr-syscon property from the gmac's
  arm64: dts: rockchip: fix rk3328 sdmmc0 write errors
  arm64: dts: rockchip: fix rk3328 rgmii high tx error rate
  ...

5 years agoMerge tag 'for-linus-20190407' of git://git.kernel.dk/linux-block
Linus Torvalds [Sun, 7 Apr 2019 23:28:36 +0000 (13:28 -1000)]
Merge tag 'for-linus-20190407' of git://git.kernel.dk/linux-block

Pull block fixes from Jens Axboe:

 - Fixups for the pf/pcd queue handling (YueHaibing)

 - Revert of the three direct issue changes as they have been proven to
   cause an issue with dm-mpath (Bart)

 - Plug rq_count reset fix (Dongli)

 - io_uring double free in fileset registration error handling (me)

 - Make null_blk handle bad numa node passed in (John)

 - BFQ ifdef fix (Konstantin)

 - Flush queue leak fix (Shenghui)

 - Plug trace fix (Yufen)

* tag 'for-linus-20190407' of git://git.kernel.dk/linux-block:
  xsysace: Fix error handling in ace_setup
  null_blk: prevent crash from bad home_node value
  block: Revert v5.0 blk_mq_request_issue_directly() changes
  paride/pcd: Fix potential NULL pointer dereference and mem leak
  blk-mq: do not reset plug->rq_count before the list is sorted
  paride/pf: Fix potential NULL pointer dereference
  io_uring: fix double free in case of fileset regitration failure
  blk-mq: add trace block plug and unplug for multiple queues
  block: use blk_free_flush_queue() to free hctx->fq in blk_mq_init_hctx
  block/bfq: fix ifdef for CONFIG_BFQ_GROUP_IOSCHED=y

5 years agoARM: milbeaut: fix build with !CONFIG_HOTPLUG_CPU
Arnd Bergmann [Wed, 13 Mar 2019 21:19:16 +0000 (22:19 +0100)]
ARM: milbeaut: fix build with !CONFIG_HOTPLUG_CPU

When HOTPLUG_CPU is disabled, some fields in the smp operations
are not available or needed:

arch/arm/mach-milbeaut/platsmp.c:90:3: error: field designator 'cpu_die' does not refer to any field in type
      'struct smp_operations'
        .cpu_die                = m10v_cpu_die,
         ^
arch/arm/mach-milbeaut/platsmp.c:91:3: error: field designator 'cpu_kill' does not refer to any field in type
      'struct smp_operations'
        .cpu_kill               = m10v_cpu_kill,
         ^

Hide them in an #ifdef like the other platforms do.

Fixes: 9fb29c734f9e ("ARM: milbeaut: Add basic support for Milbeaut m10v SoC")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Olof Johansson <olof@lixom.net>
5 years agoARM: iop: don't use using 64-bit DMA masks
Arnd Bergmann [Mon, 25 Mar 2019 15:50:43 +0000 (16:50 +0100)]
ARM: iop: don't use using 64-bit DMA masks

clang warns about statically defined DMA masks from the DMA_BIT_MASK
macro with length 64:

 arch/arm/mach-iop13xx/setup.c:303:35: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
 static u64 iop13xx_adma_dmamask = DMA_BIT_MASK(64);
                                  ^~~~~~~~~~~~~~~~
 include/linux/dma-mapping.h:141:54: note: expanded from macro 'DMA_BIT_MASK'
 #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                      ^ ~~~

The ones in iop shouldn't really be 64 bit masks, so changing them
to what the driver can support avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Olof Johansson <olof@lixom.net>