[PATCH 2/4] usb: typec: use typec cap fwnode's of_node for typec port

Li Jun jun.li at nxp.com
Wed May 19 00:14:48 PDT 2021


Asssign typec cap fwnode's of_node to typec port, then we can use
typec port device to get properties from its OF.

Signed-off-by: Li Jun <jun.li at nxp.com>
---
 drivers/usb/typec/class.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index b9429c9f65f6..a29bf2c32233 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -8,6 +8,7 @@
 
 #include <linux/module.h>
 #include <linux/mutex.h>
+#include <linux/of.h>
 #include <linux/property.h>
 #include <linux/slab.h>
 #include <linux/usb/pd_vdo.h>
@@ -2049,6 +2050,7 @@ struct typec_port *typec_register_port(struct device *parent,
 	port->dev.class = &typec_class;
 	port->dev.parent = parent;
 	port->dev.fwnode = cap->fwnode;
+	port->dev.of_node = to_of_node(cap->fwnode);
 	port->dev.type = &typec_port_dev_type;
 	dev_set_name(&port->dev, "port%d", id);
 	dev_set_drvdata(&port->dev, cap->driver_data);
-- 
2.25.1




More information about the linux-arm-kernel mailing list