diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2020-03-02 16:53:50 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-03-04 13:12:50 +0300 |
commit | e5256194cb51ced7a2f656590f1e2132235d442c (patch) | |
tree | 473086f90ceca12fc5774061fe49748bd2b126e0 /drivers/usb/roles | |
parent | bce3052f0c165685a074e50136e4d341bcd59f4a (diff) | |
download | linux-e5256194cb51ced7a2f656590f1e2132235d442c.tar.xz |
usb: roles: Allow the role switches to be named
The switch devices have been named by using the name of the
parent device as base for now, but if for example the
parent device controls multiple muxes, that will not work.
Adding an optional member "name" to the switch descriptor
that can be used for naming the switch during registration.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20200302135353.56659-7-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/roles')
-rw-r--r-- | drivers/usb/roles/class.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c index cda8cbb54581..5b17709821df 100644 --- a/drivers/usb/roles/class.c +++ b/drivers/usb/roles/class.c @@ -330,7 +330,8 @@ usb_role_switch_register(struct device *parent, sw->dev.class = role_class; sw->dev.type = &usb_role_dev_type; dev_set_drvdata(&sw->dev, desc->driver_data); - dev_set_name(&sw->dev, "%s-role-switch", dev_name(parent)); + dev_set_name(&sw->dev, "%s-role-switch", + desc->name ? desc->name : dev_name(parent)); ret = device_register(&sw->dev); if (ret) { |