Skip to content

Commit 8c47b82

Browse files
robherringthierryreding
authored andcommitted
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. Signed-off-by: Rob Herring <robh@kernel.org> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
1 parent 60b3a99 commit 8c47b82

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/firmware/arm_scmi/optee.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ static int setup_static_shmem(struct device *dev, struct scmi_chan_info *cinfo,
403403
static int setup_shmem(struct device *dev, struct scmi_chan_info *cinfo,
404404
struct scmi_optee_channel *channel)
405405
{
406-
if (of_find_property(cinfo->dev->of_node, "shmem", NULL))
406+
if (of_property_present(cinfo->dev->of_node, "shmem"))
407407
return setup_static_shmem(dev, cinfo, channel);
408408
else
409409
return setup_dynamic_shmem(dev, channel);

drivers/firmware/tegra/bpmp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -764,19 +764,19 @@ static int tegra_bpmp_probe(struct platform_device *pdev)
764764
if (err < 0)
765765
goto free_mrq;
766766

767-
if (of_find_property(pdev->dev.of_node, "#clock-cells", NULL)) {
767+
if (of_property_present(pdev->dev.of_node, "#clock-cells")) {
768768
err = tegra_bpmp_init_clocks(bpmp);
769769
if (err < 0)
770770
goto free_mrq;
771771
}
772772

773-
if (of_find_property(pdev->dev.of_node, "#reset-cells", NULL)) {
773+
if (of_property_present(pdev->dev.of_node, "#reset-cells")) {
774774
err = tegra_bpmp_init_resets(bpmp);
775775
if (err < 0)
776776
goto free_mrq;
777777
}
778778

779-
if (of_find_property(pdev->dev.of_node, "#power-domain-cells", NULL)) {
779+
if (of_property_present(pdev->dev.of_node, "#power-domain-cells")) {
780780
err = tegra_bpmp_init_powergates(bpmp);
781781
if (err < 0)
782782
goto free_mrq;

0 commit comments

Comments
 (0)