linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: qcom: Use of_property_present() for testing DT property presence
@ 2023-03-10 14:47 Rob Herring
  2023-03-11 12:44 ` Konrad Dybcio
  2023-03-15 23:35 ` Bjorn Andersson
  0 siblings, 2 replies; 3+ messages in thread
From: Rob Herring @ 2023-03-10 14:47 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio
  Cc: devicetree, linux-arm-msm, linux-kernel

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/soc/qcom/qcom_aoss.c | 2 +-
 drivers/soc/qcom/smem.c      | 2 +-
 drivers/soc/qcom/smsm.c      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
index 18c856056475..e376c32cc16e 100644
--- a/drivers/soc/qcom/qcom_aoss.c
+++ b/drivers/soc/qcom/qcom_aoss.c
@@ -395,7 +395,7 @@ static int qmp_cooling_devices_register(struct qmp *qmp)
 		return -ENOMEM;
 
 	for_each_available_child_of_node(np, child) {
-		if (!of_find_property(child, "#cooling-cells", NULL))
+		if (!of_property_present(child, "#cooling-cells"))
 			continue;
 		ret = qmp_cooling_device_add(qmp, &qmp->cooling_devs[count++],
 					     child);
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index 4f163d62942c..25f5925a8d51 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -1045,7 +1045,7 @@ static int qcom_smem_probe(struct platform_device *pdev)
 	int i;
 
 	num_regions = 1;
-	if (of_find_property(pdev->dev.of_node, "qcom,rpm-msg-ram", NULL))
+	if (of_property_present(pdev->dev.of_node, "qcom,rpm-msg-ram"))
 		num_regions++;
 
 	array_size = num_regions * sizeof(struct smem_region);
diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
index 3e8994d6110e..8c137dff7dac 100644
--- a/drivers/soc/qcom/smsm.c
+++ b/drivers/soc/qcom/smsm.c
@@ -510,7 +510,7 @@ static int qcom_smsm_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	for_each_child_of_node(pdev->dev.of_node, local_node) {
-		if (of_find_property(local_node, "#qcom,smem-state-cells", NULL))
+		if (of_property_present(local_node, "#qcom,smem-state-cells"))
 			break;
 	}
 	if (!local_node) {
-- 
2.39.2


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

* Re: [PATCH] soc: qcom: Use of_property_present() for testing DT property presence
  2023-03-10 14:47 [PATCH] soc: qcom: Use of_property_present() for testing DT property presence Rob Herring
@ 2023-03-11 12:44 ` Konrad Dybcio
  2023-03-15 23:35 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Konrad Dybcio @ 2023-03-11 12:44 UTC (permalink / raw)
  To: Rob Herring, Andy Gross, Bjorn Andersson
  Cc: devicetree, linux-arm-msm, linux-kernel



On 10.03.2023 15: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.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
>  drivers/soc/qcom/qcom_aoss.c | 2 +-
>  drivers/soc/qcom/smem.c      | 2 +-
>  drivers/soc/qcom/smsm.c      | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c
> index 18c856056475..e376c32cc16e 100644
> --- a/drivers/soc/qcom/qcom_aoss.c
> +++ b/drivers/soc/qcom/qcom_aoss.c
> @@ -395,7 +395,7 @@ static int qmp_cooling_devices_register(struct qmp *qmp)
>  		return -ENOMEM;
>  
>  	for_each_available_child_of_node(np, child) {
> -		if (!of_find_property(child, "#cooling-cells", NULL))
> +		if (!of_property_present(child, "#cooling-cells"))
>  			continue;
>  		ret = qmp_cooling_device_add(qmp, &qmp->cooling_devs[count++],
>  					     child);
> diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
> index 4f163d62942c..25f5925a8d51 100644
> --- a/drivers/soc/qcom/smem.c
> +++ b/drivers/soc/qcom/smem.c
> @@ -1045,7 +1045,7 @@ static int qcom_smem_probe(struct platform_device *pdev)
>  	int i;
>  
>  	num_regions = 1;
> -	if (of_find_property(pdev->dev.of_node, "qcom,rpm-msg-ram", NULL))
> +	if (of_property_present(pdev->dev.of_node, "qcom,rpm-msg-ram"))
>  		num_regions++;
>  
>  	array_size = num_regions * sizeof(struct smem_region);
> diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
> index 3e8994d6110e..8c137dff7dac 100644
> --- a/drivers/soc/qcom/smsm.c
> +++ b/drivers/soc/qcom/smsm.c
> @@ -510,7 +510,7 @@ static int qcom_smsm_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	for_each_child_of_node(pdev->dev.of_node, local_node) {
> -		if (of_find_property(local_node, "#qcom,smem-state-cells", NULL))
> +		if (of_property_present(local_node, "#qcom,smem-state-cells"))
>  			break;
>  	}
>  	if (!local_node) {

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

* Re: [PATCH] soc: qcom: Use of_property_present() for testing DT property presence
  2023-03-10 14:47 [PATCH] soc: qcom: Use of_property_present() for testing DT property presence Rob Herring
  2023-03-11 12:44 ` Konrad Dybcio
@ 2023-03-15 23:35 ` Bjorn Andersson
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2023-03-15 23:35 UTC (permalink / raw)
  To: Rob Herring, Konrad Dybcio, Andy Gross
  Cc: devicetree, linux-arm-msm, linux-kernel

On Fri, 10 Mar 2023 08:47:24 -0600, 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!

[1/1] soc: qcom: Use of_property_present() for testing DT property presence
      commit: 4a1b9f4eb122f3e36fdfe62dce96091d3e45132f

Best regards,
-- 
Bjorn Andersson <andersson@kernel.org>

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

end of thread, other threads:[~2023-03-15 23:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 14:47 [PATCH] soc: qcom: Use of_property_present() for testing DT property presence Rob Herring
2023-03-11 12:44 ` Konrad Dybcio
2023-03-15 23:35 ` Bjorn Andersson

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).