From patchwork Tue Aug 8 16:27:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 712032 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 254ACC04FE0 for ; Tue, 8 Aug 2023 20:29:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232310AbjHHU3m (ORCPT ); Tue, 8 Aug 2023 16:29:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232941AbjHHU3d (ORCPT ); Tue, 8 Aug 2023 16:29:33 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 490B31D474; Tue, 8 Aug 2023 10:17:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691515046; x=1723051046; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zJqEmuXZRFYwNy3i9MPLkKcjIG6qYzI1X7jD3nxkn2c=; b=G3GYYpSZUsVd6h4r0Aa7Asfu6mVcK89Tqc2FXqJ7h5EgT9dBVskoX49s n1cu3u65KdbhhpoTF97Mo6WLoW3fNdKHKIv8WUkiAwg16zHaRTCxYTGbH 1IXmCHgwopAMczejc2Y7+Hz9mRe9wf8Xf3UitBsOKaf1DBRrJ4BKxx6Fi GDXMerUH8GFse1DYFkshg1tqmyxmzhKZ71a2nEeS4mEak3bBFnGhQ9rKY 3UTojXyvAvlZPn3aHr8/osCvGXGChkOMNnSb9d8Kyk77txXhrJryOu83f VTbo2qqnsi9/AAI/nYh93vd4bF7QI6PrA4+3zBfJZzJLmrWBAC5VTtX/F Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="360970374" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="360970374" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2023 09:24:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="845525001" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="845525001" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga002.fm.intel.com with ESMTP; 08 Aug 2023 09:24:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 35C26133; Tue, 8 Aug 2023 19:28:03 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Greg Kroah-Hartman , Antoniu Miclaus , Jonathan Cameron , Gerald Loacker , Gwendal Grignou , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: Daniel Scally , Heikki Krogerus , Sakari Ailus , "Rafael J. Wysocki" , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Subject: [PATCH v1 1/6] device property: Use fwnode_property_string_array_count() Date: Tue, 8 Aug 2023 19:27:55 +0300 Message-Id: <20230808162800.61651-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230808162800.61651-1-andriy.shevchenko@linux.intel.com> References: <20230808162800.61651-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Use fwnode_property_string_array_count() instead of open coded variant. Signed-off-by: Andy Shevchenko Acked-by: Rafael J. Wysocki --- drivers/base/property.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/property.c b/drivers/base/property.c index 8c40abed7852..3bb9505f1631 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -473,7 +473,7 @@ int fwnode_property_match_string(const struct fwnode_handle *fwnode, const char **values; int nval, ret; - nval = fwnode_property_read_string_array(fwnode, propname, NULL, 0); + nval = fwnode_property_string_array_count(fwnode, propname); if (nval < 0) return nval; From patchwork Tue Aug 8 16:27:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 711631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 548B1C04A94 for ; Tue, 8 Aug 2023 17:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232821AbjHHR7A (ORCPT ); Tue, 8 Aug 2023 13:59:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229723AbjHHR6i (ORCPT ); Tue, 8 Aug 2023 13:58:38 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 582B32BC8A; Tue, 8 Aug 2023 09:26:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691511991; x=1723047991; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=f91CxPAnd8jYoABhN6Y0bEUrupNGUDodI0gM1y7O31Y=; b=ZCk+nwI71K0P+TdytxIjoUExeLBvf1bcfN4ut8zs73mt1JNZPO6eRUMe bLldGwiSgnAHyJxzUPNe3Mfza4IeJnbVzvtzPDRSnoSFx1XIPbR0HZgi1 zW5YZibVjJL/AuTy5vSfoglkpc3rVWviSwYZ2iQqt4sgOigGC6Axgz6Hy ERU0cpFI6nmXEgII45OLJ0TjH6r6RCfC7JmOIoS5OtA3smvSKKC4cQax8 OwuKwv4YTQdHPKXYLkcFUizZgp+D2I6KBTmyu8JJeAPyc9pLxBurUJX2H nXaZBSs0pkl6FU6uHxQouVh3fnT5M8/eupOpf+1X66l4apzU670mlRVbY w==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="457260946" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="457260946" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2023 09:25:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="821449146" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="821449146" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 08 Aug 2023 09:24:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 4E5BDF4D; Tue, 8 Aug 2023 19:28:03 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Greg Kroah-Hartman , Antoniu Miclaus , Jonathan Cameron , Gerald Loacker , Gwendal Grignou , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: Daniel Scally , Heikki Krogerus , Sakari Ailus , "Rafael J. Wysocki" , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Subject: [PATCH v1 3/6] iio: frequency: adf4377: Switch to device_property_match_property_string() Date: Tue, 8 Aug 2023 19:27:57 +0300 Message-Id: <20230808162800.61651-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230808162800.61651-1-andriy.shevchenko@linux.intel.com> References: <20230808162800.61651-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Replace open coded device_property_match_property_string(). Signed-off-by: Andy Shevchenko --- drivers/iio/frequency/adf4377.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/iio/frequency/adf4377.c b/drivers/iio/frequency/adf4377.c index 26abecbd51e0..9284c13f1abb 100644 --- a/drivers/iio/frequency/adf4377.c +++ b/drivers/iio/frequency/adf4377.c @@ -870,7 +870,6 @@ static const struct iio_chan_spec adf4377_channels[] = { static int adf4377_properties_parse(struct adf4377_state *st) { struct spi_device *spi = st->spi; - const char *str; int ret; st->clkin = devm_clk_get_enabled(&spi->dev, "ref_in"); @@ -896,16 +895,13 @@ static int adf4377_properties_parse(struct adf4377_state *st) return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk2), "failed to get the CE GPIO\n"); - ret = device_property_read_string(&spi->dev, "adi,muxout-select", &str); - if (ret) { - st->muxout_select = ADF4377_MUXOUT_HIGH_Z; - } else { - ret = match_string(adf4377_muxout_modes, ARRAY_SIZE(adf4377_muxout_modes), str); - if (ret < 0) - return ret; - + ret = device_property_match_property_string(&spi->dev, "adi,muxout-select", + adf4377_muxout_modes, + ARRAY_SIZE(adf4377_muxout_modes)); + if (ret >= 0) st->muxout_select = ret; - } + else + st->muxout_select = ADF4377_MUXOUT_HIGH_Z; return 0; } From patchwork Tue Aug 8 16:27:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 711630 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D76BC41513 for ; Tue, 8 Aug 2023 17:59:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235198AbjHHR74 (ORCPT ); Tue, 8 Aug 2023 13:59:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233970AbjHHR7Z (ORCPT ); Tue, 8 Aug 2023 13:59:25 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D60F8908; Tue, 8 Aug 2023 09:27:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691512027; x=1723048027; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=15sgPUJ2wXhm4hgjV02VyUPoKXBOHJknS1CjWkpfOyM=; b=fjGxyUfcCvQ7Em1m8Y3hw6J3xNlxSlBWWxFv5s1H+8QzFxH6Za39u/Mw YeZqsOFHDA+Rr60vRP2NwcbQIfZoF0skTZk7DOvNvpZwNRjINlxvXqggD TNMKXEzTgT0GYzJmLiqOdberUn6+oMhdcb+fZCNAs2faMqjnQw6m8/b5D 7kecFwMxdMrI3reVKfGvcgAilidCkxxo+EwJDj9UQtO1S3VWqkqw7nOd+ ZXrSro7UVImlgD69ffU8kAxxnJB23oUqH30ExL1qm6m4y83zKZ3i6bKw0 lUHIJZxrne+VffaHJboCOP1+UW8bc1Z2Q+Fjgu062mWxwGCKtpp+X4Hu9 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="457260970" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="457260970" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2023 09:25:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="821449147" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="821449147" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 08 Aug 2023 09:24:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 5AC1F1341; Tue, 8 Aug 2023 19:28:03 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Greg Kroah-Hartman , Antoniu Miclaus , Jonathan Cameron , Gerald Loacker , Gwendal Grignou , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: Daniel Scally , Heikki Krogerus , Sakari Ailus , "Rafael J. Wysocki" , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Subject: [PATCH v1 4/6] iio: frequency: admv1014: Switch to device_property_match_property_string() Date: Tue, 8 Aug 2023 19:27:58 +0300 Message-Id: <20230808162800.61651-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230808162800.61651-1-andriy.shevchenko@linux.intel.com> References: <20230808162800.61651-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Replace open coded device_property_match_property_string(). Signed-off-by: Andy Shevchenko --- drivers/iio/frequency/admv1014.c | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/drivers/iio/frequency/admv1014.c b/drivers/iio/frequency/admv1014.c index bb5e1feef42b..b46b73b89eb7 100644 --- a/drivers/iio/frequency/admv1014.c +++ b/drivers/iio/frequency/admv1014.c @@ -710,7 +710,6 @@ static int admv1014_init(struct admv1014_state *st) static int admv1014_properties_parse(struct admv1014_state *st) { - const char *str; unsigned int i; struct spi_device *spi = st->spi; int ret; @@ -719,27 +718,21 @@ static int admv1014_properties_parse(struct admv1014_state *st) st->p1db_comp = device_property_read_bool(&spi->dev, "adi,p1db-compensation-enable"); - ret = device_property_read_string(&spi->dev, "adi,input-mode", &str); - if (ret) { - st->input_mode = ADMV1014_IQ_MODE; - } else { - ret = match_string(input_mode_names, ARRAY_SIZE(input_mode_names), str); - if (ret < 0) - return ret; - + ret = device_property_match_property_string(&spi->dev, "adi,input-mode", + input_mode_names, + ARRAY_SIZE(input_mode_names)); + if (ret >= 0) st->input_mode = ret; - } - - ret = device_property_read_string(&spi->dev, "adi,quad-se-mode", &str); - if (ret) { - st->quad_se_mode = ADMV1014_SE_MODE_POS; - } else { - ret = match_string(quad_se_mode_names, ARRAY_SIZE(quad_se_mode_names), str); - if (ret < 0) - return ret; + else + st->input_mode = ADMV1014_IQ_MODE; + ret = device_property_match_property_string(&spi->dev, "adi,quad-se-mode", + quad_se_mode_names, + ARRAY_SIZE(quad_se_mode_names)); + if (ret >= 0) st->quad_se_mode = ADMV1014_SE_MODE_POS + (ret * 3); - } + else + st->quad_se_mode = ADMV1014_SE_MODE_POS; for (i = 0; i < ADMV1014_NUM_REGULATORS; ++i) st->regulators[i].supply = admv1014_reg_name[i]; From patchwork Tue Aug 8 16:28:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 711629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E00C4C41513 for ; Tue, 8 Aug 2023 18:00:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235211AbjHHSAM (ORCPT ); Tue, 8 Aug 2023 14:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231340AbjHHR7m (ORCPT ); Tue, 8 Aug 2023 13:59:42 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C53082CEDE; Tue, 8 Aug 2023 09:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691512040; x=1723048040; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gWwAWGglUm0bX7zbgnm6zeMnQk/P1kwlr24RlDxfY40=; b=im2U57xWrm1MTPgzQZJe1GyXcXPY10iqx8PoVOYdAK8in4RWxWx2ulnP hOdRZBULwZSSI1CMdyS6/sn/ET2LQmnU0pjaAChTaKAs8Em2Gy4t0oQ/+ wezzKH//aTVfygEVxFx2rEhMvr2yEkO2M35PmgX7Y1axwPQZFN097UsQJ MJFOF9YgRwpRI7iyo/zFOHzbb3NCzQBLPjG6WjU8Ds9J2CM+UmPV6I4yN 9OzQSOtsLsZEOckKb4aP8nAaJg3CuopcbklUFoRO1Cz+vzhEGz2QuJg33 8ecdWGfPnZUC167rw4EbLYFxHYof34Ma1ySO4ijlxXQSEKrhouH4HOOhr A==; X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="457260988" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="457260988" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Aug 2023 09:25:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10795"; a="821449262" X-IronPort-AV: E=Sophos;i="6.01,156,1684825200"; d="scan'208";a="821449262" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 08 Aug 2023 09:24:59 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 79FAC1476; Tue, 8 Aug 2023 19:28:03 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Greg Kroah-Hartman , Antoniu Miclaus , Jonathan Cameron , Gerald Loacker , Gwendal Grignou , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: Daniel Scally , Heikki Krogerus , Sakari Ailus , "Rafael J. Wysocki" , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Subject: [PATCH v1 6/6] iio: proximity: sx9324: Switch to device_property_match_property_string() Date: Tue, 8 Aug 2023 19:28:00 +0300 Message-Id: <20230808162800.61651-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230808162800.61651-1-andriy.shevchenko@linux.intel.com> References: <20230808162800.61651-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Replace open coded device_property_match_property_string(). Signed-off-by: Andy Shevchenko --- drivers/iio/proximity/sx9324.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c index 438f9c9aba6e..ac2ed2da21cc 100644 --- a/drivers/iio/proximity/sx9324.c +++ b/drivers/iio/proximity/sx9324.c @@ -888,7 +888,6 @@ sx9324_get_default_reg(struct device *dev, int idx, char prop[] = SX9324_PROXRAW_DEF; u32 start = 0, raw = 0, pos = 0; int ret, count, ph, pin; - const char *res; memcpy(reg_def, &sx9324_default_regs[idx], sizeof(*reg_def)); @@ -915,24 +914,21 @@ sx9324_get_default_reg(struct device *dev, int idx, reg_def->def = raw; break; case SX9324_REG_AFE_CTRL0: - ret = device_property_read_string(dev, - "semtech,cs-idle-sleep", &res); - if (!ret) - ret = match_string(sx9324_csidle, ARRAY_SIZE(sx9324_csidle), res); + ret = device_property_match_property_string(dev, "semtech,cs-idle-sleep", + sx9324_csidle, + ARRAY_SIZE(sx9324_csidle)); if (ret >= 0) { reg_def->def &= ~SX9324_REG_AFE_CTRL0_CSIDLE_MASK; reg_def->def |= ret << SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT; } - ret = device_property_read_string(dev, - "semtech,int-comp-resistor", &res); - if (ret) - break; - ret = match_string(sx9324_rints, ARRAY_SIZE(sx9324_rints), res); - if (ret < 0) - break; - reg_def->def &= ~SX9324_REG_AFE_CTRL0_RINT_MASK; - reg_def->def |= ret << SX9324_REG_AFE_CTRL0_RINT_SHIFT; + ret = device_property_match_property_string(dev, "semtech,int-comp-resistor", + sx9324_rints, + ARRAY_SIZE(sx9324_rints)); + if (ret >= 0) { + reg_def->def &= ~SX9324_REG_AFE_CTRL0_RINT_MASK; + reg_def->def |= ret << SX9324_REG_AFE_CTRL0_RINT_SHIFT; + } break; case SX9324_REG_AFE_CTRL4: case SX9324_REG_AFE_CTRL7: