ofnode is more common and no need to convert to offset after we migrate
other API to use ofnode.

Signed-off-by: Kever Yang <kever.y...@rock-chips.com>
---

 drivers/usb/cdns3/gadget.c      | 2 +-
 drivers/usb/common/common.c     | 5 ++---
 drivers/usb/dwc3/dwc3-generic.c | 2 +-
 include/linux/usb/otg.h         | 4 ++--
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 0e02b77965..2a8838c4cb 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -2576,7 +2576,7 @@ static int cdns3_gadget_start(struct cdns3 *cdns)
        if (!priv_dev->onchip_buffers)
                priv_dev->onchip_buffers = 256;
 
-       max_speed = usb_get_maximum_speed(dev_of_offset(cdns->dev));
+       max_speed = usb_get_maximum_speed(dev_ofnode(cdns->dev));
 
        /* Check the maximum_speed parameter */
        switch (max_speed) {
diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index 4300f711a9..0db281b970 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -47,13 +47,12 @@ static const char *const speed_names[] = {
        [USB_SPEED_SUPER] = "super-speed",
 };
 
-enum usb_device_speed usb_get_maximum_speed(int node)
+enum usb_device_speed usb_get_maximum_speed(ofnode node)
 {
-       const void *fdt = gd->fdt_blob;
        const char *max_speed;
        int i;
 
-       max_speed = fdt_getprop(fdt, node, "maximum-speed", NULL);
+       max_speed = ofnode_read_string(node, "maximum-speed");
        if (!max_speed) {
                pr_err("usb maximum-speed not found\n");
                return USB_SPEED_UNKNOWN;
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 7178f12b47..febcfc0f54 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -92,7 +92,7 @@ static int dwc3_generic_ofdata_to_platdata(struct udevice 
*dev)
 
        plat->base = dev_read_addr(dev);
 
-       plat->maximum_speed = usb_get_maximum_speed(ofnode_to_offset(node));
+       plat->maximum_speed = usb_get_maximum_speed(node);
        if (plat->maximum_speed == USB_SPEED_UNKNOWN) {
                pr_info("No USB maximum speed specified. Using super speed\n");
                plat->maximum_speed = USB_SPEED_SUPER;
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
index 6ba53fc598..5c67c5b116 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -27,11 +27,11 @@ enum usb_dr_mode usb_get_dr_mode(ofnode node);
 
 /**
  * usb_get_maximum_speed() - Get maximum speed for given device
- * @node: Node offset to the given device
+ * @node: ofnode of the given device
  *
  * The function gets phy interface string from property 'maximum-speed',
  * and returns the correspondig enum usb_device_speed
  */
-enum usb_device_speed usb_get_maximum_speed(int node);
+enum usb_device_speed usb_get_maximum_speed(ofnode node);
 
 #endif /* __LINUX_USB_OTG_H */
-- 
2.17.1

Reply via email to