diff mbox series

[v2,9/9] usb: Use ofnode as usb_get_maximum_speed() parameter

Message ID 20200220023224.32146-10-kever.yang@rock-chips.com
State New
Headers show
Series usb: Covert to support Live DT | expand

Commit Message

Kever Yang Feb. 20, 2020, 2:32 a.m. UTC
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.yang at rock-chips.com>
---

Changes in v2: None

 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 mbox series

Patch

diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index 22e90a5717..8ebe64e8b3 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -2579,7 +2579,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 4f1f8ceb54..c19b916be9 100644
--- a/include/linux/usb/otg.h
+++ b/include/linux/usb/otg.h
@@ -29,11 +29,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 */