Re: [PATCH v3 2/3] hwmon/ltc2990: Generalise DT to fwnode support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(...);
		...
	}

Feel free to send another version of your patch.

Thanks,
Guenter



[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux