Skip to contentSkip to conversation

firmware: Use of_property_present() for testing DT property presence

PATCH Applied Rob Herring 3 participants 6 messages Mar 10, 2023 – Apr 4, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware: Use of_property_present() for testing DT property presence

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.

---
 drivers/firmware/arm_scmi/optee.c | 2 +-
 drivers/firmware/tegra/bpmp.c     | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/firmware/arm_scmi/optee.c +1 -1
index 929720387102..e123de6e8c67 100644
@@ -403,7 +403,7 @@ static int setup_static_shmem(struct device *dev, struct scmi_chan_info *cinfo,
 static int setup_shmem(struct device *dev, struct scmi_chan_info *cinfo,
 		       struct scmi_optee_channel *channel)
 {
-	if (of_find_property(cinfo->dev->of_node, "shmem", NULL))
+	if (of_property_present(cinfo->dev->of_node, "shmem"))
 		return setup_static_shmem(dev, cinfo, channel);
 	else
 		return setup_dynamic_shmem(dev, channel);
drivers/firmware/tegra/bpmp.c +3 -3
index 042c2043929d..8b5e5daa9fae 100644
@@ -764,19 +764,19 @@ static int tegra_bpmp_probe(struct platform_device *pdev)
 	if (err < 0)
 		goto free_mrq;
 
-	if (of_find_property(pdev->dev.of_node, "#clock-cells", NULL)) {
+	if (of_property_present(pdev->dev.of_node, "#clock-cells")) {
 		err = tegra_bpmp_init_clocks(bpmp);
 		if (err < 0)
 			goto free_mrq;
 	}
 
-	if (of_find_property(pdev->dev.of_node, "#reset-cells", NULL)) {
+	if (of_property_present(pdev->dev.of_node, "#reset-cells")) {
 		err = tegra_bpmp_init_resets(bpmp);
 		if (err < 0)
 			goto free_mrq;
 	}
 
-	if (of_find_property(pdev->dev.of_node, "#power-domain-cells", NULL)) {
+	if (of_property_present(pdev->dev.of_node, "#power-domain-cells")) {
 		err = tegra_bpmp_init_powergates(bpmp);
 		if (err < 0)
 			goto free_mrq;
Signature · 1 line
2.39.2
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Rob Herring

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.

---
 drivers/firmware/arm_scmi/optee.c | 2 +-

I am assuming you will route this as it has other changes as well in the patch.

Signature · 7 lines
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw
Quoted 8 lines · Sudeep Holla
Quoted 7 lines · Rob Herring

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.

Quoted 8 lines
Quoted 3 lines
---
 drivers/firmware/arm_scmi/optee.c | 2 +-

I am assuming you will route this as it has other changes as well in the patch.

I can also pick this up along with the Tegra changes if Rob doesn't want to take it. But also feel free to take this through whatever tree works best, for the Tegra parts:

#3 lore raw
Quoted 15 lines · Thierry Reding
Quoted 14 lines · Sudeep Holla
Quoted 10 lines · Rob Herring

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.

---
 drivers/firmware/arm_scmi/optee.c | 2 +-
Quoted 8 lines
Quoted 2 lines

I am assuming you will route this as it has other changes as well in the patch.

I can also pick this up along with the Tegra changes if Rob doesn't want to take it. But also feel free to take this through whatever tree works best, for the Tegra parts:

You can take it. Thanks.

Rob

#4 lore raw
Quoted 19 lines · Rob Herring
Quoted 18 lines · Thierry Reding
Quoted 16 lines · Sudeep Holla
Quoted 10 lines · Rob Herring

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.

---
 drivers/firmware/arm_scmi/optee.c | 2 +-

I am assuming you will route this as it has other changes as well in the patch.

Quoted 7 lines
Quoted 5 lines

I can also pick this up along with the Tegra changes if Rob doesn't want to take it. But also feel free to take this through whatever tree works best, for the Tegra parts:

You can take it. Thanks.

Applied now, thanks.

Thierry

#5 lore raw
In reply to Rob Herring

From: Thierry Reding <[email protected]>

Quoted 8 lines · Rob Herring

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] firmware: Use of_property_present() for testing DT property presence

      commit: 8c47b8253f4cfd8b4dbda8c9adc1d0b1d7f3009d

Best regards,

Signature · 1 line
Thierry Reding <[email protected]>