[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b9b4383-c1e9-91a6-8ab6-8f831b362dca@enpas.org>
Date: Fri, 16 Aug 2019 10:37:30 +0200
From: Max Staudt <max@...as.org>
To: Guenter Roeck <linux@...ck-us.net>
Cc: linux-i2c@...r.kernel.org, linux-hwmon@...r.kernel.org,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Jean Delvare <jdelvare@...e.com>, linux-m68k@...r.kernel.org,
linux-kernel@...r.kernel.org, glaubitz@...sik.fu-berlin.de
Subject: Re: [PATCH v3 2/3] hwmon/ltc2990: Generalise DT to fwnode support
On 08/16/2019 12:43 AM, Guenter Roeck wrote:
> On Fri, Aug 16, 2019 at 12:19:42AM +0200, Max Staudt wrote:
>> On 08/15/2019 02:58 PM, Max Staudt wrote:
>>> - if (of_node) {
>>> - ret = of_property_read_u32_array(of_node, "lltc,meas-mode",
>>> - data->mode, 2);
>>> + if (i2c->dev.of_node || i2c->dev.fwnode) {
>>
>> One more idea, would it be better here to do the following?
>>
>> if (device_property_present(i2c->dev, "lltc,meas-mode")) {
>> ret = of_property_read_u32_array(of_node, "lltc,meas-mode",
>> data->mode, 2);
>> }
>>
>> I'm happy to prepare a patch if you wish to have this in - just let me know whether it should be on top of the last one, or instead of it.
>
> That would be semantically different. The property is currently mandatory.
> The above code would make it optional. This might work:
>
> if (dev_fwnode(&i2c->dev)) {
> ret = device_property_read_u32_array(...);
> ...
> }
Fair point. The semantic change was part of my question, but the more I think about it, the less I want to open this can of worms. We can still make the property optional later on, while it's not as easy to make it mandatory.
I'll send a patch with your suggestion.
Thanks!
Max
Powered by blists - more mailing lists