summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Staudt <max@enpas.org>2019-08-19 08:16:17 -0400
committerGuenter Roeck <linux@roeck-us.net>2019-09-03 15:47:17 -0400
commit06a1c69cf5de7b866f2871477839f1aa14e48ea5 (patch)
tree3744a6d4ef4a53375c84702d789803f5d4f8e8e4
parent10b1f2a9d411a1afcd5e5249bf411fb823d71701 (diff)
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>
-rw-r--r--drivers/hwmon/ltc2990.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c
index f9431ad43ad3..53ff5051774c 100644
--- a/drivers/hwmon/ltc2990.c
+++ b/drivers/hwmon/ltc2990.c
@@ -13,7 +13,7 @@
13#include <linux/i2c.h> 13#include <linux/i2c.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/of.h> 16#include <linux/property.h>
17 17
18#define LTC2990_STATUS 0x00 18#define LTC2990_STATUS 0x00
19#define LTC2990_CONTROL 0x01 19#define LTC2990_CONTROL 0x01
@@ -206,7 +206,6 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c,
206 int ret; 206 int ret;
207 struct device *hwmon_dev; 207 struct device *hwmon_dev;
208 struct ltc2990_data *data; 208 struct ltc2990_data *data;
209 struct device_node *of_node = i2c->dev.of_node;
210 209
211 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA | 210 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
212 I2C_FUNC_SMBUS_WORD_DATA)) 211 I2C_FUNC_SMBUS_WORD_DATA))
@@ -218,9 +217,10 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c,
218 217
219 data->i2c = i2c; 218 data->i2c = i2c;
220 219
221 if (of_node) { 220 if (dev_fwnode(&i2c->dev)) {
222 ret = of_property_read_u32_array(of_node, "lltc,meas-mode", 221 ret = device_property_read_u32_array(&i2c->dev,
223 data->mode, 2); 222 "lltc,meas-mode",
223 data->mode, 2);
224 if (ret < 0) 224 if (ret < 0)
225 return ret; 225 return ret;
226 226