Commit 0c340438 authored by Nícolas F. R. A. Prado's avatar Nícolas F. R. A. Prado Committed by Greg Kroah-Hartman

usb: typec: retimer: Add missing id check in match callback

The fwnode_connection_find_match() function handles two cases: named
references and graph endpoints. In the second case, the match function
passed in is called with the id to check for the match. However, the
match function for the recently added type-c retimer class assumes the
connection has already been matched (which is only true for the first
case).

The result is that with that change, all type-c nodes with graph
endpoints defer probe indefinitely, independently of having a retimer
connection or not.

Add the missing check, like is done by the type-c mux and usb role
switch code, to fix the issue.

Fixes: ddaf8d96 ("usb: typec: Add support for retimers")
Reviewed-by: default avatarPrashant Malani <pmalani@chromium.org>
Signed-off-by: default avatarNícolas F. R. A. Prado <nfraprado@collabora.com>
Link: https://lore.kernel.org/r/20220725203129.1973260-1-nfraprado@collabora.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 13da6f41
...@@ -36,8 +36,13 @@ static int retimer_fwnode_match(struct device *dev, const void *fwnode) ...@@ -36,8 +36,13 @@ static int retimer_fwnode_match(struct device *dev, const void *fwnode)
static void *typec_retimer_match(struct fwnode_handle *fwnode, const char *id, void *data) static void *typec_retimer_match(struct fwnode_handle *fwnode, const char *id, void *data)
{ {
struct device *dev = class_find_device(&retimer_class, NULL, fwnode, struct device *dev;
retimer_fwnode_match);
if (id && !fwnode_property_present(fwnode, id))
return NULL;
dev = class_find_device(&retimer_class, NULL, fwnode,
retimer_fwnode_match);
return dev ? to_typec_retimer(dev) : ERR_PTR(-EPROBE_DEFER); return dev ? to_typec_retimer(dev) : ERR_PTR(-EPROBE_DEFER);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment