mm: memcontrol: fix cgroup creation failure after many small jobs
[deliverable/linux.git] / include / linux / mfd / dln2.h
1 #ifndef __LINUX_USB_DLN2_H
2 #define __LINUX_USB_DLN2_H
3
4 #define DLN2_CMD(cmd, id) ((cmd) | ((id) << 8))
5
6 struct dln2_platform_data {
7 u16 handle; /* sub-driver handle (internally used only) */
8 u8 port; /* I2C/SPI port */
9 };
10
11 /**
12 * dln2_event_cb_t - event callback function signature
13 *
14 * @pdev - the sub-device that registered this callback
15 * @echo - the echo header field received in the message
16 * @data - the data payload
17 * @len - the data payload length
18 *
19 * The callback function is called in interrupt context and the data payload is
20 * only valid during the call. If the user needs later access of the data, it
21 * must copy it.
22 */
23
24 typedef void (*dln2_event_cb_t)(struct platform_device *pdev, u16 echo,
25 const void *data, int len);
26
27 /**
28 * dl2n_register_event_cb - register a callback function for an event
29 *
30 * @pdev - the sub-device that registers the callback
31 * @event - the event for which to register a callback
32 * @event_cb - the callback function
33 *
34 * @return 0 in case of success, negative value in case of error
35 */
36 int dln2_register_event_cb(struct platform_device *pdev, u16 event,
37 dln2_event_cb_t event_cb);
38
39 /**
40 * dln2_unregister_event_cb - unregister the callback function for an event
41 *
42 * @pdev - the sub-device that registered the callback
43 * @event - the event for which to register a callback
44 */
45 void dln2_unregister_event_cb(struct platform_device *pdev, u16 event);
46
47 /**
48 * dln2_transfer - issue a DLN2 command and wait for a response and the
49 * associated data
50 *
51 * @pdev - the sub-device which is issuing this transfer
52 * @cmd - the command to be sent to the device
53 * @obuf - the buffer to be sent to the device; it can be NULL if the user
54 * doesn't need to transmit data with this command
55 * @obuf_len - the size of the buffer to be sent to the device
56 * @ibuf - any data associated with the response will be copied here; it can be
57 * NULL if the user doesn't need the response data
58 * @ibuf_len - must be initialized to the input buffer size; it will be modified
59 * to indicate the actual data transferred;
60 *
61 * @return 0 for success, negative value for errors
62 */
63 int dln2_transfer(struct platform_device *pdev, u16 cmd,
64 const void *obuf, unsigned obuf_len,
65 void *ibuf, unsigned *ibuf_len);
66
67 /**
68 * dln2_transfer_rx - variant of @dln2_transfer() where TX buffer is not needed
69 *
70 * @pdev - the sub-device which is issuing this transfer
71 * @cmd - the command to be sent to the device
72 * @ibuf - any data associated with the response will be copied here; it can be
73 * NULL if the user doesn't need the response data
74 * @ibuf_len - must be initialized to the input buffer size; it will be modified
75 * to indicate the actual data transferred;
76 *
77 * @return 0 for success, negative value for errors
78 */
79
80 static inline int dln2_transfer_rx(struct platform_device *pdev, u16 cmd,
81 void *ibuf, unsigned *ibuf_len)
82 {
83 return dln2_transfer(pdev, cmd, NULL, 0, ibuf, ibuf_len);
84 }
85
86 /**
87 * dln2_transfer_tx - variant of @dln2_transfer() where RX buffer is not needed
88 *
89 * @pdev - the sub-device which is issuing this transfer
90 * @cmd - the command to be sent to the device
91 * @obuf - the buffer to be sent to the device; it can be NULL if the
92 * user doesn't need to transmit data with this command
93 * @obuf_len - the size of the buffer to be sent to the device
94 *
95 * @return 0 for success, negative value for errors
96 */
97 static inline int dln2_transfer_tx(struct platform_device *pdev, u16 cmd,
98 const void *obuf, unsigned obuf_len)
99 {
100 return dln2_transfer(pdev, cmd, obuf, obuf_len, NULL, NULL);
101 }
102
103 #endif
This page took 0.031717 seconds and 5 git commands to generate.