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: Clean up mux_fwnode_match()

Removing the "svid" and "accessory" device property checks.
Those properties are not supported on any platform.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/lkml/20230522215348.uoyboow26n2o3tel@ripper/
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Tested-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230526131434.46920-2-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Heikki Krogerus and committed by
Greg Kroah-Hartman
4aebc4f8 3c90c5a7

+7 -48
+7 -48
drivers/usb/typec/mux.c
··· 265 265 static void *typec_mux_match(const struct fwnode_handle *fwnode, 266 266 const char *id, void *data) 267 267 { 268 - const struct typec_altmode_desc *desc = data; 269 268 struct device *dev; 270 - bool match; 271 - int nval; 272 - u16 *val; 273 - int ret; 274 - int i; 275 269 276 270 /* 277 - * Check has the identifier already been "consumed". If it 278 - * has, no need to do any extra connection identification. 271 + * Device graph (OF graph) does not give any means to identify the 272 + * device type or the device class of the remote port parent that @fwnode 273 + * represents, so in order to identify the type or the class of @fwnode 274 + * an additional device property is needed. With typec muxes the 275 + * property is named "mode-switch" (@id). The value of the device 276 + * property is ignored. 279 277 */ 280 - match = !id; 281 - if (match) 282 - goto find_mux; 283 - 284 - if (!desc) { 285 - /* 286 - * Accessory Mode muxes & muxes which explicitly specify 287 - * the required identifier can avoid SVID matching. 288 - */ 289 - match = fwnode_property_present(fwnode, "accessory") || 290 - fwnode_property_present(fwnode, id); 291 - if (match) 292 - goto find_mux; 293 - return NULL; 294 - } 295 - 296 - /* Alternate Mode muxes */ 297 - nval = fwnode_property_count_u16(fwnode, "svid"); 298 - if (nval <= 0) 278 + if (id && !fwnode_property_present(fwnode, id)) 299 279 return NULL; 300 280 301 - val = kcalloc(nval, sizeof(*val), GFP_KERNEL); 302 - if (!val) 303 - return ERR_PTR(-ENOMEM); 304 - 305 - ret = fwnode_property_read_u16_array(fwnode, "svid", val, nval); 306 - if (ret < 0) { 307 - kfree(val); 308 - return ERR_PTR(ret); 309 - } 310 - 311 - for (i = 0; i < nval; i++) { 312 - match = val[i] == desc->svid; 313 - if (match) { 314 - kfree(val); 315 - goto find_mux; 316 - } 317 - } 318 - kfree(val); 319 - return NULL; 320 - 321 - find_mux: 322 281 dev = class_find_device(&typec_mux_class, NULL, fwnode, 323 282 mux_fwnode_match); 324 283