From patchwork Fri Mar 10 14:47:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 67422 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp925276wrd; Fri, 10 Mar 2023 07:08:06 -0800 (PST) X-Google-Smtp-Source: AK7set84I3vwdZxTHiyQKtjT3ld7eOzXAhwFz4vx3pq4VPiWdNdLilwP/jmJW2iMR5KdfQySPPoY X-Received: by 2002:a17:90b:3a88:b0:237:b702:4958 with SMTP id om8-20020a17090b3a8800b00237b7024958mr26840992pjb.38.1678460886539; Fri, 10 Mar 2023 07:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678460886; cv=none; d=google.com; s=arc-20160816; b=Udhdfc5/eKUs+FFeyMmXV8zodEuu3xRpnk55xDie88ICni3+gUpC38mWSVyXGdOTjR Hi9EuihHlAW+BMZRcKSULBBXC0rNHPY0aHOdgkqMjtudZ07tDUjMqGIIFCSZ048GdRfj c+dHOqvhbPoGp5ze2T+7FBM9n+0PFPENWhZDCSNuhSfZ1Ey8KaIeHxdWvS2akYaKwmgk iqJvEVqT/vCHYofQJgGSEsYWaXxDkyn11LkxUvK0zkJLVHTTqsUOZAyyi0SdwGEOh/oh XT3lxCwmdxTHerBhKOKxmZXhgO6qmrJ9zg11YUr3p05umF1y2ZTCVKtd8TikSaeACDt7 nb7w== 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=Y8VxmsrmA7atBWmoRBJdFjgV8EvMVWqE3uCteVpsl+8=; b=hMDhCQCGO2TezFskuqXIcgkRkHc/5UV9ekuXxH2Yy4mEK1zi5YxfOAagiYvIEsi+yM 9DPh3hcEOtVywjJRvi1vJdGWwlFvTGmOgMB6KBxCBwmusvu98sHHsnGi+bZIZpYbdLju lpvwoxl1dJNI6oKzcPS1K8ebg1JC3J41eQAhYNbnx+JhSbQFKlqriStoFV6hXyUI/cCa 1YhpA7tA3YnK3XnjuBhrz7W73xZrxNR3MvDL41pdwqM872tpPqCmimurbRYFtjqQ367B P5S3lXUOnE7+KsyfzJfCfVXGB7lMYE9IwG1nLzTTtrTnRuo5wadydPon4YATvjDlvc+d nBfA== 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 bs8-20020a632808000000b004fc264c3a43si47574pgb.397.2023.03.10.07.07.46; Fri, 10 Mar 2023 07:08:06 -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 S233860AbjCJPHG (ORCPT + 99 others); Fri, 10 Mar 2023 10:07:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233858AbjCJPGk (ORCPT ); Fri, 10 Mar 2023 10:06:40 -0500 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38E9410B1F2; Fri, 10 Mar 2023 06:59:48 -0800 (PST) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-536af432ee5so103212207b3.0; Fri, 10 Mar 2023 06:59:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678460267; 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=Y8VxmsrmA7atBWmoRBJdFjgV8EvMVWqE3uCteVpsl+8=; b=G2LpOUgY2IFeTjxU5dGKuIuNWsbr3ymz4jmAkVqwChZXIqV4dVKvNjIfk4FpeSXACb j3le/eceFLjsDhD+oppyN9QOU5J17/PlOJTsIN509vQFpRG4kfcmNkvCfN96xf3TFkkv ZsBP1IJNpp0TifzYnuNZdYvz96s4SEGNeUNl9d/x3bPfnJUFn14zp4g0f4MEaWREuEgC IMTm72p0hI0uon3GgX2A6vXVFIICdf3vzbfSGyVqK+Gn5w/KeX+sCzeaQmeTCWEzWhAV oectsszIqM71hIKLDEyYfZks1ryoH7FOss6JYkZw5iyzGvFPePzEuAMG1xiabvO33Jm5 euVA== X-Gm-Message-State: AO0yUKVpLC8hVvrYn3uwyBNj4nZmbKzNHJPvAQAHJIDEat5cv/eGcceN A1A3b20MWxgXKtD1ImGKjUfLgYKthA== X-Received: by 2002:a05:6808:5d0:b0:384:28af:539c with SMTP id d16-20020a05680805d000b0038428af539cmr11489276oij.56.1678459705214; Fri, 10 Mar 2023 06:48:25 -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 p127-20020acaf185000000b00383ece4c29bsm994982oih.6.2023.03.10.06.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:48:24 -0800 (PST) Received: (nullmailer pid 1544109 invoked by uid 1000); Fri, 10 Mar 2023 14:47:16 -0000 From: Rob Herring To: Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com Subject: [PATCH] net: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:16 -0600 Message-Id: <20230310144716.1544083-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?1759993802158551945?= X-GMAIL-MSGID: =?utf-8?q?1759993802158551945?= 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 Reviewed-by: Simon Horman Acked-by: Kalle Valo --- drivers/net/mdio/of_mdio.c | 4 ++-- drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c index 510822d6d0d9..bf10d0688eea 100644 --- a/drivers/net/mdio/of_mdio.c +++ b/drivers/net/mdio/of_mdio.c @@ -131,7 +131,7 @@ bool of_mdiobus_child_is_phy(struct device_node *child) return true; } - if (!of_find_property(child, "compatible", NULL)) + if (!of_property_present(child, "compatible")) return true; return false; @@ -203,7 +203,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) /* auto scan for PHYs with empty reg property */ for_each_available_child_of_node(np, child) { /* Skip PHYs with reg property set */ - if (of_find_property(child, "reg", NULL)) + if (of_property_present(child, "reg")) continue; for (addr = 0; addr < PHY_MAX_ADDR; addr++) { diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c index fdd0c9abc1a1..e62f880fdde7 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c @@ -122,7 +122,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, sdio->drive_strength = val; /* make sure there are interrupts defined in the node */ - if (!of_find_property(np, "interrupts", NULL)) + if (!of_property_present(np, "interrupts")) return; irq = irq_of_parse_and_map(np, 0);