From patchwork Fri Mar 10 14:47:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 67486 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp950863wrd; Fri, 10 Mar 2023 07:59:28 -0800 (PST) X-Google-Smtp-Source: AK7set+d+1sQu1v/sPerO2ImfsY2OLJLQ5/i9nHj8hzxv3tgxEeC6LZ4WfPiQkWBrWdD6eHCWzL4 X-Received: by 2002:a05:6a20:7b30:b0:cc:109b:6c85 with SMTP id s48-20020a056a207b3000b000cc109b6c85mr22121985pzh.7.1678463967794; Fri, 10 Mar 2023 07:59:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678463967; cv=none; d=google.com; s=arc-20160816; b=Q+sBE44XFvyJ423bWjsnDCy6cwDxXRFmwQ8GLnNjC40XmycA2QNz+x8hQczls3/8ge i2nupWiKAtbHbXgYWmey+q3aH3K/KRE4NXCNSYFDE8S0au2CFz98otl/o4eQif+dd5wc ryWwb2UgIUJJElJDNKcRsswpuCB+Viq8EdKIYIJqweGDrXnK3nm1/YoWJgo1PmJKSEEU zrPZAwAdFZTiJuHIaF/b+NpLgo8mFHNnD4l4BwmkBEPhyoPsGbPKzXgtWelUZRInqEVz FDzYaOnYA1yP9rgM7k2TfLH7qYoE5jMBFPRJOgg6NjRhAK0eY3vHul/X3QxR7D/ghqo8 DMyg== 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=ZSlcrAdOk2ZHbJaFPGHkD2mhUxcO2+0jdOc1ehU4BF0=; b=PPYSkNoJTUNABEOH7rOrvYZ7OKkL8mJhrmzZx8tsfCqaAB6x5P4hOpIxNmwdSzyp+f h48zxFkBhjqQU75paJsktpA+c9DyDKJQaQbYYYzJ1AS2OVfnPlxpMg+C+o3JUI1X2RGV x8F9+9cz84gCsIDjbtZheIw2U796ju4fieKqAFobuztHzPZKLBmKliBIauswXBVWp5Jl k/VG8cOWt78aT9OM816wIOzsUcEvnzI3dzMvT2nqNjpR5xScpUWJ2oCyKaGZ+ZF8dZ7+ /w6krxm1kSbFKnAdEQRw8vLYy63wFTwwwp5uBa2w+Oqc4TcM882Hud0NANXF0AGTdtxS gmbw== 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 x190-20020a6363c7000000b004fc238851cfsi151450pgb.208.2023.03.10.07.59.13; Fri, 10 Mar 2023 07:59:27 -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 S233836AbjCJPHD (ORCPT + 99 others); Fri, 10 Mar 2023 10:07:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233709AbjCJPGf (ORCPT ); Fri, 10 Mar 2023 10:06:35 -0500 Received: from mail-yw1-x1130.google.com (mail-yw1-x1130.google.com [IPv6:2607:f8b0:4864:20::1130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FA8599D4E; Fri, 10 Mar 2023 06:59:39 -0800 (PST) Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-536c02eea4dso102496147b3.4; Fri, 10 Mar 2023 06:59:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678460254; 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=ZSlcrAdOk2ZHbJaFPGHkD2mhUxcO2+0jdOc1ehU4BF0=; b=Q4SZI/q1Q7vDg9eqmTg3II4xYhX1r4nHDn2Kfg8LMyHEDd0WBtT7MQt09BYWC4VPJJ MS2+PZIV04UWYBh88L+eSEpy8eamCgQWmsdx741usuRfbRWLsuubqjAmbCjUbkI1LB8W IaD5b13agylttOhXgGSb5LaAQicPo87I3DtAJjShED/dbJuKIT22znp8O8/hJxE9MonD guYkPHh98xWLydU7IAoyNlMqv0PQ4jh8zW7wDCUipKmiRmSfVUC+amVFYZWcZePhKE7a PvQJyMCclbWV5dVdapgV0Ir9DdkMabklw5W9MSHb84ELJDQWWLFrxv3SLk6dCVX0uxDK rhkA== X-Gm-Message-State: AO0yUKXsCxu9cHBdTLmawPGZY17/RxzIoS5DwKYGSJB6McpDfF/FdWM4 7+yKO8otFENOsoBqbDC7bMIZsmkGwA== X-Received: by 2002:aca:2210:0:b0:384:ea9:237d with SMTP id b16-20020aca2210000000b003840ea9237dmr11076654oic.36.1678459724416; Fri, 10 Mar 2023 06:48:44 -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 y129-20020acae187000000b0038476262f65sm967368oig.33.2023.03.10.06.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:48:43 -0800 (PST) Received: (nullmailer pid 1546844 invoked by uid 1000); Fri, 10 Mar 2023 14:47:35 -0000 From: Rob Herring To: Benjamin Herrenschmidt , Colin Leroy Cc: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] macintosh: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:35 -0600 Message-Id: <20230310144735.1546817-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,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?1759997033500787630?= X-GMAIL-MSGID: =?utf-8?q?1759997033500787630?= 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. As part of this, convert of_get_property/of_find_property calls to the recently added of_property_present() helper when we just want to test for presence of a property and nothing more. Signed-off-by: Rob Herring --- drivers/macintosh/rack-meter.c | 2 +- drivers/macintosh/therm_adt746x.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c index c28893e41a8b..40240bce77b0 100644 --- a/drivers/macintosh/rack-meter.c +++ b/drivers/macintosh/rack-meter.c @@ -387,7 +387,7 @@ static int rackmeter_probe(struct macio_dev* mdev, if (of_node_name_eq(np, "lightshow")) break; if (of_node_name_eq(np, "sound") && - of_get_property(np, "virtual", NULL) != NULL) + of_property_present(np, "virtual")) break; } if (np == NULL) { diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c index 8f5db9093c9a..384b87d661e1 100644 --- a/drivers/macintosh/therm_adt746x.c +++ b/drivers/macintosh/therm_adt746x.c @@ -483,7 +483,7 @@ static int probe_thermostat(struct i2c_client *client) if (vers != 1) return -ENXIO; - if (of_get_property(np, "hwsensor-location", NULL)) { + if (of_property_present(np, "hwsensor-location")) { for (i = 0; i < 3; i++) { sensor_location[i] = of_get_property(np, "hwsensor-location", NULL) + offset;