From: Chris Packham <chris.packham@alliedtelesis.co.nz>
To: jdelvare@suse.com, linux@roeck-us.net, manio@skyboo.net
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
Chris Packham <chris.packham@alliedtelesis.co.nz>
Subject: [PATCH v2 1/2] hwmon: (adt7475) Use device_property APIs when configuring polarity
Date: Wed, 19 Apr 2023 11:36:55 +1200 [thread overview]
Message-ID: <20230418233656.869055-2-chris.packham@alliedtelesis.co.nz> (raw)
In-Reply-To: <20230418233656.869055-1-chris.packham@alliedtelesis.co.nz>
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>
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Notes:
I've not currently got access to a DT unaware platform with an ADT7475
chip so I'm not 100% sure that this will fix the problem Mariusz
reported but looking at drivers I think this approach is correct.
Changes in v2:
- use device_property_read_u32_array instead of checking for -ENOSYS
drivers/hwmon/adt7475.c | 6 +++---
1 file 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;
--
2.40.0
next prev parent reply other threads:[~2023-04-18 23:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-18 23:36 [PATCH v2 0/2] hwmon: (adt7475) Handle DT unaware platforms Chris Packham
2023-04-18 23:36 ` Chris Packham [this message]
2023-04-19 3:57 ` [PATCH v2 1/2] hwmon: (adt7475) Use device_property APIs when configuring polarity Guenter Roeck
2023-04-19 15:54 ` Guenter Roeck
2023-04-18 23:36 ` [PATCH v2 2/2] hwmon: (adt7475) Convert to use device_property APIs Chris Packham
2023-04-19 12:48 ` kernel test robot
2023-04-19 16:06 ` Guenter Roeck
2023-04-19 20:49 ` Chris Packham
2023-04-19 20:59 ` Guenter Roeck
2023-04-21 4:33 ` kernel test robot
2023-04-21 6:15 ` kernel test robot
2023-04-30 12:49 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230418233656.869055-2-chris.packham@alliedtelesis.co.nz \
--to=chris.packham@alliedtelesis.co.nz \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=manio@skyboo.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).