From patchwork Fri Mar 10 14:47:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 67487 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp950994wrd; Fri, 10 Mar 2023 07:59:43 -0800 (PST) X-Google-Smtp-Source: AK7set9XDPE3THAq9G8EPZRkU8Pzv77HhSCs0SAkJmEYd1a28/vYYk1FKmkOn81GZcv3SzS3cjNV X-Received: by 2002:a17:90b:4aca:b0:235:9d0c:6e3f with SMTP id mh10-20020a17090b4aca00b002359d0c6e3fmr26209688pjb.31.1678463983378; Fri, 10 Mar 2023 07:59:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678463983; cv=none; d=google.com; s=arc-20160816; b=yb+Sq8CZh1bxTU7pyVmfC5kwc34hCmkkktPtThCKfm8SEwmw2JQNWgCblRxshzSV5g XlfGImfvELIwjvAqmsSiTnWKHlxYeBEL0+gGafLWNYbLLwztde1kTPbWQFP5zbh3khZL DOChOLp+mlQfx2pQXqg4bQ/eL0+HKWS1fnFTnBUss2B84Z7trXapkr5YzuPUpy112gRg RaZ+f3UPW609ErTIdL++mbFtkeAJ/5Y4zLT8COyLsW8QHbm4p3/7sFrdtJHtlT9rUvVD HP899/12X5pcRDmHEbVtdiOmE9UFfdQCJHKj4dm6pHzZDgdUzkUEiwvOJ6r7CW2tJSPj X/fQ== 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 :message-id:date:subject:cc:to:from; bh=7aVJSVz34DokQhgf1apHT5Wo0nZSIGiR/8xWoexMPms=; b=Q/wNU4/SizyWG5NQblGPU/hP0Eub1YDz4XAYNX0+crNcPi5jKQX+ql6dzGww/oOxac D6f8QiPTOq61EdSbapX8u5BD+5wylnuCAGjarFwpdi9eb7WgdLir7rzL95iMIOEGjAYv lBxlt2qOhCAVmnilDfkAM59A/ZXlAtw0eRMbkzhWyi4f6xEPKu4G1fPWwMZG6mVNo/uA 886Vjde6sx/W85T8IpNPQy/C0LOi3zuGKhuMT1Yccc2/OGGvkSoxbshK6BPfB+sJOFwY /1dZZW42AjqH2EkU5c2gdTIkaMD2W93/cfDVxpV0j/7g3hqClGCp4h0HX5WDyLFF6KwM 6MeA== ARC-Authentication-Results: i=1; mx.google.com; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d5-20020a63ed05000000b005072b0d67e2si81860pgi.845.2023.03.10.07.59.29; Fri, 10 Mar 2023 07:59:43 -0800 (PST) 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; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233134AbjCJOtX (ORCPT + 99 others); Fri, 10 Mar 2023 09:49:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232965AbjCJOrv (ORCPT ); Fri, 10 Mar 2023 09:47:51 -0500 Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50A1C10D300; Fri, 10 Mar 2023 06:47:27 -0800 (PST) Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-176b90e14a9so6039149fac.9; Fri, 10 Mar 2023 06:47:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459644; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=7aVJSVz34DokQhgf1apHT5Wo0nZSIGiR/8xWoexMPms=; b=nXH27exN38fBDlw1t52X+M/FV97XhF1uXC1IbKen4ozh/Kx3QrJvtOXUIybqRVaT82 SC6S4TfBC6bCu/k4Uc8G6Htgr4RFOPnJs/5h3QnmQw4BqoDf0Elquqrlg5ALNf6q3SZo uVdoTtoeP7Li7rK8gs7FGKDrdNIjuxmj20Rh4Vkkps27dGw+yqJAi5JDSazbZtaROvMI VRiwRT37xV3CrEJKEXDQd0CdLbkYjVIy6s9WTRttnMIVbgd8g9Fbex58fUg0NXRQg/af n3UWR0JHQPuIeieb5sh996gIeNV2lko8p0Lc2tbcPvtldYpe3psfoca3pjPA+9IAKLjk EccQ== X-Gm-Message-State: AO0yUKVvzzWiJnw2NO71ewwJfynk+S8cqcXH0qmLrbpRUhRNfcLxOf9M 8hsx1WThwf1Bpa6tU9SkSNRONdA93Q== X-Received: by 2002:a05:6870:2050:b0:172:832e:2670 with SMTP id l16-20020a056870205000b00172832e2670mr14804596oad.34.1678459644413; Fri, 10 Mar 2023 06:47:24 -0800 (PST) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id n22-20020a4ae1d6000000b005253a5cc3cfsm865468oot.29.2023.03.10.06.47.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:47:23 -0800 (PST) Received: (nullmailer pid 1543501 invoked by uid 1000); Fri, 10 Mar 2023 14:47:12 -0000 From: Rob Herring To: Lee Jones Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com Subject: [PATCH] mfd: Use of_property_read_bool() for boolean properties Date: Fri, 10 Mar 2023 08:47:12 -0600 Message-Id: <20230310144712.1543449-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=no 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759997050042741526?= X-GMAIL-MSGID: =?utf-8?q?1759997050042741526?= It is preferred to use typed property access functions (i.e. of_property_read_ functions) rather than low-level of_get_property/of_find_property functions for reading properties. Convert reading boolean properties to to of_property_read_bool(). Signed-off-by: Rob Herring --- drivers/mfd/88pm860x-core.c | 3 +-- drivers/mfd/wm8994-core.c | 19 +++++-------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index 6ba7169cb953..581d4d6a785d 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c @@ -1117,8 +1117,7 @@ static int pm860x_dt_init(struct device_node *np, { int ret; - if (of_get_property(np, "marvell,88pm860x-irq-read-clr", NULL)) - pdata->irq_mode = 1; + pdata->irq_mode = of_property_read_bool(np, "marvell,88pm860x-irq-read-clr"); ret = of_property_read_u32(np, "marvell,88pm860x-slave-addr", &pdata->companion_addr); if (ret) { diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index a89221bffde5..c419ab0c0eae 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -279,20 +279,11 @@ static int wm8994_set_pdata_from_of(struct wm8994 *wm8994) of_property_read_u32_array(np, "wlf,micbias-cfg", pdata->micbias, ARRAY_SIZE(pdata->micbias)); - pdata->lineout1_diff = true; - pdata->lineout2_diff = true; - if (of_find_property(np, "wlf,lineout1-se", NULL)) - pdata->lineout1_diff = false; - if (of_find_property(np, "wlf,lineout2-se", NULL)) - pdata->lineout2_diff = false; - - if (of_find_property(np, "wlf,lineout1-feedback", NULL)) - pdata->lineout1fb = true; - if (of_find_property(np, "wlf,lineout2-feedback", NULL)) - pdata->lineout2fb = true; - - if (of_find_property(np, "wlf,ldoena-always-driven", NULL)) - pdata->lineout2fb = true; + pdata->lineout1_diff = !of_property_read_bool(np, "wlf,lineout1-se"); + pdata->lineout2_diff = !of_property_read_bool(np, "wlf,lineout2-se"); + pdata->lineout1fb = of_property_read_bool(np, "wlf,lineout1-feedback"); + pdata->lineout2fb = of_property_read_bool(np, "wlf,lineout2-feedback") || + of_property_read_bool(np, "wlf,ldoena-always-driven"); pdata->spkmode_pu = of_property_read_bool(np, "wlf,spkmode-pu");