]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/virtio/virtio.c
virtio: Formally reserve bits 28-31 to be 'transport' features.
[linux-2.6-omap-h63xx.git] / drivers / virtio / virtio.c
index 0f3c2bb7bf3523ef2987788389c640748f516b39..baf103361e3a2053f255f7f7782f955bd4883320 100644 (file)
@@ -71,13 +71,6 @@ static int virtio_uevent(struct device *_dv, struct kobj_uevent_env *env)
                              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)
 {
        dev->config->set_status(dev, dev->config->get_status(dev) | status);
@@ -120,13 +113,18 @@ static int virtio_dev_probe(struct device *_d)
                        set_bit(f, dev->features);
        }
 
+       /* Transport features are always preserved to pass to set_features. */
+       for (i = VIRTIO_TRANSPORT_F_START; i < VIRTIO_TRANSPORT_F_END; i++)
+               if (device_features & (1 << i))
+                       set_bit(i, dev->features);
+
        err = drv->probe(dev);
        if (err)
                add_status(dev, VIRTIO_CONFIG_S_FAILED);
        else {
-               add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
                /* They should never have set feature bits beyond 32 */
                dev->config->set_features(dev, dev->features[0]);
+               add_status(dev, VIRTIO_CONFIG_S_DRIVER_OK);
        }
        return err;
 }
@@ -147,13 +145,20 @@ static int virtio_dev_remove(struct device *_d)
        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)
 {
        /* Catch this early. */
        BUG_ON(driver->feature_table_size && !driver->feature_table);
        driver->driver.bus = &virtio_bus;
-       driver->driver.probe = virtio_dev_probe;
-       driver->driver.remove = virtio_dev_remove;
        return driver_register(&driver->driver);
 }
 EXPORT_SYMBOL_GPL(register_virtio_driver);