Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: typec: mux: avoid duplicated mux switches

Some devices use combo PHYs (i.e. USB3 + DisplayPort), which also
handle the lane muxing. These PHYs are referenced twice from
the USB-C connector (USB super-speed lines and SBU/AUX lines)
resulting in the mux being configured twice. Avoid this by
dropping duplicates.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://patch.msgid.link/20260223-typec-mux-duplication-fix-v2-2-0402fefc222e@collabora.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Sebastian Reichel and committed by
Greg Kroah-Hartman
b145c3f2 a53b4f9c

+12 -1
+12 -1
drivers/usb/typec/mux.c
··· 275 275 static void *typec_mux_match(const struct fwnode_handle *fwnode, 276 276 const char *id, void *data) 277 277 { 278 + struct typec_mux_dev **mux_devs = data; 278 279 struct device *dev; 280 + int i; 279 281 280 282 /* 281 283 * Device graph (OF graph) does not give any means to identify the ··· 292 290 293 291 dev = class_find_device(&typec_mux_class, NULL, fwnode, 294 292 mux_fwnode_match); 293 + 294 + /* Skip duplicates */ 295 + for (i = 0; i < TYPEC_MUX_MAX_DEVS; i++) 296 + if (to_typec_mux_dev(dev) == mux_devs[i]) { 297 + put_device(dev); 298 + return NULL; 299 + } 300 + 295 301 296 302 return dev ? to_typec_mux_dev(dev) : ERR_PTR(-EPROBE_DEFER); 297 303 } ··· 326 316 return ERR_PTR(-ENOMEM); 327 317 328 318 count = fwnode_connection_find_matches(fwnode, "mode-switch", 329 - NULL, typec_mux_match, 319 + (void **)mux_devs, 320 + typec_mux_match, 330 321 (void **)mux_devs, 331 322 ARRAY_SIZE(mux_devs)); 332 323 if (count <= 0) {