Thread (36 messages) flat view 36 messages, 6 authors, 2011-10-13

Re: [PATCH V3] input: Fix USB autosuspend on bcm5974

From: Henrik Rydberg <hidden>
Date: 2011-10-12 18:26:19
Subsystem: the rest, usb subsystem · Maintainers: Linus Torvalds, Greg Kroah-Hartman

On Wed, Oct 12, 2011 at 05:59:05PM +0100, Matthew Garrett wrote:
On Wed, Oct 12, 2011 at 06:56:32PM +0200, Oliver Neukum wrote:
quoted
Am Mittwoch, 12. Oktober 2011, 18:16:51 schrieb Matthew Garrett:
quoted
Yeah. Plausibly the model we have in hid is wrong at the moment - rather 
than set flags that block suspend, it might make more sense to take 
references. It'd complicate things a little, in that we'd have to take 
more care in terms of keeping track of the state.
I am afraid references are very hard to take there because it needs to be done
in interrupt.
True. That makes things rather more awkward.
I was looking at usb_autopm_get_interface_no_resume() yesterday for
the same reason, it seemed light-weight enough. No?

Btw, I wonder if the patch below would make sense or if calling put*()
is always a bug at zero usage count.
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 34e3da5..4857e76 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1516,7 +1516,7 @@ void usb_autopm_put_interface_no_suspend(struct usb_interface *intf)
        struct usb_device       *udev = interface_to_usbdev(intf);
 
        usb_mark_last_busy(udev);
-       atomic_dec(&intf->pm_usage_cnt);
+       atomic_add_unless(&intf->pm_usage_cnt, -1, 0);
        pm_runtime_put_noidle(&intf->dev);
 }
 EXPORT_SYMBOL_GPL(usb_autopm_put_interface_no_suspend);

Henrik
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help