diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2020-03-02 16:53:45 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-04 11:11:03 +0100 |
commit | ef441dd6af91e1f4265e890021ac3ad631b2b10e (patch) | |
tree | 10dd7ec0fbc977a2eda6269ae27c4a727908124c /drivers/usb/typec/mux.c | |
parent | 67540460193bb5dc3841590bc76e1421d56dc173 (diff) | |
download | linux-ef441dd6af91e1f4265e890021ac3ad631b2b10e.tar.bz2 |
usb: typec: mux: Allow the muxes to be named
The mux devices have been named by using the name of the
parent device as base until now, but if for example the
parent device has multiple muxes that will not work. This
makes it possible to supply the name for a mux during
registration.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20200302135353.56659-2-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/mux.c')
-rw-r--r-- | drivers/usb/typec/mux.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c index b952fa2fff39..2a073614172a 100644 --- a/drivers/usb/typec/mux.c +++ b/drivers/usb/typec/mux.c @@ -127,7 +127,8 @@ typec_switch_register(struct device *parent, sw->dev.class = &typec_mux_class; sw->dev.type = &typec_switch_dev_type; sw->dev.driver_data = desc->drvdata; - dev_set_name(&sw->dev, "%s-switch", dev_name(parent)); + dev_set_name(&sw->dev, "%s-switch", + desc->name ? desc->name : dev_name(parent)); ret = device_add(&sw->dev); if (ret) { @@ -309,7 +310,8 @@ typec_mux_register(struct device *parent, const struct typec_mux_desc *desc) mux->dev.class = &typec_mux_class; mux->dev.type = &typec_mux_dev_type; mux->dev.driver_data = desc->drvdata; - dev_set_name(&mux->dev, "%s-mux", dev_name(parent)); + dev_set_name(&mux->dev, "%s-mux", + desc->name ? desc->name : dev_name(parent)); ret = device_add(&mux->dev); if (ret) { |