From patchwork Mon Aug 19 12:16:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Staudt X-Patchwork-Id: 11100777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C9E48174A for ; Mon, 19 Aug 2019 12:16:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADAEE2832D for ; Mon, 19 Aug 2019 12:16:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0EE8283C3; Mon, 19 Aug 2019 12:16:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4235827FAC for ; Mon, 19 Aug 2019 12:16:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727068AbfHSMQb (ORCPT ); Mon, 19 Aug 2019 08:16:31 -0400 Received: from enpas.org ([46.38.239.100]:37792 "EHLO mail.enpas.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726852AbfHSMQa (ORCPT ); Mon, 19 Aug 2019 08:16:30 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) by mail.enpas.org (Postfix) with ESMTPSA id 71DAB100174; Mon, 19 Aug 2019 12:16:28 +0000 (UTC) From: Max Staudt To: linux-i2c@vger.kernel.org, linux-hwmon@vger.kernel.org, Wolfram Sang , Jean Delvare , Guenter Roeck Cc: linux-m68k@vger.kernel.org, linux-kernel@vger.kernel.org, glaubitz@physik.fu-berlin.de, Max Staudt Subject: [PATCH v5 2/3] hwmon/ltc2990: Generalise DT to fwnode support Date: Mon, 19 Aug 2019 14:16:17 +0200 Message-Id: <20190819121618.16557-2-max@enpas.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190819121618.16557-1-max@enpas.org> References: <20190819121618.16557-1-max@enpas.org> Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Geert Uytterhoeven --- 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 #include #include -#include +#include #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;