linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Max Staudt <max@enpas.org>
To: linux-i2c@vger.kernel.org, linux-hwmon@vger.kernel.org,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>
Cc: linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org,
	glaubitz@physik.fu-berlin.de, Max Staudt <max@enpas.org>
Subject: [PATCH v5 2/3] hwmon/ltc2990: Generalise DT to fwnode support
Date: Mon, 19 Aug 2019 14:16:17 +0200	[thread overview]
Message-ID: <20190819121618.16557-2-max@enpas.org> (raw)
In-Reply-To: <20190819121618.16557-1-max@enpas.org>

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(-)

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;
 
-- 
2.11.0

  reply	other threads:[~2019-08-19 12:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 12:16 [PATCH v5 1/3] i2c/busses: Add i2c-icy for I2C on m68k/Amiga Max Staudt
2019-08-19 12:16 ` Max Staudt [this message]
2019-08-20  9:09   ` [PATCH v5 2/3] hwmon/ltc2990: Generalise DT to fwnode support Geert Uytterhoeven
2019-08-20 15:07   ` Guenter Roeck
2019-08-20 15:08     ` Max Staudt
2019-08-19 12:16 ` [PATCH v5 3/3] i2c/busses/i2c-icy: Add LTC2990 present on 2019 board revision Max Staudt
2019-08-20  9:18   ` Geert Uytterhoeven
2019-08-20  9:22     ` Max
2019-08-29 19:06   ` Wolfram Sang
2019-08-20  9:08 ` [PATCH v5 1/3] i2c/busses: Add i2c-icy for I2C on m68k/Amiga Geert Uytterhoeven
2019-08-20  9:23   ` Max
2019-08-20  9:27     ` [PATCH] " Max Staudt
2019-08-29 19:00       ` Wolfram Sang
2019-08-29 19:17         ` Max Staudt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190819121618.16557-2-max@enpas.org \
    --to=max@enpas.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).