Thread (14 messages) flat view 14 messages, 3 authors, 2021-05-31

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

From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date: 2021-05-20 12:38:50
Also in: linux-devicetree, linux-usb
Subsystem: multiplexer subsystem, the rest · Maintainers: Peter Rosin, Linus Torvalds

On Wed, May 19, 2021 at 03:14:48PM +0800, Li Jun wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 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);
No. I think this is what you want to do:
diff --git a/drivers/mux/core.c b/drivers/mux/core.c
index 1fb22388e7e07..e30e8504c1d6d 100644
--- a/drivers/mux/core.c
+++ b/drivers/mux/core.c
@@ -424,7 +424,7 @@ static struct mux_chip *of_find_mux_chip_by_node(struct device_node *np)
  */
 struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
 {
-       struct device_node *np = dev->of_node;
+       struct device_node *np = to_of_node(dev_fwnode(dev));
        struct of_phandle_args args;
        struct mux_chip *mux_chip;
        unsigned int controller;
thanks,

-- 
heikki

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help