Skip to content

Commit 93dd211

Browse files
Heikki Krogerusgregkh
authored andcommitted
usb: typec: mux: Get the mux identifier from function parameter
In order for the muxes to be usable with alternate modes, the alternate mode devices will need also to be able to get a handle to the muxes on top of the port devices. To make that possible, the muxes need to be possible to request with an identifier. This will change the API so that the mux identifier is given as a function parameter to typec_mux_get(), and the hard-coded "typec-mux" is replaced with that value. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Tested-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0bc2631 commit 93dd211

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

drivers/usb/typec/class.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1407,7 +1407,7 @@ struct typec_port *typec_register_port(struct device *parent,
14071407
goto err_switch;
14081408
}
14091409

1410-
port->mux = typec_mux_get(cap->fwnode ? &port->dev : parent);
1410+
port->mux = typec_mux_get(parent, "typec-mux");
14111411
if (IS_ERR(port->mux)) {
14121412
ret = PTR_ERR(port->mux);
14131413
goto err_mux;

drivers/usb/typec/mux.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,19 @@ static void *typec_mux_match(struct device_connection *con, int ep, void *data)
123123
/**
124124
* typec_mux_get - Find USB Type-C Multiplexer
125125
* @dev: The caller device
126+
* @name: Mux identifier
126127
*
127128
* Finds a mux linked to the caller. This function is primarily meant for the
128129
* Type-C drivers. Returns a reference to the mux on success, NULL if no
129130
* matching connection was found, or ERR_PTR(-EPROBE_DEFER) when a connection
130131
* was found but the mux has not been enumerated yet.
131132
*/
132-
struct typec_mux *typec_mux_get(struct device *dev)
133+
struct typec_mux *typec_mux_get(struct device *dev, const char *name)
133134
{
134135
struct typec_mux *mux;
135136

136137
mutex_lock(&mux_lock);
137-
mux = device_connection_find_match(dev, "typec-mux", NULL,
138-
typec_mux_match);
138+
mux = device_connection_find_match(dev, name, NULL, typec_mux_match);
139139
if (!IS_ERR_OR_NULL(mux))
140140
get_device(mux->dev);
141141
mutex_unlock(&mux_lock);

include/linux/usb/typec_mux.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void typec_switch_put(struct typec_switch *sw);
4747
int typec_switch_register(struct typec_switch *sw);
4848
void typec_switch_unregister(struct typec_switch *sw);
4949

50-
struct typec_mux *typec_mux_get(struct device *dev);
50+
struct typec_mux *typec_mux_get(struct device *dev, const char *name);
5151
void typec_mux_put(struct typec_mux *mux);
5252
int typec_mux_register(struct typec_mux *mux);
5353
void typec_mux_unregister(struct typec_mux *mux);

0 commit comments

Comments
 (0)