Commit f977caea authored by Rob Herring's avatar Rob Herring Committed by Greg Kroah-Hartman
Browse files

usb: Use of_property_read_bool() for boolean properties



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.
Convert reading boolean properties to to of_property_read_bool().

Signed-off-by: default avatarRob Herring <robh@kernel.org>
Reviewed-by: default avatarRichard Leitner <richard.leitner@skidata.com>
Link: https://lore.kernel.org/r/20230310144729.1545857-1-robh@kernel.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent a3927e1a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -152,12 +152,12 @@ static struct imx_usbmisc_data *usbmisc_get_init_data(struct device *dev)
	 * Check the various over current related properties. If over current
	 * detection is disabled we're not interested in the polarity.
	 */
	if (of_find_property(np, "disable-over-current", NULL)) {
	if (of_property_read_bool(np, "disable-over-current")) {
		data->disable_oc = 1;
	} else if (of_find_property(np, "over-current-active-high", NULL)) {
	} else if (of_property_read_bool(np, "over-current-active-high")) {
		data->oc_pol_active_low = 0;
		data->oc_pol_configured = 1;
	} else if (of_find_property(np, "over-current-active-low", NULL)) {
	} else if (of_property_read_bool(np, "over-current-active-low")) {
		data->oc_pol_active_low = 1;
		data->oc_pol_configured = 1;
	} else {
+1 −1
Original line number Diff line number Diff line
@@ -753,7 +753,7 @@ static int ci_get_platdata(struct device *dev,
		return ret;
	}

	if (of_find_property(dev->of_node, "non-zero-ttctrl-ttha", NULL))
	if (of_property_read_bool(dev->of_node, "non-zero-ttctrl-ttha"))
		platdata->flags |= CI_HDRC_SET_NON_ZERO_TTHA;

	ext_id = ERR_PTR(-ENODEV);
+1 −2
Original line number Diff line number Diff line
@@ -508,8 +508,7 @@ static void dwc2_get_device_properties(struct dwc2_hsotg *hsotg)
		of_usb_update_otg_caps(hsotg->dev->of_node, &p->otg_caps);
	}

	if (of_find_property(hsotg->dev->of_node, "disable-over-current", NULL))
		p->oc_disable = true;
	p->oc_disable = of_property_read_bool(hsotg->dev->of_node, "disable-over-current");
}

static void dwc2_check_param_otg_cap(struct dwc2_hsotg *hsotg)
+3 −3
Original line number Diff line number Diff line
@@ -151,13 +151,13 @@ static int ehci_hcd_ppc_of_probe(struct platform_device *op)
		of_node_put(np);
	}

	if (of_get_property(dn, "big-endian", NULL)) {
	if (of_property_read_bool(dn, "big-endian")) {
		ehci->big_endian_mmio = 1;
		ehci->big_endian_desc = 1;
	}
	if (of_get_property(dn, "big-endian-regs", NULL))
	if (of_property_read_bool(dn, "big-endian-regs"))
		ehci->big_endian_mmio = 1;
	if (of_get_property(dn, "big-endian-desc", NULL))
	if (of_property_read_bool(dn, "big-endian-desc"))
		ehci->big_endian_desc = 1;

	ehci->caps = hcd->regs;
+2 −5
Original line number Diff line number Diff line
@@ -208,11 +208,8 @@ static int fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev)

		pdata->operating_mode = FSL_USB2_MPH_HOST;
	} else {
		if (of_get_property(np, "fsl,invert-drvvbus", NULL))
			pdata->invert_drvvbus = 1;

		if (of_get_property(np, "fsl,invert-pwr-fault", NULL))
			pdata->invert_pwr_fault = 1;
		pdata->invert_drvvbus = of_property_read_bool(np, "fsl,invert-drvvbus");
		pdata->invert_pwr_fault = of_property_read_bool(np, "fsl,invert-pwr-fault");

		/* setup mode selected in the device tree */
		pdata->operating_mode = dev_data->op_mode;
Loading