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>
Link: https://lore.kernel.org/r/20230310144728.1545786-1-robh@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
}
/* Register for extcon if supported */
- if (of_get_property(dev->of_node, "extcon", NULL)) {
+ if (of_property_present(dev->of_node, "extcon")) {
udc->edev = extcon_get_edev_by_phandle(dev, 0);
if (IS_ERR(udc->edev)) {
if (PTR_ERR(udc->edev) == -EPROBE_DEFER)
dev_data = get_dr_mode_data(np);
if (of_device_is_compatible(np, "fsl-usb2-mph")) {
- if (of_get_property(np, "port0", NULL))
+ if (of_property_present(np, "port0"))
pdata->port_enables |= FSL_USB2_PORT0_ENABLED;
- if (of_get_property(np, "port1", NULL))
+ if (of_property_present(np, "port1"))
pdata->port_enables |= FSL_USB2_PORT1_ENABLED;
pdata->operating_mode = FSL_USB2_MPH_HOST;
* Legacy SoCs using omap_device get confused if node is moved
* because of interconnect properties mixed into the node.
*/
- if (of_get_property(np, "ti,hwmods", NULL)) {
+ if (of_property_present(np, "ti,hwmods")) {
dev_warn(&pdev->dev, "please update to probe with ti-sysc\n");
populate_irqs = true;
} else {
return -ENOMEM;
/* Some SoCs don't have anatop registers */
- if (of_get_property(np, "fsl,anatop", NULL)) {
+ if (of_property_present(np, "fsl,anatop")) {
mxs_phy->regmap_anatop = syscon_regmap_lookup_by_phandle
(np, "fsl,anatop");
if (IS_ERR(mxs_phy->regmap_anatop)) {
tegra_phy->is_legacy_phy =
of_property_read_bool(np, "nvidia,has-legacy-mode");
- if (of_find_property(np, "dr_mode", NULL))
+ if (of_property_present(np, "dr_mode"))
tegra_phy->mode = usb_get_dr_mode(&pdev->dev);
else
tegra_phy->mode = USB_DR_MODE_HOST;