diff mbox series

[v5,2/3] hwmon/ltc2990: Generalise DT to fwnode support

Message ID 20190819121618.16557-2-max@enpas.org (mailing list archive)
State Accepted
Headers show
Series [v5,1/3] i2c/busses: Add i2c-icy for I2C on m68k/Amiga | expand

Commit Message

Max Staudt Aug. 19, 2019, 12:16 p.m. UTC
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>
---
 drivers/hwmon/ltc2990.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Geert Uytterhoeven Aug. 20, 2019, 9:09 a.m. UTC | #1
On Mon, Aug 19, 2019 at 2:17 PM Max Staudt <max@enpas.org> wrote:
> 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>

Gr{oetje,eeting}s,

                        Geert
Guenter Roeck Aug. 20, 2019, 3:07 p.m. UTC | #2
On Mon, Aug 19, 2019 at 02:16:17PM +0200, Max Staudt wrote:
> 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>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/ltc2990.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c
> index f9431ad43..53ff50517 100644
> --- a/drivers/hwmon/ltc2990.c
> +++ b/drivers/hwmon/ltc2990.c
> @@ -13,7 +13,7 @@
>  #include <linux/i2c.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
> -#include <linux/of.h>
> +#include <linux/property.h>
>  
>  #define LTC2990_STATUS	0x00
>  #define LTC2990_CONTROL	0x01
> @@ -206,7 +206,6 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c,
>  	int ret;
>  	struct device *hwmon_dev;
>  	struct ltc2990_data *data;
> -	struct device_node *of_node = i2c->dev.of_node;
>  
>  	if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
>  				     I2C_FUNC_SMBUS_WORD_DATA))
> @@ -218,9 +217,10 @@ static int ltc2990_i2c_probe(struct i2c_client *i2c,
>  
>  	data->i2c = i2c;
>  
> -	if (of_node) {
> -		ret = of_property_read_u32_array(of_node, "lltc,meas-mode",
> -						 data->mode, 2);
> +	if (dev_fwnode(&i2c->dev)) {
> +		ret = device_property_read_u32_array(&i2c->dev,
> +						     "lltc,meas-mode",
> +						     data->mode, 2);
>  		if (ret < 0)
>  			return ret;
>
Max Staudt Aug. 20, 2019, 3:08 p.m. UTC | #3
On 08/20/2019 05:07 PM, Guenter Roeck wrote:
> On Mon, Aug 19, 2019 at 02:16:17PM +0200, Max Staudt wrote:
>> 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>
> 
> Applied to hwmon-next.
> 
> Thanks,
> Guenter

Thanks for your help, reviewing, and applying!

Max
diff mbox series

Patch

diff --git a/drivers/hwmon/ltc2990.c b/drivers/hwmon/ltc2990.c
index f9431ad43..53ff50517 100644
--- a/drivers/hwmon/ltc2990.c
+++ b/drivers/hwmon/ltc2990.c
@@ -13,7 +13,7 @@ 
 #include <linux/i2c.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/property.h>
 
 #define LTC2990_STATUS	0x00
 #define LTC2990_CONTROL	0x01
@@ -206,7 +206,6 @@  static int ltc2990_i2c_probe(struct i2c_client *i2c,
 	int ret;
 	struct device *hwmon_dev;
 	struct ltc2990_data *data;
-	struct device_node *of_node = i2c->dev.of_node;
 
 	if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
 				     I2C_FUNC_SMBUS_WORD_DATA))
@@ -218,9 +217,10 @@  static int ltc2990_i2c_probe(struct i2c_client *i2c,
 
 	data->i2c = i2c;
 
-	if (of_node) {
-		ret = of_property_read_u32_array(of_node, "lltc,meas-mode",
-						 data->mode, 2);
+	if (dev_fwnode(&i2c->dev)) {
+		ret = device_property_read_u32_array(&i2c->dev,
+						     "lltc,meas-mode",
+						     data->mode, 2);
 		if (ret < 0)
 			return ret;