Drivers: hv: vmbus: On the read path cleanup the logic to interrupt the host
[linux-2.6/btrfs-unstable.git] / include / linux / mei_cl_bus.h
blob4adb2e7c9f8471648ad580892aa3fd1a558430be
1 #ifndef _LINUX_MEI_CL_BUS_H
2 #define _LINUX_MEI_CL_BUS_H
4 #include <linux/device.h>
5 #include <linux/uuid.h>
6 #include <linux/mod_devicetable.h>
8 struct mei_cl_device;
9 struct mei_device;
11 typedef void (*mei_cldev_event_cb_t)(struct mei_cl_device *cldev,
12 u32 events);
14 /**
15 * struct mei_cl_device - MEI device handle
16 * An mei_cl_device pointer is returned from mei_add_device()
17 * and links MEI bus clients to their actual ME host client pointer.
18 * Drivers for MEI devices will get an mei_cl_device pointer
19 * when being probed and shall use it for doing ME bus I/O.
21 * @bus_list: device on the bus list
22 * @bus: parent mei device
23 * @dev: linux driver model device pointer
24 * @me_cl: me client
25 * @cl: mei client
26 * @name: device name
27 * @event_work: async work to execute event callback
28 * @event_cb: Drivers register this callback to get asynchronous ME
29 * events (e.g. Rx buffer pending) notifications.
30 * @events_mask: Events bit mask requested by driver.
31 * @events: Events bitmask sent to the driver.
33 * @do_match: wheather device can be matched with a driver
34 * @is_added: device is already scanned
35 * @priv_data: client private data
37 struct mei_cl_device {
38 struct list_head bus_list;
39 struct mei_device *bus;
40 struct device dev;
42 struct mei_me_client *me_cl;
43 struct mei_cl *cl;
44 char name[MEI_CL_NAME_SIZE];
46 struct work_struct event_work;
47 mei_cldev_event_cb_t event_cb;
48 unsigned long events_mask;
49 unsigned long events;
51 unsigned int do_match:1;
52 unsigned int is_added:1;
54 void *priv_data;
57 struct mei_cl_driver {
58 struct device_driver driver;
59 const char *name;
61 const struct mei_cl_device_id *id_table;
63 int (*probe)(struct mei_cl_device *cldev,
64 const struct mei_cl_device_id *id);
65 int (*remove)(struct mei_cl_device *cldev);
68 int __mei_cldev_driver_register(struct mei_cl_driver *cldrv,
69 struct module *owner);
70 #define mei_cldev_driver_register(cldrv) \
71 __mei_cldev_driver_register(cldrv, THIS_MODULE)
73 void mei_cldev_driver_unregister(struct mei_cl_driver *cldrv);
75 /**
76 * module_mei_cl_driver - Helper macro for registering mei cl driver
78 * @__mei_cldrv mei_cl_driver structure
80 * Helper macro for mei cl drivers which do not do anything special in module
81 * init/exit, for eliminating a boilerplate code.
83 #define module_mei_cl_driver(__mei_cldrv) \
84 module_driver(__mei_cldrv, \
85 mei_cldev_driver_register,\
86 mei_cldev_driver_unregister)
88 ssize_t mei_cldev_send(struct mei_cl_device *cldev, u8 *buf, size_t length);
89 ssize_t mei_cldev_recv(struct mei_cl_device *cldev, u8 *buf, size_t length);
91 int mei_cldev_register_event_cb(struct mei_cl_device *cldev,
92 unsigned long event_mask,
93 mei_cldev_event_cb_t read_cb);
95 #define MEI_CL_EVENT_RX 0
96 #define MEI_CL_EVENT_TX 1
97 #define MEI_CL_EVENT_NOTIF 2
99 const uuid_le *mei_cldev_uuid(const struct mei_cl_device *cldev);
100 u8 mei_cldev_ver(const struct mei_cl_device *cldev);
102 void *mei_cldev_get_drvdata(const struct mei_cl_device *cldev);
103 void mei_cldev_set_drvdata(struct mei_cl_device *cldev, void *data);
105 int mei_cldev_enable(struct mei_cl_device *cldev);
106 int mei_cldev_disable(struct mei_cl_device *cldev);
107 bool mei_cldev_enabled(struct mei_cl_device *cldev);
109 #endif /* _LINUX_MEI_CL_BUS_H */