Commit 8e9930e1 authored by Rob Herring's avatar Rob Herring Committed by Vinod Koul

phy: 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: default avatarRob Herring <robh@kernel.org>
Reviewed-by: default avatarJernej Skrabec <jernej.skrabec@gmail.com>
Link: https://lore.kernel.org/r/20230310144720.1544600-1-robh@kernel.orgSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent a01c9d19
...@@ -756,7 +756,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) ...@@ -756,7 +756,7 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
return PTR_ERR(data->vbus_det_gpio); return PTR_ERR(data->vbus_det_gpio);
} }
if (of_find_property(np, "usb0_vbus_power-supply", NULL)) { if (of_property_present(np, "usb0_vbus_power-supply")) {
data->vbus_power_supply = devm_power_supply_get_by_phandle(dev, data->vbus_power_supply = devm_power_supply_get_by_phandle(dev,
"usb0_vbus_power-supply"); "usb0_vbus_power-supply");
if (IS_ERR(data->vbus_power_supply)) { if (IS_ERR(data->vbus_power_supply)) {
......
...@@ -107,7 +107,7 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev) ...@@ -107,7 +107,7 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
usb2->dev = dev; usb2->dev = dev;
if (of_find_property(dev->of_node, "brcm,syscon-clkset", NULL)) { if (of_property_present(dev->of_node, "brcm,syscon-clkset")) {
usb2->base = devm_platform_ioremap_resource(pdev, 0); usb2->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(usb2->base)) { if (IS_ERR(usb2->base)) {
dev_err(dev, "Failed to map control reg\n"); dev_err(dev, "Failed to map control reg\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment