mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
Revert "usb: gadget: Properly configure the device for remote wakeup"
This reverts commited9fdc82cawhich is commitb93c2a68f3upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Ib55f9062147895c79170426d3455dcef12d0f25f Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -511,19 +511,6 @@ static u8 encode_bMaxPower(enum usb_device_speed speed,
|
||||
return min(val, 900U) / 8;
|
||||
}
|
||||
|
||||
void check_remote_wakeup_config(struct usb_gadget *g,
|
||||
struct usb_configuration *c)
|
||||
{
|
||||
if (USB_CONFIG_ATT_WAKEUP & c->bmAttributes) {
|
||||
/* Reset the rw bit if gadget is not capable of it */
|
||||
if (!g->wakeup_capable && g->ops->set_remote_wakeup) {
|
||||
WARN(c->cdev, "Clearing wakeup bit for config c.%d\n",
|
||||
c->bConfigurationValue);
|
||||
c->bmAttributes &= ~USB_CONFIG_ATT_WAKEUP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int config_buf(struct usb_configuration *config,
|
||||
enum usb_device_speed speed, void *buf, u8 type)
|
||||
{
|
||||
@@ -972,11 +959,6 @@ static int set_config(struct usb_composite_dev *cdev,
|
||||
power = min(power, 500U);
|
||||
else
|
||||
power = min(power, 900U);
|
||||
|
||||
if (USB_CONFIG_ATT_WAKEUP & c->bmAttributes)
|
||||
usb_gadget_set_remote_wakeup(gadget, 1);
|
||||
else
|
||||
usb_gadget_set_remote_wakeup(gadget, 0);
|
||||
done:
|
||||
if (power <= USB_SELF_POWER_VBUS_MAX_DRAW)
|
||||
usb_gadget_set_selfpowered(gadget);
|
||||
|
||||
@@ -1408,9 +1408,6 @@ static int configfs_composite_bind(struct usb_gadget *gadget,
|
||||
if (gadget_is_otg(gadget))
|
||||
c->descriptors = otg_desc;
|
||||
|
||||
/* Properly configure the bmAttributes wakeup bit */
|
||||
check_remote_wakeup_config(gadget, c);
|
||||
|
||||
cfg = container_of(c, struct config_usb_cfg, c);
|
||||
if (!list_empty(&cfg->string_list)) {
|
||||
i = 0;
|
||||
|
||||
@@ -525,33 +525,6 @@ out:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_gadget_wakeup);
|
||||
|
||||
/**
|
||||
* usb_gadget_set_remote_wakeup - configures the device remote wakeup feature.
|
||||
* @gadget:the device being configured for remote wakeup
|
||||
* @set:value to be configured.
|
||||
*
|
||||
* set to one to enable remote wakeup feature and zero to disable it.
|
||||
*
|
||||
* returns zero on success, else negative errno.
|
||||
*/
|
||||
int usb_gadget_set_remote_wakeup(struct usb_gadget *gadget, int set)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!gadget->ops->set_remote_wakeup) {
|
||||
ret = -EOPNOTSUPP;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = gadget->ops->set_remote_wakeup(gadget, set);
|
||||
|
||||
out:
|
||||
trace_usb_gadget_set_remote_wakeup(gadget, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(usb_gadget_set_remote_wakeup);
|
||||
|
||||
/**
|
||||
* usb_gadget_set_selfpowered - sets the device selfpowered feature.
|
||||
* @gadget:the device being declared as self-powered
|
||||
|
||||
@@ -91,11 +91,6 @@ DEFINE_EVENT(udc_log_gadget, usb_gadget_wakeup,
|
||||
TP_ARGS(g, ret)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(udc_log_gadget, usb_gadget_set_remote_wakeup,
|
||||
TP_PROTO(struct usb_gadget *g, int ret),
|
||||
TP_ARGS(g, ret)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(udc_log_gadget, usb_gadget_set_selfpowered,
|
||||
TP_PROTO(struct usb_gadget *g, int ret),
|
||||
TP_ARGS(g, ret)
|
||||
|
||||
@@ -412,8 +412,6 @@ extern int composite_dev_prepare(struct usb_composite_driver *composite,
|
||||
extern int composite_os_desc_req_prepare(struct usb_composite_dev *cdev,
|
||||
struct usb_ep *ep0);
|
||||
void composite_dev_cleanup(struct usb_composite_dev *cdev);
|
||||
void check_remote_wakeup_config(struct usb_gadget *g,
|
||||
struct usb_configuration *c);
|
||||
|
||||
static inline struct usb_composite_driver *to_cdriver(
|
||||
struct usb_gadget_driver *gdrv)
|
||||
|
||||
@@ -315,7 +315,6 @@ struct usb_udc;
|
||||
struct usb_gadget_ops {
|
||||
int (*get_frame)(struct usb_gadget *);
|
||||
int (*wakeup)(struct usb_gadget *);
|
||||
int (*set_remote_wakeup)(struct usb_gadget *, int set);
|
||||
int (*set_selfpowered) (struct usb_gadget *, int is_selfpowered);
|
||||
int (*vbus_session) (struct usb_gadget *, int is_active);
|
||||
int (*vbus_draw) (struct usb_gadget *, unsigned mA);
|
||||
@@ -395,8 +394,6 @@ struct usb_gadget_ops {
|
||||
* @connected: True if gadget is connected.
|
||||
* @lpm_capable: If the gadget max_speed is FULL or HIGH, this flag
|
||||
* indicates that it supports LPM as per the LPM ECN & errata.
|
||||
* @wakeup_capable: True if gadget is capable of sending remote wakeup.
|
||||
* @wakeup_armed: True if gadget is armed by the host for remote wakeup.
|
||||
* @irq: the interrupt number for device controller.
|
||||
* @id_number: a unique ID number for ensuring that gadget names are distinct
|
||||
*
|
||||
@@ -458,8 +455,6 @@ struct usb_gadget {
|
||||
unsigned deactivated:1;
|
||||
unsigned connected:1;
|
||||
unsigned lpm_capable:1;
|
||||
unsigned wakeup_capable:1;
|
||||
unsigned wakeup_armed:1;
|
||||
int irq;
|
||||
int id_number;
|
||||
};
|
||||
@@ -616,7 +611,6 @@ static inline int gadget_is_otg(struct usb_gadget *g)
|
||||
#if IS_ENABLED(CONFIG_USB_GADGET)
|
||||
int usb_gadget_frame_number(struct usb_gadget *gadget);
|
||||
int usb_gadget_wakeup(struct usb_gadget *gadget);
|
||||
int usb_gadget_set_remote_wakeup(struct usb_gadget *gadget, int set);
|
||||
int usb_gadget_set_selfpowered(struct usb_gadget *gadget);
|
||||
int usb_gadget_clear_selfpowered(struct usb_gadget *gadget);
|
||||
int usb_gadget_vbus_connect(struct usb_gadget *gadget);
|
||||
@@ -632,8 +626,6 @@ static inline int usb_gadget_frame_number(struct usb_gadget *gadget)
|
||||
{ return 0; }
|
||||
static inline int usb_gadget_wakeup(struct usb_gadget *gadget)
|
||||
{ return 0; }
|
||||
static inline int usb_gadget_set_remote_wakeup(struct usb_gadget *gadget, int set)
|
||||
{ return 0; }
|
||||
static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget)
|
||||
{ return 0; }
|
||||
static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget)
|
||||
|
||||
Reference in New Issue
Block a user