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:

committed by
Rusty Russell

parent
9bffdca8c6
commit
9a2bdcc85d
@@ -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 */
|
||||
|
Reference in New Issue
Block a user