Revert "usb: roles: don't get/set_role() when usb_role_switch is unregistered"
This reverts commit eb3693454b
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>
This commit is contained in:
parent
e92b643b4b
commit
72f354f396
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user