Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon/ltc2990: Generalise DT to fwnode support

ltc2990 will now use device_property_read_u32_array() instead of
of_property_read_u32_array() - allowing the use of software nodes
via fwnode_create_software_node().

This allows code using i2c_new_device() to specify a default
measurement mode for the LTC2990 via fwnode_create_software_node().

Signed-off-by: Max Staudt <max@enpas.org>
Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20190819121618.16557-2-max@enpas.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Max Staudt and committed by
Guenter Roeck
06a1c69c 10b1f2a9

+5 -5
+5 -5
drivers/hwmon/ltc2990.c
··· 13 13 #include <linux/i2c.h> 14 14 #include <linux/kernel.h> 15 15 #include <linux/module.h> 16 - #include <linux/of.h> 16 + #include <linux/property.h> 17 17 18 18 #define LTC2990_STATUS 0x00 19 19 #define LTC2990_CONTROL 0x01 ··· 206 206 int ret; 207 207 struct device *hwmon_dev; 208 208 struct ltc2990_data *data; 209 - struct device_node *of_node = i2c->dev.of_node; 210 209 211 210 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA | 212 211 I2C_FUNC_SMBUS_WORD_DATA)) ··· 217 218 218 219 data->i2c = i2c; 219 220 220 - if (of_node) { 221 - ret = of_property_read_u32_array(of_node, "lltc,meas-mode", 222 - data->mode, 2); 221 + if (dev_fwnode(&i2c->dev)) { 222 + ret = device_property_read_u32_array(&i2c->dev, 223 + "lltc,meas-mode", 224 + data->mode, 2); 223 225 if (ret < 0) 224 226 return ret; 225 227