diff options
author | Greg Kroah-Hartman <gregkh@google.com> | 2024-04-29 07:42:35 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2024-04-30 17:20:36 +0000 |
commit | 048142f25073c14414d1c9157d0bc2748bb0859a (patch) | |
tree | 1041ed8be0e493bacaea9e57596bd3d745375529 | |
parent | ef7c62ceb7d3ef4b1655eaf81817912c4c268a32 (diff) | |
download | hikey-linaro-048142f25073c14414d1c9157d0bc2748bb0859a.tar.gz |
Revert "usb: roles: don't get/set_role() when usb_role_switch is unregistered"
This reverts commit eb3693454baab7d784d3b56c96a99c106e49ce14 which is
commit b787a3e781759026a6212736ef8e52cf83d1821a upstream.
It breaks the Android kernel abi and can be brought back in the future
in an abi-safe way if it is really needed. It's not a "real" break, and
we can work around it, but this really does not affect Android systems,
so it's safe to drop for now.
Bug: 161946584
Change-Id: I82f2a6b9ecb9ebaef30df164859305605f477f24
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r-- | drivers/usb/roles/class.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/usb/roles/class.c b/drivers/usb/roles/class.c index e1dff4a44fd2..03e7e908baa2 100644 --- a/drivers/usb/roles/class.c +++ b/drivers/usb/roles/class.c @@ -21,7 +21,6 @@ struct usb_role_switch { struct mutex lock; /* device lock*/ struct module *module; /* the module this device depends on */ enum usb_role role; - bool registered; /* From descriptor */ struct device *usb2_port; @@ -48,9 +47,6 @@ int usb_role_switch_set_role(struct usb_role_switch *sw, enum usb_role role) if (IS_ERR_OR_NULL(sw)) return 0; - if (!sw->registered) - return -EOPNOTSUPP; - mutex_lock(&sw->lock); ret = sw->set(sw, role); @@ -76,7 +72,7 @@ enum usb_role usb_role_switch_get_role(struct usb_role_switch *sw) { enum usb_role role; - if (IS_ERR_OR_NULL(sw) || !sw->registered) + if (IS_ERR_OR_NULL(sw)) return USB_ROLE_NONE; mutex_lock(&sw->lock); @@ -351,8 +347,6 @@ usb_role_switch_register(struct device *parent, return ERR_PTR(ret); } - sw->registered = true; - /* TODO: Symlinks for the host port and the device controller. */ return sw; @@ -367,10 +361,8 @@ EXPORT_SYMBOL_GPL(usb_role_switch_register); */ void usb_role_switch_unregister(struct usb_role_switch *sw) { - if (!IS_ERR_OR_NULL(sw)) { - sw->registered = false; + if (!IS_ERR_OR_NULL(sw)) device_unregister(&sw->dev); - } } EXPORT_SYMBOL_GPL(usb_role_switch_unregister); |