diff options
author | Wanlong Gao | 2012-12-10 16:38:33 +0800 |
---|---|---|
committer | Rusty Russell | 2012-12-18 15:20:43 +1030 |
commit | 9a2bdcc85d28506d4e5d4a9618fb133a3f40945d (patch) | |
tree | ac571e092d7542a5c5121d25b5f8f02cdfbb7a41 /include/linux | |
parent | 9bffdca8c64a72ac54c47a552734ab457bc720d4 (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')
-rw-r--r-- | include/linux/virtio.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h index 5f1f80c76468..cf8adb1f5b2c 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 */ |