hwmon: (adt7475) Use device_property APIs when configuring polarity
authorChris Packham <chris.packham@alliedtelesis.co.nz>
Tue, 18 Apr 2023 23:36:55 +0000 (11:36 +1200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:00 +0000 (23:03 +0900)
commitee508dfbafa1a627d6ecc91161dde79240d9c957
tree5627ea75b321af145fc4afdb78aa970073c95cf7
parentd899ae3e768ebf4815627a76df9ff5cb4301db36
hwmon: (adt7475) Use device_property APIs when configuring polarity

commit 2a8e41ad337508fc5d598c0f9288890214f8e318 upstream.

On DT unaware platforms of_property_read_u32_array() returns -ENOSYS
which wasn't handled by the code treating adi,pwm-active-state as
optional. Update the code to use device_property_read_u32_array() which
deals gracefully with DT unaware platforms.

Fixes: 86da28eed4fb ("hwmon: (adt7475) Add support for inverting pwm output")
Reported-by: Mariusz Białończyk <manio@skyboo.net>
Link: https://lore.kernel.org/linux-hwmon/52e26a67-9131-2dc0-40cb-db5c07370027@alliedtelesis.co.nz/T/#mdd0505801e0a4e72340de009a47c0fca4f771ed3
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20230418233656.869055-2-chris.packham@alliedtelesis.co.nz
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwmon/adt7475.c