usb: Use of_property_present() for testing DT property presence
Subsystems (5)
PATCH 1/1 usb: 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 <[email protected]>
--- drivers/usb/gadget/udc/snps_udc_plat.c | 2 +- drivers/usb/host/fsl-mph-dr-of.c | 4 ++-- drivers/usb/musb/omap2430.c | 2 +- drivers/usb/phy/phy-mxs-usb.c | 2 +- drivers/usb/phy/phy-tegra-usb.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/usb/gadget/udc/snps_udc_plat.c +1 -1
@@ -158,7 +158,7 @@ static int udc_plat_probe(struct platform_device *pdev) }/* 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 )
drivers/usb/host/fsl-mph-dr-of.c +2 -2
@@ -200,10 +200,10 @@ static int fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev) 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 ;
drivers/usb/musb/omap2430.c +1 -1
@@ -334,7 +334,7 @@ static int omap2430_probe(struct platform_device *pdev)* 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 {
drivers/usb/phy/phy-mxs-usb.c +1 -1
@@ -733,7 +733,7 @@ static int mxs_phy_probe(struct platform_device *pdev)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)) {
drivers/usb/phy/phy-tegra-usb.c +1 -1
@@ -1375,7 +1375,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev) 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 ;
Signature · 1 line
2.39.2