summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorChris Packham <chris.packham@alliedtelesis.co.nz>2023-04-19 11:36:55 +1200
committerGuenter Roeck <linux@roeck-us.net>2023-04-21 07:27:23 -0700
commit2a8e41ad337508fc5d598c0f9288890214f8e318 (patch)
tree8ccab1df27d3beae97634f11bde8bcbbe5877104 /drivers/hwmon
parent19692f17cd133ba2305e1f5c6484e623ec1ac7d0 (diff)
downloadlinux-2a8e41ad337508fc5d598c0f9288890214f8e318.tar.gz
linux-2a8e41ad337508fc5d598c0f9288890214f8e318.tar.bz2
linux-2a8e41ad337508fc5d598c0f9288890214f8e318.zip
hwmon: (adt7475) Use device_property APIs when configuring polarity
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>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/adt7475.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/hwmon/adt7475.c b/drivers/hwmon/adt7475.c
index 6e4c92b500b8..6a6ebcc896b1 100644
--- a/drivers/hwmon/adt7475.c
+++ b/drivers/hwmon/adt7475.c
@@ -1604,9 +1604,9 @@ static int adt7475_set_pwm_polarity(struct i2c_client *client)
int ret, i;
u8 val;
- ret = of_property_read_u32_array(client->dev.of_node,
- "adi,pwm-active-state", states,
- ARRAY_SIZE(states));
+ ret = device_property_read_u32_array(&client->dev,
+ "adi,pwm-active-state", states,
+ ARRAY_SIZE(states));
if (ret)
return ret;