Message ID | 20230310144720.1544600-1-robh@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp949030wrd; Fri, 10 Mar 2023 07:55:16 -0800 (PST) X-Google-Smtp-Source: AK7set8RzKe64tOm9HNKDqvHptQflKl8aAQ37HPkHGbdYcxim5eKQbTK/uvhsSDKz1bx6AGjp4Zr X-Received: by 2002:a17:90b:3883:b0:234:bf6e:5651 with SMTP id mu3-20020a17090b388300b00234bf6e5651mr27271231pjb.13.1678463716180; Fri, 10 Mar 2023 07:55:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678463716; cv=none; d=google.com; s=arc-20160816; b=iFjtzjHGM5IOxF6OX3c/jblEqpq7/9r6fNAwwxG4gKkcOWDmJu0kw5lhKMvy5wYoYs olqbxKeVe5qSFQ+dVvGN0kWKIa5AWzD8ugm9oD1cfAJ5A6Gpc2EgI4EC0bLjUWlTMZCE ZWmtd6pyO5Jcz2bcHcCDHyY/pUExzV5IcwuWOSVLCpiudSNoI/hafTR66d0ZHqVn8/l/ EK8PvGIMLTgh7oqKddjqCO1u9/DQ3VbdNZCR8vTiCChQ1O2AEWTPGngfDOQGqBMRKROC d2K5dBawD32Az+6VlqEf0VSdxEW1/jjhWKaS0VrigRwZgaawsqjgOaI7Jgqvoa2qM3SI XFgA== 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=GQ2+PQGllxO2iVkzKima9jszwdEFIn3jQrBHflP9Onc=; b=xtTQEmJRrdDfCoXapYsnF9kLlQMRfOsWR5pqE58CxFFNA0NJWahl6kYhhwBmMcBkaE r78BzOAOoxzUggcWU+N5p+MhGMcHcD8MRwvwTTLaKNOucu+Iufq2W/LUOKncPXsaUkoS urVx9QaThMDjkQCDq5iJmTA9agLqtCwy2b5o0sfFsWwDoLDrhhNqAwHd/FsjyDHftazM Kkheq5U7iFnO33F3MKJd0vEj2M3mLEFX6VdJ+8SSpxw/9low+2QVQ/wZH4IcQBeYfK1M pw1D06wFV5jCPS1KQnXcHOyYc6PpTkHfT8vP9oXigBSS9cOMndxBDPTKPStRrSurx1IZ /sRQ== 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 v11-20020a17090abb8b00b0023369af18e2si154175pjr.72.2023.03.10.07.55.01; Fri, 10 Mar 2023 07:55:16 -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 S233482AbjCJOyJ (ORCPT <rfc822;carlos.wei.hk@gmail.com> + 99 others); Fri, 10 Mar 2023 09:54:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233434AbjCJOxd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 10 Mar 2023 09:53:33 -0500 Received: from mail-oa1-f52.google.com (mail-oa1-f52.google.com [209.85.160.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01A3E12A14B; Fri, 10 Mar 2023 06:49:32 -0800 (PST) Received: by mail-oa1-f52.google.com with SMTP id 586e51a60fabf-1755e639b65so6083621fac.3; Fri, 10 Mar 2023 06:49:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459716; 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=GQ2+PQGllxO2iVkzKima9jszwdEFIn3jQrBHflP9Onc=; b=0iCSaIGaOi48uhBMEEb8W0tqAZfstqm3L+S7Fl42URlzy8yNLSOLJWLE8OYnbQd3ii /F6ogCZBp2zUCidJjk9ltVNTA85fsMysz0O62hh8ETxKziqBV4DKCjh4jNeUhMX0VeHQ w7nKVhPvZwUVvFBLhLh0J9jBnZ/s6cm4wJtJf3qXDPEAR/41+ZnX90VEvATLMf6S96Th vR9cHxLxuiEkPFlWqfWWIuqDLlbSVa2s5uuyUi3/TtbFvZni6ODOud1H//ehZdPk9wT/ 88P4vLMO7PcNY6q1aA+qtd7WDOPNgvJ7+Z18Am55QgzLU6DaNJmNadCvKCrJABL7Yb+o PeCw== X-Gm-Message-State: AO0yUKW61jl32XVkgVyONKLhYdtW5hlYzTd9TVb43q9e9wZviJwNec0A LJhRy6jcgPLCEjXAqh9Xzg== X-Received: by 2002:a05:6870:2108:b0:16e:2d3f:187 with SMTP id f8-20020a056870210800b0016e2d3f0187mr17201161oae.11.1678459716307; Fri, 10 Mar 2023 06:48:36 -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 e6-20020a056870920600b0017630fe87e5sm88853oaf.33.2023.03.10.06.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:48:35 -0800 (PST) Received: (nullmailer pid 1544626 invoked by uid 1000); Fri, 10 Mar 2023 14:47:20 -0000 From: Rob Herring <robh@kernel.org> To: Vinod Koul <vkoul@kernel.org>, Kishon Vijay Abraham I <kishon@kernel.org>, Chen-Yu Tsai <wens@csie.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org> Cc: devicetree@vger.kernel.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] phy: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:20 -0600 Message-Id: <20230310144720.1544600-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759996769609578745?= X-GMAIL-MSGID: =?utf-8?q?1759996769609578745?= |
Series |
phy: Use of_property_present() for testing DT property presence
|
|
Commit Message
Rob Herring
March 10, 2023, 2:47 p.m. UTC
It is preferred to use typed property access functions (i.e.
of_property_read_<type> 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 <robh@kernel.org>
---
drivers/phy/allwinner/phy-sun4i-usb.c | 2 +-
drivers/phy/broadcom/phy-bcm-ns-usb2.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Comments
On Fri, 10 Mar 2023 08:47:20 -0600 Rob Herring <robh@kernel.org> wrote: > It is preferred to use typed property access functions (i.e. > of_property_read_<type> 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 <robh@kernel.org> (for both:) Reviewed-by: Andre Przywara <andre.przywara@arm.com> Cheers, Andre > --- > drivers/phy/allwinner/phy-sun4i-usb.c | 2 +- > drivers/phy/broadcom/phy-bcm-ns-usb2.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c > index fbcd7014ab43..fc9f6fb447a0 100644 > --- a/drivers/phy/allwinner/phy-sun4i-usb.c > +++ b/drivers/phy/allwinner/phy-sun4i-usb.c > @@ -758,7 +758,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) > return PTR_ERR(data->vbus_det_gpio); > } > > - if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { > + if (of_property_present(np, "usb0_vbus_power-supply")) { > data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, > "usb0_vbus_power-supply"); > if (IS_ERR(data->vbus_power_supply)) { > diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c b/drivers/phy/broadcom/phy-bcm-ns-usb2.c > index 6a36e187d100..269564bdf687 100644 > --- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c > +++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c > @@ -107,7 +107,7 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev) > return -ENOMEM; > usb2->dev = dev; > > - if (of_find_property(dev->of_node, "brcm,syscon-clkset", NULL)) { > + if (of_property_present(dev->of_node, "brcm,syscon-clkset")) { > usb2->base = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(usb2->base)) { > dev_err(dev, "Failed to map control reg\n");
Dne petek, 10. marec 2023 ob 15:47:20 CET je Rob Herring napisal(a): > It is preferred to use typed property access functions (i.e. > of_property_read_<type> 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 <robh@kernel.org> > --- > drivers/phy/allwinner/phy-sun4i-usb.c | 2 +- for sun4i: Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Best regards, Jernej > drivers/phy/broadcom/phy-bcm-ns-usb2.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c > b/drivers/phy/allwinner/phy-sun4i-usb.c index fbcd7014ab43..fc9f6fb447a0 > 100644 > --- a/drivers/phy/allwinner/phy-sun4i-usb.c > +++ b/drivers/phy/allwinner/phy-sun4i-usb.c > @@ -758,7 +758,7 @@ static int sun4i_usb_phy_probe(struct platform_device > *pdev) return PTR_ERR(data->vbus_det_gpio); > } > > - if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { > + if (of_property_present(np, "usb0_vbus_power-supply")) { > data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, > "usb0_vbus_power-supply"); > if (IS_ERR(data->vbus_power_supply)) { > diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c > b/drivers/phy/broadcom/phy-bcm-ns-usb2.c index 6a36e187d100..269564bdf687 > 100644 > --- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c > +++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c > @@ -107,7 +107,7 @@ static int bcm_ns_usb2_probe(struct platform_device > *pdev) return -ENOMEM; > usb2->dev = dev; > > - if (of_find_property(dev->of_node, "brcm,syscon-clkset", NULL)) { > + if (of_property_present(dev->of_node, "brcm,syscon-clkset")) { > usb2->base = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(usb2->base)) { > dev_err(dev, "Failed to map control reg\n");
On 10-03-23, 08:47, Rob Herring wrote: > It is preferred to use typed property access functions (i.e. > of_property_read_<type> 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. Applied, thanks > > Signed-off-by: Rob Herring <robh@kernel.org> > --- > drivers/phy/allwinner/phy-sun4i-usb.c | 2 +- > drivers/phy/broadcom/phy-bcm-ns-usb2.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c > index fbcd7014ab43..fc9f6fb447a0 100644 > --- a/drivers/phy/allwinner/phy-sun4i-usb.c > +++ b/drivers/phy/allwinner/phy-sun4i-usb.c > @@ -758,7 +758,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) > return PTR_ERR(data->vbus_det_gpio); > } > > - if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { > + if (of_property_present(np, "usb0_vbus_power-supply")) { > data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, > "usb0_vbus_power-supply"); > if (IS_ERR(data->vbus_power_supply)) { > diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c b/drivers/phy/broadcom/phy-bcm-ns-usb2.c > index 6a36e187d100..269564bdf687 100644 > --- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c > +++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c > @@ -107,7 +107,7 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev) > return -ENOMEM; > usb2->dev = dev; > > - if (of_find_property(dev->of_node, "brcm,syscon-clkset", NULL)) { > + if (of_property_present(dev->of_node, "brcm,syscon-clkset")) { > usb2->base = devm_platform_ioremap_resource(pdev, 0); > if (IS_ERR(usb2->base)) { > dev_err(dev, "Failed to map control reg\n"); > -- > 2.39.2
diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index fbcd7014ab43..fc9f6fb447a0 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -758,7 +758,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) return PTR_ERR(data->vbus_det_gpio); } - if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { + if (of_property_present(np, "usb0_vbus_power-supply")) { data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, "usb0_vbus_power-supply"); if (IS_ERR(data->vbus_power_supply)) { diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c b/drivers/phy/broadcom/phy-bcm-ns-usb2.c index 6a36e187d100..269564bdf687 100644 --- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c +++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c @@ -107,7 +107,7 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev) return -ENOMEM; usb2->dev = dev; - if (of_find_property(dev->of_node, "brcm,syscon-clkset", NULL)) { + if (of_property_present(dev->of_node, "brcm,syscon-clkset")) { usb2->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(usb2->base)) { dev_err(dev, "Failed to map control reg\n");