Commit e962fa66 authored by Mark McLoughlin's avatar Mark McLoughlin Committed by Rusty Russell

virtio: Use bus_type probe and remove methods

Hook up to the probe() and remove() methods in bus_type
rather than device_driver. The latter has been preferred
since 2.6.16.
Signed-off-by: default avatarMark McLoughlin <markmc@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 44653eae
...@@ -71,13 +71,6 @@ static int virtio_uevent(struct device *_dv, struct kobj_uevent_env *env) ...@@ -71,13 +71,6 @@ static int virtio_uevent(struct device *_dv, struct kobj_uevent_env *env)
dev->id.device, dev->id.vendor); dev->id.device, dev->id.vendor);
} }
static struct bus_type virtio_bus = {
.name = "virtio",
.match = virtio_dev_match,
.dev_attrs = virtio_dev_attrs,
.uevent = virtio_uevent,
};
static void add_status(struct virtio_device *dev, unsigned status) static void add_status(struct virtio_device *dev, unsigned status)
{ {
dev->config->set_status(dev, dev->config->get_status(dev) | status); dev->config->set_status(dev, dev->config->get_status(dev) | status);
...@@ -147,13 +140,20 @@ static int virtio_dev_remove(struct device *_d) ...@@ -147,13 +140,20 @@ static int virtio_dev_remove(struct device *_d)
return 0; return 0;
} }
static struct bus_type virtio_bus = {
.name = "virtio",
.match = virtio_dev_match,
.dev_attrs = virtio_dev_attrs,
.uevent = virtio_uevent,
.probe = virtio_dev_probe,
.remove = virtio_dev_remove,
};
int register_virtio_driver(struct virtio_driver *driver) int register_virtio_driver(struct virtio_driver *driver)
{ {
/* Catch this early. */ /* Catch this early. */
BUG_ON(driver->feature_table_size && !driver->feature_table); BUG_ON(driver->feature_table_size && !driver->feature_table);
driver->driver.bus = &virtio_bus; driver->driver.bus = &virtio_bus;
driver->driver.probe = virtio_dev_probe;
driver->driver.remove = virtio_dev_remove;
return driver_register(&driver->driver); return driver_register(&driver->driver);
} }
EXPORT_SYMBOL_GPL(register_virtio_driver); EXPORT_SYMBOL_GPL(register_virtio_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment