Commit 93503932 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Rusty Russell

virtio: make config_ops const

It is just a table of function pointers, make it const for cleanliness and security
reasons.
Signed-off-by: default avatarStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 0d34cc2d
...@@ -396,7 +396,7 @@ static const char *lg_bus_name(struct virtio_device *vdev) ...@@ -396,7 +396,7 @@ static const char *lg_bus_name(struct virtio_device *vdev)
} }
/* The ops structure which hooks everything together. */ /* The ops structure which hooks everything together. */
static struct virtio_config_ops lguest_config_ops = { static const struct virtio_config_ops lguest_config_ops = {
.get_features = lg_get_features, .get_features = lg_get_features,
.finalize_features = lg_finalize_features, .finalize_features = lg_finalize_features,
.get = lg_get, .get = lg_get,
......
...@@ -222,7 +222,7 @@ static void rproc_virtio_finalize_features(struct virtio_device *vdev) ...@@ -222,7 +222,7 @@ static void rproc_virtio_finalize_features(struct virtio_device *vdev)
rvdev->gfeatures = vdev->features[0]; rvdev->gfeatures = vdev->features[0];
} }
static struct virtio_config_ops rproc_virtio_config_ops = { static const struct virtio_config_ops rproc_virtio_config_ops = {
.get_features = rproc_virtio_get_features, .get_features = rproc_virtio_get_features,
.finalize_features = rproc_virtio_finalize_features, .finalize_features = rproc_virtio_finalize_features,
.find_vqs = rproc_virtio_find_vqs, .find_vqs = rproc_virtio_find_vqs,
......
...@@ -275,7 +275,7 @@ static const char *kvm_bus_name(struct virtio_device *vdev) ...@@ -275,7 +275,7 @@ static const char *kvm_bus_name(struct virtio_device *vdev)
/* /*
* The config ops structure as defined by virtio config * The config ops structure as defined by virtio config
*/ */
static struct virtio_config_ops kvm_vq_configspace_ops = { static const struct virtio_config_ops kvm_vq_configspace_ops = {
.get_features = kvm_get_features, .get_features = kvm_get_features,
.finalize_features = kvm_finalize_features, .finalize_features = kvm_finalize_features,
.get = kvm_get, .get = kvm_get,
......
...@@ -423,7 +423,7 @@ static const char *vm_bus_name(struct virtio_device *vdev) ...@@ -423,7 +423,7 @@ static const char *vm_bus_name(struct virtio_device *vdev)
return vm_dev->pdev->name; return vm_dev->pdev->name;
} }
static struct virtio_config_ops virtio_mmio_config_ops = { static const struct virtio_config_ops virtio_mmio_config_ops = {
.get = vm_get, .get = vm_get,
.set = vm_set, .set = vm_set,
.get_status = vm_get_status, .get_status = vm_get_status,
......
...@@ -652,7 +652,7 @@ static int vp_set_vq_affinity(struct virtqueue *vq, int cpu) ...@@ -652,7 +652,7 @@ static int vp_set_vq_affinity(struct virtqueue *vq, int cpu)
return 0; return 0;
} }
static struct virtio_config_ops virtio_pci_config_ops = { static const struct virtio_config_ops virtio_pci_config_ops = {
.get = vp_get, .get = vp_get,
.set = vp_set, .set = vp_set,
.get_status = vp_get_status, .get_status = vp_get_status,
......
...@@ -78,7 +78,7 @@ struct virtio_device { ...@@ -78,7 +78,7 @@ struct virtio_device {
int index; int index;
struct device dev; struct device dev;
struct virtio_device_id id; struct virtio_device_id id;
struct virtio_config_ops *config; const struct virtio_config_ops *config;
struct list_head vqs; struct list_head vqs;
/* Note that this is a Linux set_bit-style bitmap. */ /* Note that this is a Linux set_bit-style bitmap. */
unsigned long features[1]; unsigned long features[1];
......
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