mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 13:15:57 +00:00
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 <robh@kernel.org> Link: https://lore.kernel.org/r/20230310144728.1545786-1-robh@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a20bf02aaa
commit
a3927e1a9f
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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 {
|
||||
|
@ -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)) {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user