1USB_AUTOPM_GET_INTER(9) USB Core APIs USB_AUTOPM_GET_INTER(9)
2
3
4
6 usb_autopm_get_interface - increment a USB interface´s PM-usage counter
7
9 int usb_autopm_get_interface(struct usb_interface * intf);
10
12 intf
13 the usb_interface whose counter should be incremented
14
16 This routine should be called by an interface driver when it wants to
17 use intf and needs to guarantee that it is not suspended. In addition,
18 the routine prevents intf from being autosuspended subsequently. (Note
19 that this will not prevent suspend events originating in the PM core.)
20 This prevention will persist until usb_autopm_put_interface is called
21 or intf is unbound. A typical example would be a character-device
22 driver when its device file is opened.
23
24 The routine increments intf´s usage counter. (However if the autoresume
25 fails then the counter is re-decremented.) So long as the counter is
26 greater than 0, autosuspend will not be allowed for intf or its
27 usb_device. When the driver is finished using intf it should call
28 usb_autopm_put_interface to decrement the usage counter and queue a
29 delayed autosuspend request (if the counter is <= 0).
30
31 Note that intf->pm_usage_cnt is owned by the interface driver. The core
32 will not change its value other than the increment and decrement in
33 usb_autopm_get_interface and usb_autopm_put_interface. The driver may
34 use this simple counter-oriented discipline or may set the value any
35 way it likes.
36
37 Resume method calls generated by this routine can arrive at any time
38 while intf is suspended. They are not protected by the usb_device´s
39 lock but only by its pm_mutex. Drivers must provide their own
40 synchronization.
41
42 This routine can run only in process context.
43
45Kernel Hackers Manual 2.6. June 2019 USB_AUTOPM_GET_INTER(9)