Commit 4d57e351 authored by Rob Herring's avatar Rob Herring Committed by Michael Ellerman
Browse files

powerpc: 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 of_property_read_bool().

Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230310144659.1541127-1-robh@kernel.org
parent 857d423c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ int __init btext_find_display(int allow_nonstdout)
		return rc;

	for_each_node_by_type(np, "display") {
		if (of_get_property(np, "linux,opened", NULL)) {
		if (of_property_read_bool(np, "linux,opened")) {
			printk("trying %pOF ...\n", np);
			rc = btext_initialize(np);
			printk("result: %d\n", rc);
+1 −1
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ static int __init add_legacy_soc_port(struct device_node *np,
		return -1;

	/* if rtas uses this device, don't try to use it as well */
	if (of_get_property(np, "used-by-rtas", NULL) != NULL)
	if (of_property_read_bool(np, "used-by-rtas"))
		return -1;

	/* Get the address */
+7 −11
Original line number Diff line number Diff line
@@ -348,7 +348,7 @@ static void __init ppc4xx_probe_pci_bridge(struct device_node *np)
	}

	/* Check if primary bridge */
	if (of_get_property(np, "primary", NULL))
	if (of_property_read_bool(np, "primary"))
		primary = 1;

	/* Get bus range if any */
@@ -530,7 +530,7 @@ static void __init ppc4xx_probe_pcix_bridge(struct device_node *np)
	struct pci_controller *hose = NULL;
	void __iomem *reg = NULL;
	const int *bus_range;
	int big_pim = 0, msi = 0, primary = 0;
	int big_pim, msi, primary;

	/* Fetch config space registers address */
	if (of_address_to_resource(np, 0, &rsrc_cfg)) {
@@ -546,16 +546,13 @@ static void __init ppc4xx_probe_pcix_bridge(struct device_node *np)
	}

	/* Check if it supports large PIMs (440GX) */
	if (of_get_property(np, "large-inbound-windows", NULL))
		big_pim = 1;
	big_pim = of_property_read_bool(np, "large-inbound-windows");

	/* Check if we should enable MSIs inbound hole */
	if (of_get_property(np, "enable-msi-hole", NULL))
		msi = 1;
	msi = of_property_read_bool(np, "enable-msi-hole");

	/* Check if primary bridge */
	if (of_get_property(np, "primary", NULL))
		primary = 1;
	primary = of_property_read_bool(np, "primary");

	/* Get bus range if any */
	bus_range = of_get_property(np, "bus-range", NULL);
@@ -1915,14 +1912,13 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port)
	struct resource dma_window;
	struct pci_controller *hose = NULL;
	const int *bus_range;
	int primary = 0, busses;
	int primary, busses;
	void __iomem *mbase = NULL, *cfg_data = NULL;
	const u32 *pval;
	u32 val;

	/* Check if primary bridge */
	if (of_get_property(port->node, "primary", NULL))
		primary = 1;
	primary = of_property_read_bool(port->node, "primary");

	/* Get bus range if any */
	bus_range = of_get_property(port->node, "bus-range", NULL);
+2 −2
Original line number Diff line number Diff line
@@ -141,8 +141,8 @@ mpc52xx_map_common_devices(void)
	 * on a gpt0, so check has-wdt property before mapping.
	 */
	for_each_matching_node(np, mpc52xx_gpt_ids) {
		if (of_get_property(np, "fsl,has-wdt", NULL) ||
		    of_get_property(np, "has-wdt", NULL)) {
		if (of_property_read_bool(np, "fsl,has-wdt") ||
		    of_property_read_bool(np, "has-wdt")) {
			mpc52xx_wdt = of_iomap(np, 0);
			of_node_put(np);
			break;
+2 −2
Original line number Diff line number Diff line
@@ -735,8 +735,8 @@ static int mpc52xx_gpt_probe(struct platform_device *ofdev)
	mutex_unlock(&mpc52xx_gpt_list_mutex);

	/* check if this device could be a watchdog */
	if (of_get_property(ofdev->dev.of_node, "fsl,has-wdt", NULL) ||
	    of_get_property(ofdev->dev.of_node, "has-wdt", NULL)) {
	if (of_property_read_bool(ofdev->dev.of_node, "fsl,has-wdt") ||
	    of_property_read_bool(ofdev->dev.of_node, "has-wdt")) {
		const u32 *on_boot_wdt;

		gpt->wdt_mode = MPC52xx_GPT_CAN_WDT;
Loading