1USB_SG_INIT(9) USB Core APIs USB_SG_INIT(9)
2
3
4
6 usb_sg_init - initializes scatterlist-based bulk/interrupt I/O request
7
9 int usb_sg_init(struct usb_sg_request * io, struct usb_device * dev,
10 unsigned pipe, unsigned period,
11 struct scatterlist * sg, int nents, size_t length,
12 gfp_t mem_flags);
13
15 io
16 request block being initialized. until usb_sg_wait returns, treat
17 this as a pointer to an opaque block of memory,
18
19 dev
20 the usb device that will send or receive the data
21
22 pipe
23 endpoint “pipe” used to transfer the data
24
25 period
26 polling rate for interrupt endpoints, in frames or (for high speed
27 endpoints) microframes; ignored for bulk
28
29 sg
30 scatterlist entries
31
32 nents
33 how many entries in the scatterlist
34
35 length
36 how many bytes to send from the scatterlist, or zero to send every
37 byte identified in the list.
38
39 mem_flags
40 SLAB_* flags affecting memory allocations in this call
41
43 Returns zero for success, else a negative errno value. This initializes
44 a scatter/gather request, allocating resources such as I/O mappings and
45 urb memory (except maybe memory used by USB controller drivers).
46
47 The request must be issued using usb_sg_wait, which waits for the I/O
48 to complete (or to be canceled) and then cleans up all resources
49 allocated by usb_sg_init.
50
51 The request may be canceled with usb_sg_cancel, either before or after
52 usb_sg_wait is called.
53
55Kernel Hackers Manual 2.6. June 2019 USB_SG_INIT(9)