]> xenbits.xensource.com Git - people/aperard/linux.git/commitdiff
virtio: make virtio_bus const
authorRicardo B. Marliere <ricardo@marliere.net>
Sun, 4 Feb 2024 20:52:51 +0000 (17:52 -0300)
committerMichael S. Tsirkin <mst@redhat.com>
Tue, 19 Mar 2024 06:45:50 +0000 (02:45 -0400)
Now that the driver core can properly handle constant struct bus_type,
move the virtio_bus variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
Message-Id: <20240204-bus_cleanup-virtio-v1-1-3bcb2212aaa0@marliere.net>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Jason Wang <jasowang@redhat.com>
drivers/virtio/virtio.c

index f513ee21b1c182fc90859fdb9d0a9b47fc4e9442..f173587893cb34cadbfb4c6e548c158522c7749d 100644 (file)
@@ -353,7 +353,7 @@ static void virtio_dev_remove(struct device *_d)
        of_node_put(dev->dev.of_node);
 }
 
-static struct bus_type virtio_bus = {
+static const struct bus_type virtio_bus = {
        .name  = "virtio",
        .match = virtio_dev_match,
        .dev_groups = virtio_dev_groups,