2017-06-08 21:58:42

by Yueyao Zhu

[permalink] [raw]
Subject: [PATCH 0/3] USB: add API for interface driver to vote for autosuspend

From: Yueyao Zhu <[email protected]>

Currently, if a USB driver would like to enable autosuspend on the USB
device, usb_enable_autosuspend() seems to be the only option. However,
this acts on the device level, and other interfaces might not desire
to autosuspend the USB device.

For example, for the usb digital audio driver to enable autosuspend on
a device, calling usb_enable_autosuspend() from the interface driver
might not be a good idea as the USB device might have a keyboard HID
interface which generally doesn't handle autosupend very well.

This patch series introduces an API for interface driver to vote
for autosuspend on the interface, and when all interfaces agree to
it, autosuspend can then be enabled on the usb device.

Yueyao Zhu (3):
USB: add API for interface driver to vote for autosuspend
HID: usbhid: enable autosuspend for devices whose ...
sound: usb: allow interfaces the driver claims to autosuspend

drivers/hid/usbhid/hid-core.c | 37 +++++++++++++++++++++++++++++
drivers/usb/core/driver.c | 55 +++++++++++++++++++++++++++++++++++++++++++
include/linux/usb.h | 10 ++++++++
sound/usb/card.c | 3 +++
4 files changed, 105 insertions(+)

--
2.13.0.506.g27d5fe0cd-goog


2017-06-08 21:58:44

by Yueyao Zhu

[permalink] [raw]
Subject: [PATCH 1/3] USB: add API for interface driver to vote for autosuspend

From: Yueyao Zhu <[email protected]>

An interface driver can allow/disallow autosuspend power control
for an interface, and if all the interfaces of the active configuration
are allowed for autosuspend, autosuspend should be enabled
on the usb device.

Signed-off-by: Yueyao Zhu <[email protected]>
---
drivers/usb/core/driver.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++
include/linux/usb.h | 10 +++++++++
2 files changed, 65 insertions(+)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index eb87a259d55c..c0a20f03ad01 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1545,6 +1545,61 @@ void usb_disable_autosuspend(struct usb_device *udev)
}
EXPORT_SYMBOL_GPL(usb_disable_autosuspend);

+/**
+ * usb_allow_interface_autosuspend - allow autosuspend for the interface
+ * @intf: the USB interface which may be autosuspended
+ *
+ * This routine votes the interface to allow autosuspend. If all interfaces
+ * of the active configuration of the usb device allow autosuspend, autosuspend
+ * is enabled on the usb device through usb_enable_autosuspend().
+ *
+ * The only interface driver that will enable autosuspend on the
+ * USB device is the last in loop during interface driver probe, or midway
+ * through life if an interface changes its autosuspend status, and all other
+ * interfaces have already said yes.
+ *
+ * The caller must hold @udev's device lock.
+ */
+void usb_allow_interface_autosuspend(struct usb_interface *intf)
+{
+ struct usb_device *udev = interface_to_usbdev(intf);
+ struct usb_host_config *actconfig = udev->actconfig;
+ int i;
+ bool udev_autosuspend = true;
+
+ intf->autosuspend = 1;
+
+ for (i = 0; i < actconfig->desc.bNumInterfaces; ++i) {
+ if (!actconfig->interface[i]->autosuspend) {
+ udev_autosuspend = false;
+ break;
+ }
+ }
+
+ if (udev_autosuspend)
+ usb_enable_autosuspend(udev);
+}
+EXPORT_SYMBOL_GPL(usb_allow_interface_autosuspend);
+
+/**
+ * usb_disallow_interface_autosuspend - disallow autosuspend for the interface
+ * @intf: the USB interface which may not be autosuspended
+ *
+ * This routine votes the interface to disallow autosuspend. This immediately
+ * disables autosuspend on the usb device through usb_enable_autosuspend().
+ *
+ * The caller must hold @udev's device lock.
+ */
+void usb_disallow_interface_autosuspend(struct usb_interface *intf)
+{
+ struct usb_device *udev = interface_to_usbdev(intf);
+
+ intf->autosuspend = 0;
+
+ usb_disable_autosuspend(udev);
+}
+EXPORT_SYMBOL_GPL(usb_disallow_interface_autosuspend);
+
/**
* usb_autosuspend_device - delayed autosuspend of a USB device and its interfaces
* @udev: the usb_device to autosuspend
diff --git a/include/linux/usb.h b/include/linux/usb.h
index cb9fbd54386e..723ab9130637 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -253,6 +253,7 @@ struct usb_interface {
unsigned needs_binding:1; /* needs delayed unbind/rebind */
unsigned resetting_device:1; /* true: bandwidth alloc after reset */
unsigned authorized:1; /* used for interface authorization */
+ unsigned autosuspend:1; /* interface allows autosuspend */

struct device dev; /* interface specific device info */
struct device *usb_dev;
@@ -741,6 +742,9 @@ static inline bool usb_acpi_power_manageable(struct usb_device *hdev, int index)
extern void usb_enable_autosuspend(struct usb_device *udev);
extern void usb_disable_autosuspend(struct usb_device *udev);

+extern void usb_allow_interface_autosuspend(struct usb_interface *intf);
+extern void usb_disallow_interface_autosuspend(struct usb_interface *intf);
+
extern int usb_autopm_get_interface(struct usb_interface *intf);
extern void usb_autopm_put_interface(struct usb_interface *intf);
extern int usb_autopm_get_interface_async(struct usb_interface *intf);
@@ -760,6 +764,12 @@ static inline int usb_enable_autosuspend(struct usb_device *udev)
static inline int usb_disable_autosuspend(struct usb_device *udev)
{ return 0; }

+static inline void usb_allow_interface_autosuspend(struct usb_interface *intf)
+{ }
+static inline void usb_disallow_interface_autosuspend(
+ struct usb_interface *intf)
+{ }
+
static inline int usb_autopm_get_interface(struct usb_interface *intf)
{ return 0; }
static inline int usb_autopm_get_interface_async(struct usb_interface *intf)
--
2.13.0.506.g27d5fe0cd-goog

2017-06-08 21:59:00

by Yueyao Zhu

[permalink] [raw]
Subject: [PATCH 3/3] sound: usb: allow interfaces that the driver claims to autosuspend

From: Yueyao Zhu <[email protected]>

Instead of calling usb_enable_autosuspend() to change the configuration
of a USB device as an interface driver, enable autosuspend for every
interfaces that the driver claims.

Signed-off-by: Yueyao Zhu <[email protected]>
---
sound/usb/card.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 6640277a725b..79bec2883740 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -184,6 +184,7 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
return -EINVAL;
}
usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
+ usb_allow_interface_autosuspend(iface);

return 0;
}
@@ -206,6 +207,7 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
if (! snd_usb_parse_audio_interface(chip, interface)) {
usb_set_interface(dev, interface, 0); /* reset the current interface */
usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
+ usb_allow_interface_autosuspend(iface);
}

return 0;
@@ -618,6 +620,7 @@ static int usb_audio_probe(struct usb_interface *intf,
usb_chip[chip->index] = chip;
chip->num_interfaces++;
usb_set_intfdata(intf, chip);
+ usb_allow_interface_autosuspend(intf);
atomic_dec(&chip->active);
mutex_unlock(&register_mutex);
return 0;
--
2.13.0.506.g27d5fe0cd-goog

2017-06-08 22:04:01

by Yueyao Zhu

[permalink] [raw]
Subject: [PATCH 2/3] HID: usbhid: enable autosuspend for devices whose ...

From: Yueyao Zhu <[email protected]>

usage pages only points to CONSUMER. This allows autosuspend
to be enabled and thus power saved on CONSUMER hid devices.
Yet hid devices use other usage pages are not affected, e.g.
keyboard, mouse.

Signed-off-by: Yueyao Zhu <[email protected]>
---
drivers/hid/usbhid/hid-core.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 83772fa7d92a..f2696b4098b5 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1270,6 +1270,31 @@ static struct hid_ll_driver usb_hid_driver = {
.idle = usbhid_idle,
};

+static bool usbhid_usage_is_consumer(struct hid_device *hid)
+{
+ int i;
+ struct hid_report_enum *input_report_enum =
+ hid->report_enum + HID_INPUT_REPORT;
+ struct list_head *report_list = &input_report_enum->report_list;
+ struct hid_report *report;
+ unsigned int usage_page;
+
+ if (list_empty(report_list))
+ return false;
+
+ list_for_each_entry(report, report_list, list) {
+ for (i = 0; i < report->maxfield; i++) {
+ /* only checks Application field */
+ usage_page =
+ report->field[i]->application & HID_USAGE_PAGE;
+ if (usage_page != HID_UP_CONSUMER)
+ return false;
+ }
+ }
+
+ return true;
+}
+
static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *id)
{
struct usb_host_interface *interface = intf->cur_altsetting;
@@ -1363,6 +1388,18 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
goto err_free;
}

+ /*
+ * Autosuspend interfaces which have only consumer usage page inputs.
+ * This allows autosuspending devices which adhere to the Android USB
+ * headset spec while not autosuspending general keyboards, mice, and
+ * joysticks which may misbehave.
+ */
+ if (usbhid_usage_is_consumer(hid)) {
+ intf->needs_remote_wakeup = true;
+ usb_allow_interface_autosuspend(intf);
+ hid_info(hid, "autosuspend enabled on the hid interface\n");
+ }
+
return 0;
err_free:
kfree(usbhid);
--
2.13.0.506.g27d5fe0cd-goog

2017-06-09 14:50:07

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH 0/3] USB: add API for interface driver to vote for autosuspend

On Thu, 8 Jun 2017, Yueyao Zhu wrote:

> From: Yueyao Zhu <[email protected]>
>
> Currently, if a USB driver would like to enable autosuspend on the USB
> device, usb_enable_autosuspend() seems to be the only option. However,
> this acts on the device level, and other interfaces might not desire
> to autosuspend the USB device.
>
> For example, for the usb digital audio driver to enable autosuspend on
> a device, calling usb_enable_autosuspend() from the interface driver
> might not be a good idea as the USB device might have a keyboard HID
> interface which generally doesn't handle autosupend very well.
>
> This patch series introduces an API for interface driver to vote
> for autosuspend on the interface, and when all interfaces agree to
> it, autosuspend can then be enabled on the usb device.

The whole idea of this seems questionable. USB interface drivers are
generally not supposed to enable or disable autosuspend -- that is a
policy decision left up to userspace. There are a few exceptions for
things like hubs, but this is generally true.

Why should the USB digital audio driver want to enable autosuspend?

Alan Stern

2017-06-10 11:51:18

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 1/3] USB: add API for interface driver to vote for autosuspend

Hi Yueyao,

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on v4.12-rc4 next-20170609]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Yueyao-Zhu/USB-add-API-for-interface-driver-to-vote-for-autosuspend/20170610-172143
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
reproduce: make htmldocs

All warnings (new ones prefixed by >>):

WARNING: convert(1) not found, for SVG to PDF conversion install ImageMagick (https://www.imagemagick.org)
arch/x86/include/asm/uaccess_32.h:1: warning: no structured comments found
include/linux/init.h:1: warning: no structured comments found
include/linux/mod_devicetable.h:686: warning: Excess struct/union/enum/typedef member 'ver_major' description in 'fsl_mc_device_id'
include/linux/mod_devicetable.h:686: warning: Excess struct/union/enum/typedef member 'ver_minor' description in 'fsl_mc_device_id'
kernel/sched/core.c:2088: warning: No description found for parameter 'rf'
kernel/sched/core.c:2088: warning: Excess function parameter 'cookie' description in 'try_to_wake_up_local'
include/linux/kthread.h:26: warning: Excess function parameter '...' description in 'kthread_create'
kernel/sys.c:1: warning: no structured comments found
include/linux/device.h:969: warning: No description found for parameter 'dma_ops'
drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found
include/linux/iio/iio.h:597: warning: No description found for parameter 'trig_readonly'
include/linux/iio/trigger.h:151: warning: No description found for parameter 'indio_dev'
include/linux/iio/trigger.h:151: warning: No description found for parameter 'trig'
include/linux/device.h:970: warning: No description found for parameter 'dma_ops'
include/linux/usb/gadget.h:230: warning: No description found for parameter 'claimed'
include/linux/usb/gadget.h:230: warning: No description found for parameter 'enabled'
include/linux/usb/gadget.h:408: warning: No description found for parameter 'quirk_altset_not_supp'
include/linux/usb/gadget.h:408: warning: No description found for parameter 'quirk_stall_not_supp'
include/linux/usb/gadget.h:408: warning: No description found for parameter 'quirk_zlp_not_supp'
>> include/linux/usb.h:263: warning: No description found for parameter 'autosuspend'
include/drm/drm_drv.h:524: warning: No description found for parameter 'set_busid'
include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_handler'
include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_preinstall'
include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_postinstall'
include/drm/drm_drv.h:524: warning: No description found for parameter 'irq_uninstall'
include/drm/drm_drv.h:524: warning: No description found for parameter 'debugfs_init'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_open_object'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_close_object'
include/drm/drm_drv.h:524: warning: No description found for parameter 'prime_handle_to_fd'
include/drm/drm_drv.h:524: warning: No description found for parameter 'prime_fd_to_handle'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_export'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_import'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_pin'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_unpin'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_res_obj'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_get_sg_table'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_import_sg_table'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_vmap'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_vunmap'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_prime_mmap'
include/drm/drm_drv.h:524: warning: No description found for parameter 'gem_vm_ops'
include/drm/drm_drv.h:524: warning: No description found for parameter 'major'
include/drm/drm_drv.h:524: warning: No description found for parameter 'minor'
include/drm/drm_drv.h:524: warning: No description found for parameter 'patchlevel'
include/drm/drm_drv.h:524: warning: No description found for parameter 'name'
include/drm/drm_drv.h:524: warning: No description found for parameter 'desc'
include/drm/drm_drv.h:524: warning: No description found for parameter 'date'
include/drm/drm_drv.h:524: warning: No description found for parameter 'driver_features'
include/drm/drm_drv.h:524: warning: No description found for parameter 'ioctls'
include/drm/drm_drv.h:524: warning: No description found for parameter 'num_ioctls'
include/drm/drm_drv.h:524: warning: No description found for parameter 'fops'
include/drm/drm_color_mgmt.h:1: warning: no structured comments found
drivers/gpu/drm/drm_plane_helper.c:403: warning: No description found for parameter 'ctx'
drivers/gpu/drm/drm_plane_helper.c:404: warning: No description found for parameter 'ctx'
drivers/gpu/drm/i915/intel_lpe_audio.c:355: warning: No description found for parameter 'dp_output'
drivers/gpu/drm/i915/intel_lpe_audio.c:355: warning: No description found for parameter 'link_rate'
drivers/gpu/drm/i915/intel_lpe_audio.c:356: warning: No description found for parameter 'dp_output'
drivers/gpu/drm/i915/intel_lpe_audio.c:356: warning: No description found for parameter 'link_rate'
Documentation/core-api/assoc_array.rst:13: WARNING: Enumerated list ends without a blank line; unexpected unindent.
Documentation/doc-guide/sphinx.rst:126: ERROR: Unknown target name: "sphinx c domain".
kernel/sched/fair.c:7650: WARNING: Inline emphasis start-string without end-string.
kernel/time/timer.c:1200: ERROR: Unexpected indentation.
kernel/time/timer.c:1202: ERROR: Unexpected indentation.
kernel/time/timer.c:1203: WARNING: Block quote ends without a blank line; unexpected unindent.
include/linux/wait.h:122: WARNING: Block quote ends without a blank line; unexpected unindent.
include/linux/wait.h:125: ERROR: Unexpected indentation.
include/linux/wait.h:127: WARNING: Block quote ends without a blank line; unexpected unindent.
kernel/time/hrtimer.c:990: WARNING: Block quote ends without a blank line; unexpected unindent.
kernel/signal.c:322: WARNING: Inline literal start-string without end-string.
include/linux/iio/iio.h:219: ERROR: Unexpected indentation.
include/linux/iio/iio.h:220: WARNING: Block quote ends without a blank line; unexpected unindent.
include/linux/iio/iio.h:226: WARNING: Definition list ends without a blank line; unexpected unindent.
drivers/iio/industrialio-core.c:638: ERROR: Unknown target name: "iio_val".
drivers/iio/industrialio-core.c:645: ERROR: Unknown target name: "iio_val".
drivers/message/fusion/mptbase.c:5051: WARNING: Definition list ends without a blank line; unexpected unindent.
drivers/tty/serial/serial_core.c:1898: WARNING: Definition list ends without a blank line; unexpected unindent.
drivers/pci/pci.c:3456: ERROR: Unexpected indentation.
include/linux/regulator/driver.h:271: ERROR: Unknown target name: "regulator_regmap_x_voltage".
include/linux/spi/spi.h:370: ERROR: Unexpected indentation.
drivers/gpu/drm/drm_scdc_helper.c:203: ERROR: Unexpected indentation.
drivers/gpu/drm/drm_scdc_helper.c:204: WARNING: Block quote ends without a blank line; unexpected unindent.
drivers/gpu/drm/drm_ioctl.c:690: WARNING: Definition list ends without a blank line; unexpected unindent.
Documentation/gpu/todo.rst:111: ERROR: Unknown target name: "drm_fb".
sound/soc/soc-core.c:2670: ERROR: Unknown target name: "snd_soc_daifmt".
sound/core/jack.c:312: ERROR: Unknown target name: "snd_jack_btn".
Documentation/userspace-api/unshare.rst:108: WARNING: Inline emphasis start-string without end-string.
Documentation/usb/typec.rst:: WARNING: document isn't included in any toctree
Documentation/usb/usb3-debug-port.rst:: WARNING: document isn't included in any toctree
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 69: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 82: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 96: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 109: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 122: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 133: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 164: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/home/kbuild/.config/fontconfig/fonts.conf", line 193: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 43: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "~/.fonts.conf", line 56: Having multiple values in <test> isn't supported and may not work as expected

vim +/autosuspend +263 include/linux/usb.h

^1da177e Linus Torvalds 2005-04-16 247 enum usb_interface_condition condition; /* state of binding */
7e61559f Alan Stern 2007-11-06 248 unsigned sysfs_files_created:1; /* the sysfs attributes exist */
3b23dd6f Alan Stern 2008-12-05 249 unsigned ep_devs_created:1; /* endpoint "devices" exist */
352d0263 Alan Stern 2008-10-29 250 unsigned unregistering:1; /* unregistration is in progress */
645daaab Alan Stern 2006-08-30 251 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
55151d7d Alan Stern 2008-08-12 252 unsigned needs_altsetting0:1; /* switch to altsetting 0 is pending */
78d9a487 Alan Stern 2008-06-23 253 unsigned needs_binding:1; /* needs delayed unbind/rebind */
04a723ea Sarah Sharp 2010-01-06 254 unsigned resetting_device:1; /* true: bandwidth alloc after reset */
4ad2ddce Stefan Koch 2015-08-25 255 unsigned authorized:1; /* used for interface authorization */
cb66a852 Yueyao Zhu 2017-06-08 256 unsigned autosuspend:1; /* interface allows autosuspend */
4d064c08 Alan Stern 2006-07-01 257
^1da177e Linus Torvalds 2005-04-16 258 struct device dev; /* interface specific device info */
969ab2ee Greg Kroah-Hartman 2008-01-30 259 struct device *usb_dev;
ccf5b801 Alan Stern 2009-06-29 260 atomic_t pm_usage_cnt; /* usage counter for autosuspend */
dc023dce Inaky Perez-Gonzalez 2008-11-13 261 struct work_struct reset_ws; /* for resets in atomic context */
^1da177e Linus Torvalds 2005-04-16 262 };
^1da177e Linus Torvalds 2005-04-16 @263 #define to_usb_interface(d) container_of(d, struct usb_interface, dev)
^1da177e Linus Torvalds 2005-04-16 264
^1da177e Linus Torvalds 2005-04-16 265 static inline void *usb_get_intfdata(struct usb_interface *intf)
^1da177e Linus Torvalds 2005-04-16 266 {
^1da177e Linus Torvalds 2005-04-16 267 return dev_get_drvdata(&intf->dev);
^1da177e Linus Torvalds 2005-04-16 268 }
^1da177e Linus Torvalds 2005-04-16 269
^1da177e Linus Torvalds 2005-04-16 270 static inline void usb_set_intfdata(struct usb_interface *intf, void *data)
^1da177e Linus Torvalds 2005-04-16 271 {

:::::: The code at line 263 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <[email protected]>
:::::: CC: Linus Torvalds <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (15.53 kB)
.config.gz (6.48 kB)
Download all attachments