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

usb: typec: Add wrapper for bus switch set code

Add a wrapper that calls the set() function for various switches
associated with a port altmode.

Right now, it just wraps the existing typec_mux_set() command,
but it can be expanded to include other switches in future patches.

No functional changes introduced by this patch.

Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230112221609.540754-3-pmalani@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Prashant Malani and committed by
Greg Kroah-Hartman
2c8cb236 2476de82

+9 -2
+9 -2
drivers/usb/typec/bus.c
··· 27 27 return typec_mux_set(alt->mux, &state); 28 28 } 29 29 30 + /* Wrapper to set various Type-C port switches together. */ 31 + static inline int 32 + typec_altmode_set_switches(struct altmode *alt, unsigned long conf, void *data) 33 + { 34 + return typec_altmode_set_mux(alt, conf, data); 35 + } 36 + 30 37 static int typec_altmode_set_state(struct typec_altmode *adev, 31 38 unsigned long conf, void *data) 32 39 { ··· 42 35 43 36 port_altmode = is_port ? to_altmode(adev) : to_altmode(adev)->partner; 44 37 45 - return typec_altmode_set_mux(port_altmode, conf, data); 38 + return typec_altmode_set_switches(port_altmode, conf, data); 46 39 } 47 40 48 41 /* -------------------------------------------------------------------------- */ ··· 80 73 is_port = is_typec_port(adev->dev.parent); 81 74 partner = altmode->partner; 82 75 83 - ret = typec_altmode_set_mux(is_port ? altmode : partner, conf, data); 76 + ret = typec_altmode_set_switches(is_port ? altmode : partner, conf, data); 84 77 if (ret) 85 78 return ret; 86 79