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/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;