aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/virtio
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/virtio')
-rw-r--r--drivers/virtio/virtio.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 15d7787dea87..69d7ea02cd48 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -96,10 +96,23 @@ static int virtio_dev_probe(struct device *_d)
96 return err; 96 return err;
97} 97}
98 98
99static int virtio_dev_remove(struct device *_d)
100{
101 struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
102 struct virtio_driver *drv = container_of(dev->dev.driver,
103 struct virtio_driver, driver);
104
105 dev->config->set_status(dev, dev->config->get_status(dev)
106 & ~VIRTIO_CONFIG_S_DRIVER);
107 drv->remove(dev);
108 return 0;
109}
110
99int register_virtio_driver(struct virtio_driver *driver) 111int register_virtio_driver(struct virtio_driver *driver)
100{ 112{
101 driver->driver.bus = &virtio_bus; 113 driver->driver.bus = &virtio_bus;
102 driver->driver.probe = virtio_dev_probe; 114 driver->driver.probe = virtio_dev_probe;
115 driver->driver.remove = virtio_dev_remove;
103 return driver_register(&driver->driver); 116 return driver_register(&driver->driver);
104} 117}
105EXPORT_SYMBOL_GPL(register_virtio_driver); 118EXPORT_SYMBOL_GPL(register_virtio_driver);