From patchwork Fri Mar 10 14:47:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13169431 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3875C6FA99 for ; Fri, 10 Mar 2023 15:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=1LQ684bFs31iuSedS6YBv629sSKaHIa0EyfvupvLdvg=; b=CdIk6J+1AJoT3p D1qqKIVPpkL3wKEXl+ygJ3hZHH4tfUAQWHWZl56K091l+BTPzdSmlNs3enKDpjW2iRgBM4sj2sF1V iSR/bYoyE9RnnUZAlLVXDHTYMr7PntNyQuek789k1wWynN1i5u5dMtVRGQyoNOQcv4ESoQvztNNsD swZ9qvtAFWg5LEBk6UwfbyoKGGHOwmU5EFLo1cHiJJTeLtcDoyHQ37EfEa7c0qPSpxaAcOX3OLC/n AqIX/z3X0A/AhknEeaJ6z1ifR31KVjddU1jfNGvUwuqMlGusE+zZEDqk65LWSBOq10DflAtPAFlzK KD1tscTB/5xLLuyUMa+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1paevz-00F3hm-4E; Fri, 10 Mar 2023 15:45:31 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1paevx-00F3hI-Mi for linux-arm-kernel@bombadil.infradead.org; Fri, 10 Mar 2023 15:45:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=tCm7q3U60/6KX9NcfTGr2pgCK75ismvU0cilf2FoiGw=; b=QxYPj2+UJsCo7XVrBWzP/9jTJm O7mKzP92tOq443Kv8ug5qPSsfEdT6vIr/z9cHBx+4bhmXBg8tozzaj9PZC4py4Z1BfoXfiO4R11gi M/XCo4QO/GUgvIS8vcA6hMOGho3Api5QJ//RYRLVDae5r7z55xNrNIm9lHqDa1pKiwegCnw+6XEEC QffUxiABT1B62p6n/QMqOCX7mAeEPvc3/y2Sp7RY9tPkuFLf2pKnHEfpBN42Nwg7h7AEvMqNU32+k zJNaB0gSGbsOJ1maOQ7R06x1+I4KrWHZF7yW31VGp8iVnpnu+ulnp9iZuk7sLSmWa8B+9Q2Ho8FgO YAMl4CzQ==; Received: from mail-oi1-f179.google.com ([209.85.167.179]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pae2i-000UZQ-03 for linux-arm-kernel@lists.infradead.org; Fri, 10 Mar 2023 14:48:28 +0000 Received: by mail-oi1-f179.google.com with SMTP id s41so4366355oiw.13 for ; Fri, 10 Mar 2023 06:48:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678459700; 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=tCm7q3U60/6KX9NcfTGr2pgCK75ismvU0cilf2FoiGw=; b=zeTe2bP/eza+yc830G8cqxPBZ/TuJc8ytsExpDJ10SXoNRZaJE+HxX5ls4zHLaqwn9 NZTkNTsHIm8J8xTsSGEL4gvJY/iu5kbYvloxnGyFGKWreD5Ai6Ht+QUFYBnQDd4Nc9hI mMssg1KeoucX+dBN87566WwMi8Ijiodkje9LiYZFFj1U3Vixwaws8rqqhm8jNu2rUV/9 6qpRdMes/+R9tB3CHWiwwvFcemn17P4VNAzUCT02EZzSp2bP58lSShzmbpz5+EHaVd++ QZFEvIGZb7xdYCWFCz5laj0SYGSxrlRyh35FtfNlh5Pz6XPyb3Mnw7YOAImCx8EV8+/Y SRqg== X-Gm-Message-State: AO0yUKXZPX4qno9jGgKysSxYr5oQRKhs41qo5NUYAK5FSVfkqHSZsSYS xRp0avAjnCuW9kxdWvUy1w== X-Google-Smtp-Source: AK7set+/P06XaRp7GkTwg3tc6gShVPdQ5zxSFTjc+shqKUaog2xzKowKu9ROn/VBl+65mw2D8Tw0Yw== X-Received: by 2002:a05:6808:86:b0:384:67e1:ca00 with SMTP id s6-20020a056808008600b0038467e1ca00mr9966724oic.48.1678459700609; Fri, 10 Mar 2023 06:48:20 -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 u26-20020a9d4d9a000000b00686a19ffef1sm92062otk.80.2023.03.10.06.48.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Mar 2023 06:48:20 -0800 (PST) Received: (nullmailer pid 1545813 invoked by uid 1000); Fri, 10 Mar 2023 14:47:28 -0000 From: Rob Herring To: Greg Kroah-Hartman , Bin Liu , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Thierry Reding , Jonathan Hunter Cc: devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org Subject: [PATCH] usb: Use of_property_present() for testing DT property presence Date: Fri, 10 Mar 2023 08:47:27 -0600 Message-Id: <20230310144728.1545786-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230310_144826_283933_18C13556 X-CRM114-Status: GOOD ( 18.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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/usb/gadget/udc/snps_udc_plat.c | 2 +- drivers/usb/host/fsl-mph-dr-of.c | 4 ++-- drivers/usb/musb/omap2430.c | 2 +- drivers/usb/phy/phy-mxs-usb.c | 2 +- drivers/usb/phy/phy-tegra-usb.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/udc/snps_udc_plat.c b/drivers/usb/gadget/udc/snps_udc_plat.c index 8bbb89c80348..0d3e705655b9 100644 --- a/drivers/usb/gadget/udc/snps_udc_plat.c +++ b/drivers/usb/gadget/udc/snps_udc_plat.c @@ -158,7 +158,7 @@ static int udc_plat_probe(struct platform_device *pdev) } /* Register for extcon if supported */ - if (of_get_property(dev->of_node, "extcon", NULL)) { + if (of_property_present(dev->of_node, "extcon")) { udc->edev = extcon_get_edev_by_phandle(dev, 0); if (IS_ERR(udc->edev)) { if (PTR_ERR(udc->edev) == -EPROBE_DEFER) diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c index 46c6a152b865..cdf71b716c2b 100644 --- a/drivers/usb/host/fsl-mph-dr-of.c +++ b/drivers/usb/host/fsl-mph-dr-of.c @@ -200,10 +200,10 @@ static int fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev) dev_data = get_dr_mode_data(np); if (of_device_is_compatible(np, "fsl-usb2-mph")) { - if (of_get_property(np, "port0", NULL)) + if (of_property_present(np, "port0")) pdata->port_enables |= FSL_USB2_PORT0_ENABLED; - if (of_get_property(np, "port1", NULL)) + if (of_property_present(np, "port1")) pdata->port_enables |= FSL_USB2_PORT1_ENABLED; pdata->operating_mode = FSL_USB2_MPH_HOST; diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 44a21ec865fb..7f305b352591 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -334,7 +334,7 @@ static int omap2430_probe(struct platform_device *pdev) * Legacy SoCs using omap_device get confused if node is moved * because of interconnect properties mixed into the node. */ - if (of_get_property(np, "ti,hwmods", NULL)) { + if (of_property_present(np, "ti,hwmods")) { dev_warn(&pdev->dev, "please update to probe with ti-sysc\n"); populate_irqs = true; } else { diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index d2836ef5d15c..0a8e3fd699ca 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -733,7 +733,7 @@ static int mxs_phy_probe(struct platform_device *pdev) return -ENOMEM; /* Some SoCs don't have anatop registers */ - if (of_get_property(np, "fsl,anatop", NULL)) { + if (of_property_present(np, "fsl,anatop")) { mxs_phy->regmap_anatop = syscon_regmap_lookup_by_phandle (np, "fsl,anatop"); if (IS_ERR(mxs_phy->regmap_anatop)) { diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c index f0240107edb1..4d207ce3ddf2 100644 --- a/drivers/usb/phy/phy-tegra-usb.c +++ b/drivers/usb/phy/phy-tegra-usb.c @@ -1375,7 +1375,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) tegra_phy->is_legacy_phy = of_property_read_bool(np, "nvidia,has-legacy-mode"); - if (of_find_property(np, "dr_mode", NULL)) + if (of_property_present(np, "dr_mode")) tegra_phy->mode = usb_get_dr_mode(&pdev->dev); else tegra_phy->mode = USB_DR_MODE_HOST;