Staging: hv: Eliminate device_id from vm_device
[cascardo/linux.git] / drivers / staging / hv / vmbus.h
1 /*
2  *
3  * Copyright (c) 2009, Microsoft Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16  * Place - Suite 330, Boston, MA 02111-1307 USA.
17  *
18  * Authors:
19  *   Haiyang Zhang <haiyangz@microsoft.com>
20  *   Hank Janssen  <hjanssen@microsoft.com>
21  *
22  */
23
24
25 #ifndef _VMBUS_H_
26 #define _VMBUS_H_
27
28 #include <linux/device.h>
29 #include "vmbus_api.h"
30
31
32 struct vm_device {
33         struct hv_device device_obj;
34         struct device device;
35 };
36
37 static inline struct vm_device *to_vm_device(struct hv_device *d)
38 {
39         return container_of(d, struct vm_device, device_obj);
40 }
41
42 static inline struct vm_device *device_to_vm_device(struct device *d)
43 {
44         return container_of(d, struct vm_device, device);
45 }
46
47 static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d)
48 {
49         return container_of(d, struct hv_driver, driver);
50 }
51
52
53 /* Vmbus interface */
54 int vmbus_child_driver_register(struct device_driver *drv);
55 void vmbus_child_driver_unregister(struct device_driver *drv);
56
57 extern struct completion hv_channel_ready;
58
59 #endif /* _VMBUS_H_ */