summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2017-04-05 09:23:04 -0400
committerJonathan Corbet <corbet@lwn.net>2017-04-11 16:39:08 -0400
commit3b38e4f21868d83ed03d5d101c789c4df2b08e8b (patch)
treeb7d31f5766ba2509784e33d738447868f8d73236
parent401c7be2bad9eea68c1a660d54d1caa00b3098e4 (diff)
usb/callbacks.txt: convert to ReST and add to driver-api book
This document describe some USB core functions. Add it to the driver-api book. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rw-r--r--Documentation/driver-api/usb/callbacks.rst (renamed from Documentation/usb/callbacks.txt)61
-rw-r--r--Documentation/driver-api/usb/index.rst1
2 files changed, 43 insertions, 19 deletions
diff --git a/Documentation/usb/callbacks.txt b/Documentation/driver-api/usb/callbacks.rst
index 9e85846bdb98..93a8d53e27e7 100644
--- a/Documentation/usb/callbacks.txt
+++ b/Documentation/driver-api/usb/callbacks.rst
@@ -1,3 +1,6 @@
1USB core callbacks
2~~~~~~~~~~~~~~~~~~
3
1What callbacks will usbcore do? 4What callbacks will usbcore do?
2=============================== 5===============================
3 6
@@ -11,30 +14,42 @@ The callbacks defined in the driver structure are:
11 14
121. Hotplugging callbacks: 151. Hotplugging callbacks:
13 16
14 * @probe: Called to see if the driver is willing to manage a particular 17 - @probe:
15 * interface on a device. 18 Called to see if the driver is willing to manage a particular
16 * @disconnect: Called when the interface is no longer accessible, usually 19 interface on a device.
17 * because its device has been (or is being) disconnected or the 20
18 * driver module is being unloaded. 21 - @disconnect:
22 Called when the interface is no longer accessible, usually
23 because its device has been (or is being) disconnected or the
24 driver module is being unloaded.
19 25
202. Odd backdoor through usbfs: 262. Odd backdoor through usbfs:
21 27
22 * @ioctl: Used for drivers that want to talk to userspace through 28 - @ioctl:
23 * the "usbfs" filesystem. This lets devices provide ways to 29 Used for drivers that want to talk to userspace through
24 * expose information to user space regardless of where they 30 the "usbfs" filesystem. This lets devices provide ways to
25 * do (or don't) show up otherwise in the filesystem. 31 expose information to user space regardless of where they
32 do (or don't) show up otherwise in the filesystem.
26 33
273. Power management (PM) callbacks: 343. Power management (PM) callbacks:
28 35
29 * @suspend: Called when the device is going to be suspended. 36 - @suspend:
30 * @resume: Called when the device is being resumed. 37 Called when the device is going to be suspended.
31 * @reset_resume: Called when the suspended device has been reset instead 38
32 * of being resumed. 39 - @resume:
40 Called when the device is being resumed.
41
42 - @reset_resume:
43 Called when the suspended device has been reset instead
44 of being resumed.
33 45
344. Device level operations: 464. Device level operations:
35 47
36 * @pre_reset: Called when the device is about to be reset. 48 - @pre_reset:
37 * @post_reset: Called after the device has been reset 49 Called when the device is about to be reset.
50
51 - @post_reset:
52 Called after the device has been reset
38 53
39The ioctl interface (2) should be used only if you have a very good 54The ioctl interface (2) should be used only if you have a very good
40reason. Sysfs is preferred these days. The PM callbacks are covered 55reason. Sysfs is preferred these days. The PM callbacks are covered
@@ -58,7 +73,9 @@ an interface. A driver's bond to an interface is exclusive.
58The probe() callback 73The probe() callback
59-------------------- 74--------------------
60 75
61int (*probe) (struct usb_interface *intf, 76::
77
78 int (*probe) (struct usb_interface *intf,
62 const struct usb_device_id *id); 79 const struct usb_device_id *id);
63 80
64Accept or decline an interface. If you accept the device return 0, 81Accept or decline an interface. If you accept the device return 0,
@@ -75,7 +92,9 @@ initialisation that doesn't take too long is a good idea here.
75The disconnect() callback 92The disconnect() callback
76------------------------- 93-------------------------
77 94
78void (*disconnect) (struct usb_interface *intf); 95::
96
97 void (*disconnect) (struct usb_interface *intf);
79 98
80This callback is a signal to break any connection with an interface. 99This callback is a signal to break any connection with an interface.
81You are not allowed any IO to a device after returning from this 100You are not allowed any IO to a device after returning from this
@@ -93,7 +112,9 @@ Device level callbacks
93pre_reset 112pre_reset
94--------- 113---------
95 114
96int (*pre_reset)(struct usb_interface *intf); 115::
116
117 int (*pre_reset)(struct usb_interface *intf);
97 118
98A driver or user space is triggering a reset on the device which 119A driver or user space is triggering a reset on the device which
99contains the interface passed as an argument. Cease IO, wait for all 120contains the interface passed as an argument. Cease IO, wait for all
@@ -107,7 +128,9 @@ are in atomic context.
107post_reset 128post_reset
108---------- 129----------
109 130
110int (*post_reset)(struct usb_interface *intf); 131::
132
133 int (*post_reset)(struct usb_interface *intf);
111 134
112The reset has completed. Restore any saved device state and begin 135The reset has completed. Restore any saved device state and begin
113using the device again. 136using the device again.
diff --git a/Documentation/driver-api/usb/index.rst b/Documentation/driver-api/usb/index.rst
index 6fe7611f7332..441c5dacdf27 100644
--- a/Documentation/driver-api/usb/index.rst
+++ b/Documentation/driver-api/usb/index.rst
@@ -8,6 +8,7 @@ Linux USB API
8 gadget 8 gadget
9 anchors 9 anchors
10 bulk-streams 10 bulk-streams
11 callbacks
11 writing_usb_driver 12 writing_usb_driver
12 writing_musb_glue_layer 13 writing_musb_glue_layer
13 14