Commit 4d064c08 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

usbcore: track whether interfaces are suspended

Currently we rely on intf->dev.power.power_state.event for tracking
whether intf is suspended.  This is not a reliable technique because
that value is owned by the PM core, not by usbcore.  This patch (as718b)
adds a new flag so that we can accurately tell which interfaces are
suspended and which aren't.

At first one might think these flags aren't needed, since interfaces
will be suspended along with their devices.  It turns out there are a
couple of intermediate situations where that's not quite true, such as
while processing a remote-wakeup request.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a8e7c565
...@@ -59,17 +59,17 @@ static inline int is_usb_device_driver(struct device_driver *drv) ...@@ -59,17 +59,17 @@ static inline int is_usb_device_driver(struct device_driver *drv)
static inline void mark_active(struct usb_interface *f) static inline void mark_active(struct usb_interface *f)
{ {
f->dev.power.power_state.event = PM_EVENT_ON; f->is_active = 1;
} }
static inline void mark_quiesced(struct usb_interface *f) static inline void mark_quiesced(struct usb_interface *f)
{ {
f->dev.power.power_state.event = PM_EVENT_FREEZE; f->is_active = 0;
} }
static inline int is_active(struct usb_interface *f) static inline int is_active(struct usb_interface *f)
{ {
return f->dev.power.power_state.event == PM_EVENT_ON; return f->is_active;
} }
......
...@@ -102,6 +102,7 @@ enum usb_interface_condition { ...@@ -102,6 +102,7 @@ enum usb_interface_condition {
* number from the USB core by calling usb_register_dev(). * number from the USB core by calling usb_register_dev().
* @condition: binding state of the interface: not bound, binding * @condition: binding state of the interface: not bound, binding
* (in probe()), bound to a driver, or unbinding (in disconnect()) * (in probe()), bound to a driver, or unbinding (in disconnect())
* @is_active: flag set when the interface is bound and not suspended.
* @dev: driver model's view of this device * @dev: driver model's view of this device
* @class_dev: driver model's class view of this device. * @class_dev: driver model's class view of this device.
* *
...@@ -142,6 +143,8 @@ struct usb_interface { ...@@ -142,6 +143,8 @@ struct usb_interface {
int minor; /* minor number this interface is int minor; /* minor number this interface is
* bound to */ * bound to */
enum usb_interface_condition condition; /* state of binding */ enum usb_interface_condition condition; /* state of binding */
unsigned is_active:1; /* the interface is not suspended */
struct device dev; /* interface specific device info */ struct device dev; /* interface specific device info */
struct class_device *class_dev; struct class_device *class_dev;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment