From: Matthew Garrett <mjg@redhat.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: alan-jenkins@tuffmail.co.uk,
Pekka Enberg <penberg@cs.helsinki.fi>,
Corentin Chary <corentin.chary@gmail.com>,
acpi4asus-user@lists.sourceforge.net, len.brown@intel.com,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
Darren Salt <linux@youmustbejoking.demon.co.uk>
Subject: Re: [PATCH] eeepc-laptop: enable camera by default
Date: Mon, 8 Jun 2009 16:00:39 +0100 [thread overview]
Message-ID: <20090608150039.GB17579@srcf.ucam.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0906072309560.28801-100000@netrider.rowland.org>
On Sun, Jun 07, 2009 at 11:10:52PM -0400, Alan Stern wrote:
> On Mon, 8 Jun 2009, Matthew Garrett wrote:
>
> > On Sun, Jun 07, 2009 at 11:03:48PM -0400, Alan Stern wrote:
> >
> > > There's no mechanism for this. It many environments it couldn't work,
> > > because the decision about whether to enable autosuspend is made when
> > > the device is first created (i.e., when the creation uevent is
> > > received), whereas driver binding doesn't occur until later.
> >
> > There's a lot of power management situations where you don't end up with
> > the optimal power configuration until a driver's bound. It's certainly
> > possible to do this in userspace, but if we know that the hardware
> > supported by a given driver will always work then it seems reasonable to
> > have it whitelist autosuspend on that device.
>
> Sure. Such a thing could be added easily enough. It just doesn't
> exist now, that's all.
Something roughly like this? We'd probably also want a function call so
drivers can do it based on the ID of the device they're handling, but in
some cases we can probably assume that all devices supported by the
driver will work.
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index d0a21a5..36f63a7 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -355,6 +355,8 @@ int usb_driver_claim_interface(struct usb_driver *driver,
iface->condition = USB_INTERFACE_BOUND;
mark_active(iface);
iface->pm_usage_cnt = !(driver->supports_autosuspend);
+ if (driver->supports_autosuspend && driver->enable_autosuspend)
+ udev->autosuspend_disabled=0;
usb_pm_unlock(udev);
/* if interface was already added, bind now; else let
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 3aa2cd1..b4696f2 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -819,6 +819,8 @@ struct usbdrv_wrap {
* added to this driver by preventing the sysfs file from being created.
* @supports_autosuspend: if set to 0, the USB core will not allow autosuspend
* for interfaces bound to this driver.
+ * @enable_autosuspend: if set to 1, the USB core will automatically enable
+ * autosuspend for interfaces bound to this driver.
* @soft_unbind: if set to 1, the USB core will not kill URBs and disable
* endpoints before calling the driver's disconnect method.
*
@@ -861,6 +863,7 @@ struct usb_driver {
struct usbdrv_wrap drvwrap;
unsigned int no_dynamic_id:1;
unsigned int supports_autosuspend:1;
+ unsigned int enable_autosuspend:1;
unsigned int soft_unbind:1;
};
#define to_usb_driver(d) container_of(d, struct usb_driver, drvwrap.driver)
--
Matthew Garrett | mjg59@srcf.ucam.org
next prev parent reply other threads:[~2009-06-08 15:00 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-05 8:59 [PATCH] eeepc-laptop: enable camera by default Pekka J Enberg
2009-06-05 11:46 ` Corentin Chary
2009-06-05 12:44 ` Pekka Enberg
2009-06-05 13:02 ` Corentin Chary
2009-06-05 13:39 ` Alan Jenkins
2009-06-05 13:51 ` Pekka Enberg
2009-06-05 13:54 ` Pekka Enberg
2009-06-05 13:58 ` Corentin Chary
2009-06-05 14:38 ` Alan Jenkins
2009-06-05 14:50 ` Pekka Enberg
2009-06-05 14:55 ` Alan Jenkins
2009-06-05 15:08 ` Alan Jenkins
2009-06-05 15:14 ` Pekka Enberg
2009-06-07 14:54 ` Darren Salt
2009-06-07 15:41 ` Alan Jenkins
2009-06-07 23:28 ` Matthew Garrett
2009-06-08 3:03 ` Alan Stern
2009-06-08 3:07 ` Matthew Garrett
2009-06-08 3:10 ` Alan Stern
2009-06-08 15:00 ` Matthew Garrett [this message]
2009-06-08 20:44 ` Alan Stern
2009-06-05 15:13 ` Alan Stern
2009-06-05 15:22 ` Pekka Enberg
2009-06-05 21:01 ` Woody Suwalski
2009-06-06 7:12 ` Corentin Chary
2009-06-06 8:04 ` Alan Jenkins
2009-06-05 20:08 ` Andrew Morton
2009-06-06 7:25 ` Corentin Chary
2009-06-06 7:31 ` Andrew Morton
2009-06-06 7:52 ` Corentin Chary
2009-06-06 9:17 ` Pekka Enberg
2009-06-06 10:17 ` Corentin Chary
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090608150039.GB17579@srcf.ucam.org \
--to=mjg@redhat.com \
--cc=acpi4asus-user@lists.sourceforge.net \
--cc=alan-jenkins@tuffmail.co.uk \
--cc=corentin.chary@gmail.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@youmustbejoking.demon.co.uk \
--cc=penberg@cs.helsinki.fi \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox