dm: core: Access device ofnode through functions

At present ofnode is present in the device even if it is never used. With
of-platdata this field is not used, so can be removed. In preparation for
this, change the access to go through inline functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/ata/mtk_ahci.c b/drivers/ata/mtk_ahci.c
index cd28e0c..46b7677 100644
--- a/drivers/ata/mtk_ahci.c
+++ b/drivers/ata/mtk_ahci.c
@@ -68,7 +68,8 @@
 				   SYS_CFG_SATA_MSK, SYS_CFG_SATA_EN);
 	}
 
-	ofnode_read_u32(dev->node, "ports-implemented", &hpriv->port_map);
+	ofnode_read_u32(dev_ofnode(dev), "ports-implemented",
+			&hpriv->port_map);
 	return 0;
 }
 
diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c
index 8206857..d6da59d 100644
--- a/drivers/clk/meson/axg.c
+++ b/drivers/clk/meson/axg.c
@@ -289,7 +289,7 @@
 {
 	struct meson_clk *priv = dev_get_priv(dev);
 
-	priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
+	priv->map = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev)));
 	if (IS_ERR(priv->map))
 		return PTR_ERR(priv->map);
 
diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c
index 01b22ab..5058db1 100644
--- a/drivers/clk/meson/g12a.c
+++ b/drivers/clk/meson/g12a.c
@@ -979,7 +979,7 @@
 {
 	struct meson_clk *priv = dev_get_priv(dev);
 
-	priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
+	priv->map = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev)));
 	if (IS_ERR(priv->map))
 		return PTR_ERR(priv->map);
 
diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
index 2a20541..e379540 100644
--- a/drivers/clk/meson/gxbb.c
+++ b/drivers/clk/meson/gxbb.c
@@ -885,7 +885,7 @@
 {
 	struct meson_clk *priv = dev_get_priv(dev);
 
-	priv->map = syscon_node_to_regmap(dev_get_parent(dev)->node);
+	priv->map = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev)));
 	if (IS_ERR(priv->map))
 		return PTR_ERR(priv->map);
 
diff --git a/drivers/core/device.c b/drivers/core/device.c
index bd4ecc9..6a9bee0 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -68,7 +68,7 @@
 	dev_set_plat(dev, plat);
 	dev->driver_data = driver_data;
 	dev->name = name;
-	dev->node = node;
+	dev_set_ofnode(dev, node);
 	dev->parent = parent;
 	dev->driver = drv;
 	dev->uclass = uc;
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 9ef2429..fe73594 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -148,7 +148,7 @@
 	if (ret)
 		return ret;
 	if (CONFIG_IS_ENABLED(OF_CONTROL))
-		DM_ROOT_NON_CONST->node = ofnode_root();
+		dev_set_ofnode(DM_ROOT_NON_CONST, ofnode_root());
 	ret = device_probe(DM_ROOT_NON_CONST);
 	if (ret)
 		return ret;
diff --git a/drivers/gpio/mpc8xxx_gpio.c b/drivers/gpio/mpc8xxx_gpio.c
index 2bc1a0d..a964347 100644
--- a/drivers/gpio/mpc8xxx_gpio.c
+++ b/drivers/gpio/mpc8xxx_gpio.c
@@ -191,7 +191,7 @@
 	u32 i;
 	u32 reg[4];
 
-	if (ofnode_read_bool(dev->node, "little-endian"))
+	if (ofnode_read_bool(dev_ofnode(dev), "little-endian"))
 		data->little_endian = true;
 
 	if (data->little_endian)
@@ -257,7 +257,7 @@
 	if (!str)
 		return -ENOMEM;
 
-	if (ofnode_device_is_compatible(dev->node, "fsl,qoriq-gpio")) {
+	if (ofnode_device_is_compatible(dev_ofnode(dev), "fsl,qoriq-gpio")) {
 		unsigned long gpibe = data->addr + sizeof(struct ccsr_gpio)
 			- sizeof(u32);
 
diff --git a/drivers/gpio/octeon_gpio.c b/drivers/gpio/octeon_gpio.c
index 958516d..42eae79 100644
--- a/drivers/gpio/octeon_gpio.c
+++ b/drivers/gpio/octeon_gpio.c
@@ -190,7 +190,7 @@
 			GPIO_CONST_GPIOS_MASK;
 	} else {
 		priv->base = dev_remap_addr(dev);
-		uc_priv->gpio_count = ofnode_read_u32_default(dev->node,
+		uc_priv->gpio_count = ofnode_read_u32_default(dev_ofnode(dev),
 							      "nr-gpios", 32);
 	}
 
diff --git a/drivers/misc/swap_case.c b/drivers/misc/swap_case.c
index abea0e7..3cbc8f3 100644
--- a/drivers/misc/swap_case.c
+++ b/drivers/misc/swap_case.c
@@ -54,7 +54,7 @@
 
 static int sandbox_swap_case_use_ea(const struct udevice *dev)
 {
-	return !!ofnode_get_property(dev->node, "use-ea", NULL);
+	return !!ofnode_get_property(dev_ofnode(dev), "use-ea", NULL);
 }
 
 /* Please keep these macros in sync with ea_regs below */
diff --git a/drivers/mmc/octeontx_hsmmc.c b/drivers/mmc/octeontx_hsmmc.c
index f3da6af..442ca49 100644
--- a/drivers/mmc/octeontx_hsmmc.c
+++ b/drivers/mmc/octeontx_hsmmc.c
@@ -3439,7 +3439,7 @@
  */
 static bool octeontx_mmc_get_valid(struct udevice *dev)
 {
-	const char *stat = ofnode_read_string(dev->node, "status");
+	const char *stat = ofnode_read_string(dev_ofnode(dev), "status");
 
 	if (!stat || !strncmp(stat, "ok", 2))
 		return true;
@@ -3461,14 +3461,15 @@
 	uint low, high;
 	char env_name[32];
 	int err;
-	ofnode node = dev->node;
+	ofnode node = dev_ofnode(dev);
 	int bus_width = 1;
 	ulong new_max_freq;
 
 	debug("%s(%s)", __func__, dev->name);
 	slot->cfg.name = dev->name;
 
-	slot->cfg.f_max = ofnode_read_s32_default(dev->node, "max-frequency",
+	slot->cfg.f_max = ofnode_read_s32_default(dev_ofnode(dev),
+						  "max-frequency",
 						  26000000);
 	snprintf(env_name, sizeof(env_name), "mmc_max_frequency%d",
 		 slot->bus_id);
@@ -3486,25 +3487,26 @@
 
 	if (IS_ENABLED(CONFIG_ARCH_OCTEONTX2)) {
 		slot->hs400_tuning_block =
-			ofnode_read_s32_default(dev->node,
+			ofnode_read_s32_default(dev_ofnode(dev),
 						"marvell,hs400-tuning-block",
 						-1);
 		debug("%s(%s): mmc HS400 tuning block: %d\n", __func__,
 		      dev->name, slot->hs400_tuning_block);
 
 		slot->hs200_tap_adj =
-			ofnode_read_s32_default(dev->node,
+			ofnode_read_s32_default(dev_ofnode(dev),
 						"marvell,hs200-tap-adjust", 0);
 		debug("%s(%s): hs200-tap-adjust: %d\n", __func__, dev->name,
 		      slot->hs200_tap_adj);
 		slot->hs400_tap_adj =
-			ofnode_read_s32_default(dev->node,
+			ofnode_read_s32_default(dev_ofnode(dev),
 						"marvell,hs400-tap-adjust", 0);
 		debug("%s(%s): hs400-tap-adjust: %d\n", __func__, dev->name,
 		      slot->hs400_tap_adj);
 	}
 
-	err = ofnode_read_u32_array(dev->node, "voltage-ranges", voltages, 2);
+	err = ofnode_read_u32_array(dev_ofnode(dev), "voltage-ranges",
+				    voltages, 2);
 	if (err) {
 		slot->cfg.voltages = MMC_VDD_32_33 | MMC_VDD_33_34;
 	} else {
@@ -3756,14 +3758,15 @@
 		pr_err("%s: No device tree information found\n", __func__);
 		return -1;
 	}
-	host->node = dev->node;
+	host->node = dev_ofnode(dev);
 	host->last_slotid = -1;
 	if (otx_is_platform(PLATFORM_ASIM))
 		host->is_asim = true;
 	if (otx_is_platform(PLATFORM_EMULATOR))
 		host->is_emul = true;
 	host->dma_wait_delay =
-		ofnode_read_u32_default(dev->node, "marvell,dma-wait-delay", 1);
+		ofnode_read_u32_default(dev_ofnode(dev),
+					"marvell,dma-wait-delay", 1);
 	/* Force reset of eMMC */
 	writeq(0, host->base_addr + MIO_EMM_CFG());
 	debug("%s: Clearing MIO_EMM_CFG\n", __func__);
@@ -3824,7 +3827,7 @@
 	struct octeontx_mmc_host *host = dev_get_priv(dev_get_parent(dev));
 	struct octeontx_mmc_slot *slot;
 	struct mmc_uclass_priv *upriv;
-	ofnode node = dev->node;
+	ofnode node = dev_ofnode(dev);
 	u32 bus_id;
 	char name[16];
 	int err;
diff --git a/drivers/mtd/nand/raw/octeontx_nand.c b/drivers/mtd/nand/raw/octeontx_nand.c
index 96a5fe6..64433cf 100644
--- a/drivers/mtd/nand/raw/octeontx_nand.c
+++ b/drivers/mtd/nand/raw/octeontx_nand.c
@@ -1999,7 +1999,7 @@
 static int octeontx_nfc_chips_init(struct octeontx_nfc *tn)
 {
 	struct udevice *dev = tn->dev;
-	ofnode node = dev->node;
+	ofnode node = dev_ofnode(dev);
 	ofnode nand_node;
 	int nr_chips = of_get_child_count(node);
 	int ret;
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index ab9a24e..cd12376 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -1173,7 +1173,7 @@
 		return -ENOMEM;
 	sprintf(mtd->name, "spi-nand%d", spi_nand_idx++);
 	spinand->slave = slave;
-	spinand_set_ofnode(spinand, dev->node);
+	spinand_set_ofnode(spinand, dev_ofnode(dev));
 #endif
 
 	ret = spinand_init(spinand);
diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index a10f87e..0e89e66 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -957,7 +957,7 @@
 {
 	const char *if_str;
 
-	if_str = ofnode_read_string(dev->node, "phy-connection-type");
+	if_str = ofnode_read_string(dev_ofnode(dev), "phy-connection-type");
 	debug("MAC system interface mode %s\n", if_str);
 
 	return phy_get_interface_by_name(if_str);
@@ -969,7 +969,7 @@
 	char mac_name[11];
 	u32 fm, num;
 
-	if (ofnode_read_u32(ofnode_get_parent(dev->node), "cell-index", &fm)) {
+	if (ofnode_read_u32(ofnode_get_parent(dev_ofnode(dev)), "cell-index", &fm)) {
 		printf("FMan node property cell-index missing\n");
 		return -EINVAL;
 	}
diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c
index 2e684e5..f6fc780 100644
--- a/drivers/net/fsl_enetc.c
+++ b/drivers/net/fsl_enetc.c
@@ -99,7 +99,7 @@
 	 * and some are not, use different naming scheme - enetc-N based on
 	 * PCI function # and enetc#N based on interface count
 	 */
-	if (ofnode_valid(dev->node))
+	if (ofnode_valid(dev_ofnode(dev)))
 		sprintf(name, "enetc-%u", PCI_FUNC(pci_get_devfn(dev)));
 	else
 		sprintf(name, "enetc#%u", eth_num_devices++);
@@ -253,12 +253,12 @@
 			mdio_register(&priv->imdio);
 	}
 
-	if (!ofnode_valid(dev->node)) {
+	if (!ofnode_valid(dev_ofnode(dev))) {
 		enetc_dbg(dev, "no enetc ofnode found, skipping PCS set-up\n");
 		return;
 	}
 
-	if_str = ofnode_read_string(dev->node, "phy-mode");
+	if_str = ofnode_read_string(dev_ofnode(dev), "phy-mode");
 	if (if_str)
 		priv->if_type = phy_get_interface_by_name(if_str);
 	else
@@ -306,7 +306,7 @@
 {
 	struct enetc_priv *priv = dev_get_priv(dev);
 
-	if (ofnode_valid(dev->node) && !ofnode_is_available(dev->node)) {
+	if (ofnode_valid(dev_ofnode(dev)) && !ofnode_is_available(dev_ofnode(dev))) {
 		enetc_dbg(dev, "interface disabled\n");
 		return -ENODEV;
 	}
diff --git a/drivers/net/fsl_enetc_mdio.c b/drivers/net/fsl_enetc_mdio.c
index 4da97b6..3eb6ac9 100644
--- a/drivers/net/fsl_enetc_mdio.c
+++ b/drivers/net/fsl_enetc_mdio.c
@@ -112,7 +112,7 @@
 	 * and some are not, use different naming scheme - enetc-N based on
 	 * PCI function # and enetc#N based on interface count
 	 */
-	if (ofnode_valid(dev->node))
+	if (ofnode_valid(dev_ofnode(dev)))
 		sprintf(name, "emdio-%u", PCI_FUNC(pci_get_devfn(dev)));
 	else
 		sprintf(name, "emdio#%u", eth_num_devices++);
diff --git a/drivers/net/mdio-ipq4019.c b/drivers/net/mdio-ipq4019.c
index 13a8856..50134b4 100644
--- a/drivers/net/mdio-ipq4019.c
+++ b/drivers/net/mdio-ipq4019.c
@@ -107,8 +107,8 @@
 
 static int ipq4019_mdio_bind(struct udevice *dev)
 {
-	if (ofnode_valid(dev->node))
-		device_set_name(dev, ofnode_get_name(dev->node));
+	if (ofnode_valid(dev_ofnode(dev)))
+		device_set_name(dev, ofnode_get_name(dev_ofnode(dev)));
 
 	return 0;
 }
diff --git a/drivers/net/mdio_mux_i2creg.c b/drivers/net/mdio_mux_i2creg.c
index f8557dd..3654230 100644
--- a/drivers/net/mdio_mux_i2creg.c
+++ b/drivers/net/mdio_mux_i2creg.c
@@ -61,7 +61,7 @@
 	}
 
 	/* parent should be an I2C chip, grandparent should be an I2C bus */
-	chip_node = ofnode_get_parent(dev->node);
+	chip_node = ofnode_get_parent(dev_ofnode(dev));
 	bus_node = ofnode_get_parent(chip_node);
 
 	err = uclass_get_device_by_ofnode(UCLASS_I2C, bus_node, &i2c_bus);
diff --git a/drivers/net/mvmdio.c b/drivers/net/mvmdio.c
index 005f28f..96f8dc6 100644
--- a/drivers/net/mvmdio.c
+++ b/drivers/net/mvmdio.c
@@ -197,8 +197,8 @@
  */
 static int mvmdio_bind(struct udevice *dev)
 {
-	if (ofnode_valid(dev->node))
-		device_set_name(dev, ofnode_get_name(dev->node));
+	if (ofnode_valid(dev_ofnode(dev)))
+		device_set_name(dev, ofnode_get_name(dev_ofnode(dev)));
 
 	return 0;
 }
diff --git a/drivers/net/octeontx/smi.c b/drivers/net/octeontx/smi.c
index d1582b9..5843641 100644
--- a/drivers/net/octeontx/smi.c
+++ b/drivers/net/octeontx/smi.c
@@ -313,7 +313,7 @@
 
 int octeontx_smi_probe(struct udevice *dev)
 {
-	int ret, subnode, cnt = 0, node = dev->node.of_offset;
+	int ret, subnode, cnt = 0, node = dev_ofnode(dev).of_offset;
 	struct mii_dev *bus;
 	struct octeontx_smi_priv *priv;
 	pci_dev_t bdf = dm_pci_get_bdf(dev);
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 2d12473..ec48689 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -707,7 +707,8 @@
 		tsec_configure_serdes(priv);
 
 #if defined(CONFIG_DM_ETH) && defined(CONFIG_DM_MDIO)
-	if (ofnode_valid(ofnode_find_subnode(priv->dev->node, "fixed-link")))
+	if (ofnode_valid(ofnode_find_subnode(dev_ofnode(priv->dev),
+					     "fixed-link")))
 		phydev = phy_connect(NULL, 0, priv->dev, priv->interface);
 	else
 		phydev = dm_eth_phy_connect(priv->dev);
diff --git a/drivers/phy/phy-ti-am654.c b/drivers/phy/phy-ti-am654.c
index 8e35ea1..82010e7 100644
--- a/drivers/phy/phy-ti-am654.c
+++ b/drivers/phy/phy-ti-am654.c
@@ -344,7 +344,7 @@
 
 	ret = device_bind_driver_to_node(dev->parent,
 					 "ti-serdes-am654-mux-clk",
-					 dev_read_name(dev), dev->node,
+					 dev_read_name(dev), dev_ofnode(dev),
 					 NULL);
 	if (ret) {
 		dev_err(dev, "%s: not able to bind clock driver\n", __func__);
diff --git a/drivers/power/domain/meson-ee-pwrc.c b/drivers/power/domain/meson-ee-pwrc.c
index 2e7ab67..ef8274c 100644
--- a/drivers/power/domain/meson-ee-pwrc.c
+++ b/drivers/power/domain/meson-ee-pwrc.c
@@ -397,11 +397,11 @@
 	if (!priv->data)
 		return -EINVAL;
 
-	priv->regmap_hhi = syscon_node_to_regmap(dev_get_parent(dev)->node);
+	priv->regmap_hhi = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev)));
 	if (IS_ERR(priv->regmap_hhi))
 		return PTR_ERR(priv->regmap_hhi);
 
-	ret = ofnode_read_u32(dev->node, "amlogic,ao-sysctrl",
+	ret = ofnode_read_u32(dev_ofnode(dev), "amlogic,ao-sysctrl",
 			      &ao_phandle);
 	if (ret)
 		return ret;
diff --git a/drivers/power/domain/meson-gx-pwrc-vpu.c b/drivers/power/domain/meson-gx-pwrc-vpu.c
index 40947c6..eb94af2 100644
--- a/drivers/power/domain/meson-gx-pwrc-vpu.c
+++ b/drivers/power/domain/meson-gx-pwrc-vpu.c
@@ -300,11 +300,11 @@
 	ofnode hhi_node;
 	int ret;
 
-	priv->regmap_ao = syscon_node_to_regmap(dev_get_parent(dev)->node);
+	priv->regmap_ao = syscon_node_to_regmap(dev_ofnode(dev_get_parent(dev)));
 	if (IS_ERR(priv->regmap_ao))
 		return PTR_ERR(priv->regmap_ao);
 
-	ret = ofnode_read_u32(dev->node, "amlogic,hhi-sysctrl",
+	ret = ofnode_read_u32(dev_ofnode(dev), "amlogic,hhi-sysctrl",
 			      &hhi_phandle);
 	if (ret)
 		return ret;
diff --git a/drivers/power/regulator/pbias_regulator.c b/drivers/power/regulator/pbias_regulator.c
index 6f0d0a5..5bf186e 100644
--- a/drivers/power/regulator/pbias_regulator.c
+++ b/drivers/power/regulator/pbias_regulator.c
@@ -103,7 +103,8 @@
 {
 	int children;
 
-	children = pmic_bind_children(dev, dev->node, pmic_children_info);
+	children = pmic_bind_children(dev, dev_ofnode(dev),
+				      pmic_children_info);
 	if (!children)
 		debug("%s: %s - no child found\n", __func__, dev->name);
 
diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 58b7469..03eeacc 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -304,13 +304,14 @@
 					if (strcmp(cdev->driver->name, "fixed_rate_clock"))
 						continue;
 
-					str = ofnode_read_string(cdev->node, "clock-output-names");
+					str = ofnode_read_string(dev_ofnode(cdev),
+								 "clock-output-names");
 					if (!str)
 						continue;
 
 					if (!strcmp(str, "xtal")) {
 						err = uclass_get_device_by_ofnode(UCLASS_CLK,
-										  cdev->node,
+										  dev_ofnode(cdev),
 										  &cdev);
 						if (err) {
 							printf("%s%d: Failed to get xtal clk\n", __func__, i);
@@ -345,7 +346,9 @@
 					return -EINVAL;
 				}
 
-				err = uclass_get_device_by_ofnode(UCLASS_CLK, cdev->node, &cdev);
+				err = uclass_get_device_by_ofnode(UCLASS_CLK,
+								  dev_ofnode(cdev),
+								  &cdev);
 				if (err) {
 					printf("%s%d: Failed to get clk controller\n", __func__, i);
 					return err;
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index c64c9b5..98450db 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -148,7 +148,7 @@
 	 * Bind it to the node, too, so that it can get its base address.
 	 */
 	ret = device_bind_driver_to_node(dev, "socfpga_sysreset", "sysreset",
-					 dev->node, &sys_child);
+					 dev_ofnode(dev), &sys_child);
 	if (ret)
 		debug("Warning: No sysreset driver: ret=%d\n", ret);
 
diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c
index b8c0216..c17a552 100644
--- a/drivers/spi/fsl_dspi.c
+++ b/drivers/spi/fsl_dspi.c
@@ -460,8 +460,10 @@
 		return -EINVAL;
 	}
 
-	ofnode_read_u32(dev->node, "fsl,spi-cs-sck-delay", &cs_sck_delay);
-	ofnode_read_u32(dev->node, "fsl,spi-sck-cs-delay", &sck_cs_delay);
+	ofnode_read_u32(dev_ofnode(dev), "fsl,spi-cs-sck-delay",
+			&cs_sck_delay);
+	ofnode_read_u32(dev_ofnode(dev), "fsl,spi-sck-cs-delay",
+			&sck_cs_delay);
 
 	/* Set PCS to SCK delay scale values */
 	ns_delay_scale(&pcssck, &cssck, cs_sck_delay, priv->bus_clk);
diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 7c38d6e..b898c32 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -592,7 +592,7 @@
 	const char *method;
 
 	debug("optee: looking for conduit method in DT.\n");
-	method = ofnode_get_property(dev->node, "method", NULL);
+	method = ofnode_get_property(dev_ofnode(dev), "method", NULL);
 	if (!method) {
 		debug("optee: missing \"method\" property\n");
 		return ERR_PTR(-ENXIO);
diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
index e861c82..798a217 100644
--- a/drivers/usb/cdns3/core.c
+++ b/drivers/usb/cdns3/core.c
@@ -110,7 +110,7 @@
 	enum usb_dr_mode dr_mode;
 	int ret = 0;
 
-	dr_mode = usb_get_dr_mode(dev->node);
+	dr_mode = usb_get_dr_mode(dev_ofnode(dev));
 	cdns->role = USB_ROLE_NONE;
 
 	/*
@@ -393,7 +393,7 @@
 	ofnode node;
 	int ret;
 
-	node = ofnode_by_compatible(parent->node, "cdns,usb3");
+	node = ofnode_by_compatible(dev_ofnode(parent), "cdns,usb3");
 	if (!ofnode_valid(node)) {
 		ret = -ENODEV;
 		goto fail;
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 2e00353..dfd7cf6 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -905,7 +905,7 @@
 	 */
 	hird_threshold = 12;
 
-	dwc->hsphy_mode = usb_get_phy_mode(dev->node);
+	dwc->hsphy_mode = usb_get_phy_mode(dev_ofnode(dev));
 
 	dwc->has_lpm_erratum = dev_read_bool(dev,
 				"snps,has-lpm-erratum");
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 459add8..39e931f 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -108,7 +108,7 @@
 static int dwc3_generic_of_to_plat(struct udevice *dev)
 {
 	struct dwc3_generic_plat *plat = dev_get_plat(dev);
-	ofnode node = dev->node;
+	ofnode node = dev_ofnode(dev);
 
 	plat->base = dev_read_addr(dev);
 
@@ -301,7 +301,7 @@
 	ofnode node;
 	int ret;
 
-	ofnode_for_each_subnode(node, parent->node) {
+	ofnode_for_each_subnode(node, dev_ofnode(parent)) {
 		const char *name = ofnode_get_name(node);
 		enum usb_dr_mode dr_mode;
 		struct udevice *dev;
@@ -418,7 +418,7 @@
 	while (child) {
 		enum usb_dr_mode dr_mode;
 
-		dr_mode = usb_get_dr_mode(child->node);
+		dr_mode = usb_get_dr_mode(dev_ofnode(child));
 		device_find_next_child(&child);
 		if (ops && ops->select_dr_mode)
 			ops->select_dr_mode(dev, index, dr_mode);
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index acc7866..6f99fb2 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -395,7 +395,7 @@
 	}
 #endif
 
-	priv->otg_mode = usb_get_dr_mode(dev->node);
+	priv->otg_mode = usb_get_dr_mode(dev_ofnode(dev));
 
 	ret = dwc3_meson_g12a_usb_init(priv);
 	if (ret)
diff --git a/drivers/usb/dwc3/dwc3-meson-gxl.c b/drivers/usb/dwc3/dwc3-meson-gxl.c
index b63cc23..08467d6 100644
--- a/drivers/usb/dwc3/dwc3-meson-gxl.c
+++ b/drivers/usb/dwc3/dwc3-meson-gxl.c
@@ -338,7 +338,7 @@
 	if (ret)
 		return ret;
 
-	priv->otg_mode = usb_get_dr_mode(dev->node);
+	priv->otg_mode = usb_get_dr_mode(dev_ofnode(dev));
 
 	if (priv->otg_mode == USB_DR_MODE_PERIPHERAL)
 		priv->otg_phy_mode = USB_DR_MODE_PERIPHERAL;
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 4771b1e..e3871e3 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -987,8 +987,8 @@
 	void (*set_params)(struct dwc2_plat_otg_data *data);
 	int ret;
 
-	if (usb_get_dr_mode(dev->node) != USB_DR_MODE_PERIPHERAL &&
-	    usb_get_dr_mode(dev->node) != USB_DR_MODE_OTG) {
+	if (usb_get_dr_mode(dev_ofnode(dev)) != USB_DR_MODE_PERIPHERAL &&
+	    usb_get_dr_mode(dev_ofnode(dev)) != USB_DR_MODE_OTG) {
 		dev_dbg(dev, "Invalid mode\n");
 		return -ENODEV;
 	}
diff --git a/drivers/usb/host/dwc3-octeon-glue.c b/drivers/usb/host/dwc3-octeon-glue.c
index c3cac9c..742e156 100644
--- a/drivers/usb/host/dwc3-octeon-glue.c
+++ b/drivers/usb/host/dwc3-octeon-glue.c
@@ -366,7 +366,7 @@
 
 	/* Find snps,dwc3 node from subnode */
 	dwc3_node = ofnode_null();
-	ofnode_for_each_subnode(node, dev->node) {
+	ofnode_for_each_subnode(node, dev_ofnode(dev)) {
 		if (ofnode_device_is_compatible(node, "snps,dwc3"))
 			dwc3_node = node;
 	}
diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c
index deb820a..e5c6a1a 100644
--- a/drivers/usb/host/dwc3-sti-glue.c
+++ b/drivers/usb/host/dwc3-sti-glue.c
@@ -108,7 +108,8 @@
 	int ret;
 	u32 reg[4];
 
-	ret = ofnode_read_u32_array(dev->node, "reg", reg, ARRAY_SIZE(reg));
+	ret = ofnode_read_u32_array(dev_ofnode(dev), "reg", reg,
+				    ARRAY_SIZE(reg));
 	if (ret) {
 		pr_err("unable to find st,stih407-dwc3 reg property(%d)\n", ret);
 		return ret;
@@ -154,7 +155,7 @@
 	ofnode node, dwc3_node;
 
 	/* Find snps,dwc3 node from subnode */
-	ofnode_for_each_subnode(node, dev->node) {
+	ofnode_for_each_subnode(node, dev_ofnode(dev)) {
 		if (ofnode_device_is_compatible(node, "snps,dwc3"))
 			dwc3_node = node;
 	}
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index d2f49cf..ef3a63a 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -523,7 +523,7 @@
 	struct usb_plat *plat = dev_get_plat(dev);
 	enum usb_dr_mode dr_mode;
 
-	dr_mode = usb_get_dr_mode(dev->node);
+	dr_mode = usb_get_dr_mode(dev_ofnode(dev));
 
 	switch (dr_mode) {
 	case USB_DR_MODE_HOST:
diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
index 59408e4..3e0ae80 100644
--- a/drivers/usb/host/xhci-dwc3.c
+++ b/drivers/usb/host/xhci-dwc3.c
@@ -155,7 +155,7 @@
 
 	writel(reg, &dwc3_reg->g_usb2phycfg[0]);
 
-	dr_mode = usb_get_dr_mode(dev->node);
+	dr_mode = usb_get_dr_mode(dev_ofnode(dev));
 	if (dr_mode == USB_DR_MODE_UNKNOWN)
 		/* by default set dual role mode to HOST */
 		dr_mode = USB_DR_MODE_HOST;
diff --git a/drivers/usb/mtu3/mtu3_core.c b/drivers/usb/mtu3/mtu3_core.c
index 28136f8..2f5cc9b 100644
--- a/drivers/usb/mtu3/mtu3_core.c
+++ b/drivers/usb/mtu3/mtu3_core.c
@@ -802,7 +802,7 @@
 	mtu->ippc_base = ssusb->ippc_base;
 	mtu->mac_base = ssusb->mac_base;
 	mtu->ssusb = ssusb;
-	mtu->max_speed = usb_get_maximum_speed(dev->node);
+	mtu->max_speed = usb_get_maximum_speed(dev_ofnode(dev));
 	mtu->force_vbus = dev_read_bool(dev, "mediatek,force-vbus");
 
 	ret = mtu3_hw_init(mtu);
diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
index c951107..b097471 100644
--- a/drivers/usb/mtu3/mtu3_plat.c
+++ b/drivers/usb/mtu3/mtu3_plat.c
@@ -173,7 +173,7 @@
 		return -ENODEV;
 	}
 
-	ssusb->dr_mode = usb_get_dr_mode(child->node);
+	ssusb->dr_mode = usb_get_dr_mode(dev_ofnode(child));
 
 	if (ssusb->dr_mode == USB_DR_MODE_UNKNOWN ||
 		ssusb->dr_mode == USB_DR_MODE_OTG)
@@ -313,7 +313,7 @@
 	ofnode node;
 	int ret;
 
-	node = ofnode_by_compatible(parent->node, "mediatek,ssusb");
+	node = ofnode_by_compatible(dev_ofnode(parent), "mediatek,ssusb");
 	if (!ofnode_valid(node))
 		return -ENODEV;
 
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index 81b12fa..75cf181 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -289,7 +289,7 @@
 	ofnode node;
 	int ret;
 
-	ofnode_for_each_subnode(node, parent->node) {
+	ofnode_for_each_subnode(node, dev_ofnode(parent)) {
 		struct udevice *dev;
 		const char *name = ofnode_get_name(node);
 		enum usb_dr_mode dr_mode;
diff --git a/drivers/video/nexell_display.c b/drivers/video/nexell_display.c
index 00e2c36..b47bef3 100644
--- a/drivers/video/nexell_display.c
+++ b/drivers/video/nexell_display.c
@@ -416,7 +416,7 @@
 		      __func__);
 		return NULL;
 	}
-	node = dev->node.of_offset;
+	node = dev_ofnode(dev).of_offset;
 
 	if (CONFIG_IS_ENABLED(OF_CONTROL)) {
 		ret = nx_display_parse_dt(dev, dp, plat);
diff --git a/drivers/video/rockchip/rk_mipi.c b/drivers/video/rockchip/rk_mipi.c
index d125a5b..159201a 100644
--- a/drivers/video/rockchip/rk_mipi.c
+++ b/drivers/video/rockchip/rk_mipi.c
@@ -119,7 +119,7 @@
 	rk_mipi_dsi_write(regs, VID_PKT_SIZE, 0x4b0);
 
 	/* Set dpi color coding depth 24 bit */
-	timing_node = ofnode_find_subnode(dev->node, "display-timings");
+	timing_node = ofnode_find_subnode(dev_ofnode(dev), "display-timings");
 	node = ofnode_first_subnode(timing_node);
 
 	val = ofnode_read_u32_default(node, "bits-per-pixel", -1);