From 3463dffda6ab7aa57f7abf350d1490aa2d3e4d8a Mon Sep 17 00:00:00 2001 From: Sebastian Reichel <sebastian.reichel@collabora.com> Date: Fri, 28 Jul 2023 16:43:16 +0200 Subject: [PATCH] usb: typec: tcpm: avoid graph warning When using a devicetree as described in commit d56de8c9a17d ("usb: typec: tcpm: try to get role switch from tcpc fwnode"), the kernel will print an error when probing the TCPM driver, which looks similar to this: OF: graph: no port node found in /i2c@feac0000/usb-typec@22 This is a false positive, since the code first tries to find a ports node for the device and only then checks the fwnode. Fix this by swapping the order. Note, that this will now generate a error message for devicetrees with a role-switch ports node directly in the TCPM node instead of in the connectors sub-node, before falling back to the legacy behaviour. These devicetrees generate warnings when being checked against the bindings, and should be fixed. Fixes: d56de8c9a17d ("usb: typec: tcpm: try to get role switch from tcpc fwnode") Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> --- drivers/usb/typec/tcpm/tcpm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index bfb6f9481e87f..190c1edaad772 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -6598,9 +6598,9 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc) port->partner_desc.identity = &port->partner_ident; port->port_type = port->typec_caps.type; - port->role_sw = usb_role_switch_get(port->dev); + port->role_sw = fwnode_usb_role_switch_get(tcpc->fwnode); if (!port->role_sw) - port->role_sw = fwnode_usb_role_switch_get(tcpc->fwnode); + port->role_sw = usb_role_switch_get(port->dev); if (IS_ERR(port->role_sw)) { err = PTR_ERR(port->role_sw); goto out_destroy_wq; -- GitLab