linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: Use (of|device)_property_present() for non-boolean properties
@ 2024-11-04 19:08 Rob Herring (Arm)
  2024-11-04 23:54 ` Thinh Nguyen
  2024-11-05  0:49 ` Peter Chen
  0 siblings, 2 replies; 3+ messages in thread
From: Rob Herring (Arm) @ 2024-11-04 19:08 UTC (permalink / raw)
  To: Peter Chen, Greg Kroah-Hartman, Thinh Nguyen, Chunfeng Yun
  Cc: linux-usb, linux-kernel, linux-omap, linux-arm-msm,
	linux-arm-kernel, linux-mediatek

The use of (of|device)_property_read_bool() for non-boolean properties
is deprecated in favor of of_property_present() when testing for
property presence.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/usb/chipidea/core.c        | 2 +-
 drivers/usb/dwc3/core.c            | 2 +-
 drivers/usb/dwc3/dwc3-omap.c       | 2 +-
 drivers/usb/dwc3/dwc3-qcom.c       | 2 +-
 drivers/usb/mtu3/mtu3_plat.c       | 2 +-
 drivers/usb/phy/phy.c              | 2 +-
 drivers/usb/renesas_usbhs/common.c | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 835bf2428dc6..18ecfcc08b97 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -765,7 +765,7 @@ static int ci_get_platdata(struct device *dev,
 
 	ext_id = ERR_PTR(-ENODEV);
 	ext_vbus = ERR_PTR(-ENODEV);
-	if (of_property_read_bool(dev->of_node, "extcon")) {
+	if (of_property_present(dev->of_node, "extcon")) {
 		/* Each one of them is not mandatory */
 		ext_vbus = extcon_get_edev_by_phandle(dev, 0);
 		if (IS_ERR(ext_vbus) && PTR_ERR(ext_vbus) != -ENODEV)
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 9eb085f359ce..e1beb760e913 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1935,7 +1935,7 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
 	struct extcon_dev *edev = NULL;
 	const char *name;
 
-	if (device_property_read_bool(dev, "extcon"))
+	if (device_property_present(dev, "extcon"))
 		return extcon_get_edev_by_phandle(dev, 0);
 
 	/*
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 2a11fc0ee84f..c2d7582c151a 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -416,7 +416,7 @@ static int dwc3_omap_extcon_register(struct dwc3_omap *omap)
 	struct device_node	*node = omap->dev->of_node;
 	struct extcon_dev	*edev;
 
-	if (of_property_read_bool(node, "extcon")) {
+	if (of_property_present(node, "extcon")) {
 		edev = extcon_get_edev_by_phandle(omap->dev, 0);
 		if (IS_ERR(edev)) {
 			dev_vdbg(omap->dev, "couldn't get extcon device\n");
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index c1d4b52f25b0..649166e2a8b8 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -161,7 +161,7 @@ static int dwc3_qcom_register_extcon(struct dwc3_qcom *qcom)
 	struct extcon_dev	*host_edev;
 	int			ret;
 
-	if (!of_property_read_bool(dev->of_node, "extcon"))
+	if (!of_property_present(dev->of_node, "extcon"))
 		return 0;
 
 	qcom->edev = extcon_get_edev_by_phandle(dev, 0);
diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index 6858ed9fc3b2..2380552025e4 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -307,7 +307,7 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
 	if (otg_sx->role_sw_used || otg_sx->manual_drd_enabled)
 		goto out;
 
-	if (of_property_read_bool(node, "extcon")) {
+	if (of_property_present(node, "extcon")) {
 		otg_sx->edev = extcon_get_edev_by_phandle(ssusb->dev, 0);
 		if (IS_ERR(otg_sx->edev)) {
 			return dev_err_probe(dev, PTR_ERR(otg_sx->edev),
diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
index 06e0fb23566c..130f86a043ad 100644
--- a/drivers/usb/phy/phy.c
+++ b/drivers/usb/phy/phy.c
@@ -365,7 +365,7 @@ static int usb_add_extcon(struct usb_phy *x)
 {
 	int ret;
 
-	if (of_property_read_bool(x->dev->of_node, "extcon")) {
+	if (of_property_present(x->dev->of_node, "extcon")) {
 		x->edev = extcon_get_edev_by_phandle(x->dev, 0);
 		if (IS_ERR(x->edev))
 			return PTR_ERR(x->edev);
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index edc43f169d49..e4adfe692164 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -632,7 +632,7 @@ static int usbhs_probe(struct platform_device *pdev)
 	if (IS_ERR(priv->base))
 		return PTR_ERR(priv->base);
 
-	if (of_property_read_bool(dev_of_node(dev), "extcon")) {
+	if (of_property_present(dev_of_node(dev), "extcon")) {
 		priv->edev = extcon_get_edev_by_phandle(dev, 0);
 		if (IS_ERR(priv->edev))
 			return PTR_ERR(priv->edev);
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: Use (of|device)_property_present() for non-boolean properties
  2024-11-04 19:08 [PATCH] usb: Use (of|device)_property_present() for non-boolean properties Rob Herring (Arm)
@ 2024-11-04 23:54 ` Thinh Nguyen
  2024-11-05  0:49 ` Peter Chen
  1 sibling, 0 replies; 3+ messages in thread
From: Thinh Nguyen @ 2024-11-04 23:54 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Peter Chen, Greg Kroah-Hartman, Thinh Nguyen, Chunfeng Yun,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org

On Mon, Nov 04, 2024, Rob Herring (Arm) wrote:
> The use of (of|device)_property_read_bool() for non-boolean properties
> is deprecated in favor of of_property_present() when testing for
> property presence.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
>  drivers/usb/chipidea/core.c        | 2 +-
>  drivers/usb/dwc3/core.c            | 2 +-
>  drivers/usb/dwc3/dwc3-omap.c       | 2 +-
>  drivers/usb/dwc3/dwc3-qcom.c       | 2 +-
>  drivers/usb/mtu3/mtu3_plat.c       | 2 +-
>  drivers/usb/phy/phy.c              | 2 +-
>  drivers/usb/renesas_usbhs/common.c | 2 +-
>  7 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 835bf2428dc6..18ecfcc08b97 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -765,7 +765,7 @@ static int ci_get_platdata(struct device *dev,
>  
>  	ext_id = ERR_PTR(-ENODEV);
>  	ext_vbus = ERR_PTR(-ENODEV);
> -	if (of_property_read_bool(dev->of_node, "extcon")) {
> +	if (of_property_present(dev->of_node, "extcon")) {
>  		/* Each one of them is not mandatory */
>  		ext_vbus = extcon_get_edev_by_phandle(dev, 0);
>  		if (IS_ERR(ext_vbus) && PTR_ERR(ext_vbus) != -ENODEV)
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 9eb085f359ce..e1beb760e913 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1935,7 +1935,7 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
>  	struct extcon_dev *edev = NULL;
>  	const char *name;
>  
> -	if (device_property_read_bool(dev, "extcon"))
> +	if (device_property_present(dev, "extcon"))
>  		return extcon_get_edev_by_phandle(dev, 0);
>  
>  	/*
> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
> index 2a11fc0ee84f..c2d7582c151a 100644
> --- a/drivers/usb/dwc3/dwc3-omap.c
> +++ b/drivers/usb/dwc3/dwc3-omap.c
> @@ -416,7 +416,7 @@ static int dwc3_omap_extcon_register(struct dwc3_omap *omap)
>  	struct device_node	*node = omap->dev->of_node;
>  	struct extcon_dev	*edev;
>  
> -	if (of_property_read_bool(node, "extcon")) {
> +	if (of_property_present(node, "extcon")) {
>  		edev = extcon_get_edev_by_phandle(omap->dev, 0);
>  		if (IS_ERR(edev)) {
>  			dev_vdbg(omap->dev, "couldn't get extcon device\n");
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index c1d4b52f25b0..649166e2a8b8 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -161,7 +161,7 @@ static int dwc3_qcom_register_extcon(struct dwc3_qcom *qcom)
>  	struct extcon_dev	*host_edev;
>  	int			ret;
>  
> -	if (!of_property_read_bool(dev->of_node, "extcon"))
> +	if (!of_property_present(dev->of_node, "extcon"))
>  		return 0;
>  
>  	qcom->edev = extcon_get_edev_by_phandle(dev, 0);
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index 6858ed9fc3b2..2380552025e4 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -307,7 +307,7 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
>  	if (otg_sx->role_sw_used || otg_sx->manual_drd_enabled)
>  		goto out;
>  
> -	if (of_property_read_bool(node, "extcon")) {
> +	if (of_property_present(node, "extcon")) {
>  		otg_sx->edev = extcon_get_edev_by_phandle(ssusb->dev, 0);
>  		if (IS_ERR(otg_sx->edev)) {
>  			return dev_err_probe(dev, PTR_ERR(otg_sx->edev),
> diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
> index 06e0fb23566c..130f86a043ad 100644
> --- a/drivers/usb/phy/phy.c
> +++ b/drivers/usb/phy/phy.c
> @@ -365,7 +365,7 @@ static int usb_add_extcon(struct usb_phy *x)
>  {
>  	int ret;
>  
> -	if (of_property_read_bool(x->dev->of_node, "extcon")) {
> +	if (of_property_present(x->dev->of_node, "extcon")) {
>  		x->edev = extcon_get_edev_by_phandle(x->dev, 0);
>  		if (IS_ERR(x->edev))
>  			return PTR_ERR(x->edev);
> diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
> index edc43f169d49..e4adfe692164 100644
> --- a/drivers/usb/renesas_usbhs/common.c
> +++ b/drivers/usb/renesas_usbhs/common.c
> @@ -632,7 +632,7 @@ static int usbhs_probe(struct platform_device *pdev)
>  	if (IS_ERR(priv->base))
>  		return PTR_ERR(priv->base);
>  
> -	if (of_property_read_bool(dev_of_node(dev), "extcon")) {
> +	if (of_property_present(dev_of_node(dev), "extcon")) {
>  		priv->edev = extcon_get_edev_by_phandle(dev, 0);
>  		if (IS_ERR(priv->edev))
>  			return PTR_ERR(priv->edev);
> -- 
> 2.45.2
> 

For dwc3 related changes:

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

Thanks,
Thinh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: Use (of|device)_property_present() for non-boolean properties
  2024-11-04 19:08 [PATCH] usb: Use (of|device)_property_present() for non-boolean properties Rob Herring (Arm)
  2024-11-04 23:54 ` Thinh Nguyen
@ 2024-11-05  0:49 ` Peter Chen
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Chen @ 2024-11-05  0:49 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Greg Kroah-Hartman, Thinh Nguyen, Chunfeng Yun, linux-usb,
	linux-kernel, linux-omap, linux-arm-msm, linux-arm-kernel,
	linux-mediatek

On 24-11-04 13:08:18, Rob Herring (Arm) wrote:
> The use of (of|device)_property_read_bool() for non-boolean properties
> is deprecated in favor of of_property_present() when testing for
> property presence.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---
>  drivers/usb/chipidea/core.c        | 2 +-
>  drivers/usb/dwc3/core.c            | 2 +-
>  drivers/usb/dwc3/dwc3-omap.c       | 2 +-
>  drivers/usb/dwc3/dwc3-qcom.c       | 2 +-
>  drivers/usb/mtu3/mtu3_plat.c       | 2 +-
>  drivers/usb/phy/phy.c              | 2 +-
>  drivers/usb/renesas_usbhs/common.c | 2 +-
>  7 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 835bf2428dc6..18ecfcc08b97 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -765,7 +765,7 @@ static int ci_get_platdata(struct device *dev,
>  
>  	ext_id = ERR_PTR(-ENODEV);
>  	ext_vbus = ERR_PTR(-ENODEV);
> -	if (of_property_read_bool(dev->of_node, "extcon")) {
> +	if (of_property_present(dev->of_node, "extcon")) {
>  		/* Each one of them is not mandatory */
>  		ext_vbus = extcon_get_edev_by_phandle(dev, 0);
>  		if (IS_ERR(ext_vbus) && PTR_ERR(ext_vbus) != -ENODEV)
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 9eb085f359ce..e1beb760e913 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -1935,7 +1935,7 @@ static struct extcon_dev *dwc3_get_extcon(struct dwc3 *dwc)
>  	struct extcon_dev *edev = NULL;
>  	const char *name;
>  
> -	if (device_property_read_bool(dev, "extcon"))
> +	if (device_property_present(dev, "extcon"))
>  		return extcon_get_edev_by_phandle(dev, 0);
>  
>  	/*
> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
> index 2a11fc0ee84f..c2d7582c151a 100644
> --- a/drivers/usb/dwc3/dwc3-omap.c
> +++ b/drivers/usb/dwc3/dwc3-omap.c
> @@ -416,7 +416,7 @@ static int dwc3_omap_extcon_register(struct dwc3_omap *omap)
>  	struct device_node	*node = omap->dev->of_node;
>  	struct extcon_dev	*edev;
>  
> -	if (of_property_read_bool(node, "extcon")) {
> +	if (of_property_present(node, "extcon")) {
>  		edev = extcon_get_edev_by_phandle(omap->dev, 0);
>  		if (IS_ERR(edev)) {
>  			dev_vdbg(omap->dev, "couldn't get extcon device\n");
> diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
> index c1d4b52f25b0..649166e2a8b8 100644
> --- a/drivers/usb/dwc3/dwc3-qcom.c
> +++ b/drivers/usb/dwc3/dwc3-qcom.c
> @@ -161,7 +161,7 @@ static int dwc3_qcom_register_extcon(struct dwc3_qcom *qcom)
>  	struct extcon_dev	*host_edev;
>  	int			ret;
>  
> -	if (!of_property_read_bool(dev->of_node, "extcon"))
> +	if (!of_property_present(dev->of_node, "extcon"))
>  		return 0;
>  
>  	qcom->edev = extcon_get_edev_by_phandle(dev, 0);
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index 6858ed9fc3b2..2380552025e4 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -307,7 +307,7 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
>  	if (otg_sx->role_sw_used || otg_sx->manual_drd_enabled)
>  		goto out;
>  
> -	if (of_property_read_bool(node, "extcon")) {
> +	if (of_property_present(node, "extcon")) {
>  		otg_sx->edev = extcon_get_edev_by_phandle(ssusb->dev, 0);
>  		if (IS_ERR(otg_sx->edev)) {
>  			return dev_err_probe(dev, PTR_ERR(otg_sx->edev),
> diff --git a/drivers/usb/phy/phy.c b/drivers/usb/phy/phy.c
> index 06e0fb23566c..130f86a043ad 100644
> --- a/drivers/usb/phy/phy.c
> +++ b/drivers/usb/phy/phy.c
> @@ -365,7 +365,7 @@ static int usb_add_extcon(struct usb_phy *x)
>  {
>  	int ret;
>  
> -	if (of_property_read_bool(x->dev->of_node, "extcon")) {
> +	if (of_property_present(x->dev->of_node, "extcon")) {
>  		x->edev = extcon_get_edev_by_phandle(x->dev, 0);
>  		if (IS_ERR(x->edev))
>  			return PTR_ERR(x->edev);
> diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
> index edc43f169d49..e4adfe692164 100644
> --- a/drivers/usb/renesas_usbhs/common.c
> +++ b/drivers/usb/renesas_usbhs/common.c
> @@ -632,7 +632,7 @@ static int usbhs_probe(struct platform_device *pdev)
>  	if (IS_ERR(priv->base))
>  		return PTR_ERR(priv->base);
>  
> -	if (of_property_read_bool(dev_of_node(dev), "extcon")) {
> +	if (of_property_present(dev_of_node(dev), "extcon")) {
>  		priv->edev = extcon_get_edev_by_phandle(dev, 0);
>  		if (IS_ERR(priv->edev))
>  			return PTR_ERR(priv->edev);
> -- 
> 2.45.2
> 

For chipidea part:

Acked-by: Peter Chen <peter.chen@kernel.org>

Peter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-05  0:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 19:08 [PATCH] usb: Use (of|device)_property_present() for non-boolean properties Rob Herring (Arm)
2024-11-04 23:54 ` Thinh Nguyen
2024-11-05  0:49 ` Peter Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).