summaryrefslogtreecommitdiffstats
path: root/include/linux/virtio.h
diff options
context:
space:
mode:
authorWanlong Gao <gaowanlong@cn.fujitsu.com>2012-12-10 16:38:33 +0800
committerRusty Russell <rusty@rustcorp.com.au>2012-12-18 15:20:43 +1030
commit9a2bdcc85d28506d4e5d4a9618fb133a3f40945d (patch)
treeac571e092d7542a5c5121d25b5f8f02cdfbb7a41 /include/linux/virtio.h
parent9bffdca8c64a72ac54c47a552734ab457bc720d4 (diff)
virtio: add drv_to_virtio to make code clearly
Add drv_to_virtio wrapper to get virtio_driver from device_driver. Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: "Michael S. Tsirkin" <mst@redhat.com> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/virtio.h')
-rw-r--r--include/linux/virtio.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index 5f1f80c7646..cf8adb1f5b2 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -119,6 +119,11 @@ struct virtio_driver {
#endif
};
+static inline struct virtio_driver *drv_to_virtio(struct device_driver *drv)
+{
+ return container_of(drv, struct virtio_driver, driver);
+}
+
int register_virtio_driver(struct virtio_driver *drv);
void unregister_virtio_driver(struct virtio_driver *drv);
#endif /* _LINUX_VIRTIO_H */