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: 132680 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2311383vqr; Tue, 8 Aug 2023 11:22:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQdiPcYu6PXi6juogZ/pw29ZcC3sQrJW0F51BfLdSSNs1TGl/p+wd4QeJgQnAWRvGfCwKE X-Received: by 2002:a17:902:e746:b0:1bb:3979:d467 with SMTP id p6-20020a170902e74600b001bb3979d467mr450117plf.63.1691518922721; Tue, 08 Aug 2023 11:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691518922; cv=none; d=google.com; s=arc-20160816; b=yLr1Qi/if/2AwGFlb23PYQ002lUKusLfJUWIbjAIlzDcffUuaSgiEgG+7QTaz71UOs bCREH/IsudM4bqmZbqpWcOr6MxFsZxp9nBKxXj/4FCCqBojHXuqxT1umgY1ceOKNOGM3 YHVmQfB7C3Q7xJmVbJb0EmNoCWgi2uphJtoU5KxiVvPnV007ugBANll3LJeuRpdosmo1 lnid29ux/scev1ZO89ObxuUooYxAhnj9Q2yIP35d8DClCHhk1id/M8kd07qgSQQr4OB5 wL6AsEtJgFl+TLOy5Ou86SVroivjAmrjQWz9NFFJzYoI4DTxiU2xa8RtPzJdiJesDpWp /xoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ilWsicpscpRu2lnzsTqBc1RX+7rN2jiGjq4vzcrZDIs=; fh=pEdA8+/af95LJlWFD5rBB7RG10kRMWALDQ/52TY9s20=; b=Q4F/7ZYjvfMceQMx6T3NaDBNjBZ1HgwMkDUMR0yBN/CZmXG7ADkGjxo4Y1ooIrLvxV m44bAiT6cU1r0fleHpwzRKjnfmDmMeo0V/IG6BsQD3aDiN2ohD9CUZm8th1KRP2pgJFZ l9IC9Jb5BKZQGyWsIVngRK5/3qwSRFxb+EnJkmvgUtlPtNGGT6H8LH7038gRU2QZuGt2 muRHKxOyvSkCVoiPzxQczb5fJUx4TW30fVnCsidcx7jinR8xt8KKS0T+ZvpG20iJhh5q gqTz22+Toz79DghR2gmF2S5aFXSRJmkM65kJnm4r+Isp7eWQwVspqYycFGfPr9EZph/j FdQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fjGxyUfc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v135-20020a63618d000000b0056507c2502fsi121014pgb.236.2023.08.08.11.21.48; Tue, 08 Aug 2023 11:22:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fjGxyUfc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231156AbjHHR76 (ORCPT + 99 others); Tue, 8 Aug 2023 13:59:58 -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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773686145484179492 X-GMAIL-MSGID: 1773686145484179492 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];