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>
This commit is contained in:
Wanlong Gao
2012-12-10 16:38:33 +08:00
committed by Rusty Russell
parent 9bffdca8c6
commit 9a2bdcc85d
2 changed files with 9 additions and 7 deletions

View File

@@ -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 */