hwmon: (pmbus/adm1275) Fix power sampling support
authorGuenter Roeck <linux@roeck-us.net>
Wed, 12 Jun 2019 14:39:33 +0000 (07:39 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 24 Jun 2019 01:33:01 +0000 (18:33 -0700)
commit7d45deb31bec3992cd92a240946fbf872661fa2c
tree95d52375a3dd161f51d6512b35bf62aea6950629
parente67776cc30894d2840fc0b93fc3b3647677ef0b3
hwmon: (pmbus/adm1275) Fix power sampling support

Not every chip supported by this driver supports setting the number
of samples for power averaging. Also, the power monitoring register
is not always a 16-bit register, and the configuration bits used for
voltage sampling are different depending on the register width.
Some conditional code is needed to fix the problem.

On top of all that, the compiler complains about problems with
FIELD_GET and FIELD_PREP macros if the file is built with W=1.
Avoid using those macros to silence the warning.

Cc: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Cc: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Reviewed-by: Krzysztof Adamski <krzysztof.adamski@nokia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/adm1275.c