Commit 9350393239153c4a98cbed4d69b9ed81e37d5e74

Authored by Stephen Hemminger
Committed by Rusty Russell
1 parent 0d34cc2d6d

virtio: make config_ops const

It is just a table of function pointers, make it const for cleanliness and security
reasons.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Showing 6 changed files with 6 additions and 6 deletions Side-by-side Diff

drivers/lguest/lguest_device.c
... ... @@ -396,7 +396,7 @@
396 396 }
397 397  
398 398 /* The ops structure which hooks everything together. */
399   -static struct virtio_config_ops lguest_config_ops = {
  399 +static const struct virtio_config_ops lguest_config_ops = {
400 400 .get_features = lg_get_features,
401 401 .finalize_features = lg_finalize_features,
402 402 .get = lg_get,
drivers/remoteproc/remoteproc_virtio.c
... ... @@ -222,7 +222,7 @@
222 222 rvdev->gfeatures = vdev->features[0];
223 223 }
224 224  
225   -static struct virtio_config_ops rproc_virtio_config_ops = {
  225 +static const struct virtio_config_ops rproc_virtio_config_ops = {
226 226 .get_features = rproc_virtio_get_features,
227 227 .finalize_features = rproc_virtio_finalize_features,
228 228 .find_vqs = rproc_virtio_find_vqs,
drivers/s390/kvm/kvm_virtio.c
... ... @@ -275,7 +275,7 @@
275 275 /*
276 276 * The config ops structure as defined by virtio config
277 277 */
278   -static struct virtio_config_ops kvm_vq_configspace_ops = {
  278 +static const struct virtio_config_ops kvm_vq_configspace_ops = {
279 279 .get_features = kvm_get_features,
280 280 .finalize_features = kvm_finalize_features,
281 281 .get = kvm_get,
drivers/virtio/virtio_mmio.c
... ... @@ -423,7 +423,7 @@
423 423 return vm_dev->pdev->name;
424 424 }
425 425  
426   -static struct virtio_config_ops virtio_mmio_config_ops = {
  426 +static const struct virtio_config_ops virtio_mmio_config_ops = {
427 427 .get = vm_get,
428 428 .set = vm_set,
429 429 .get_status = vm_get_status,
drivers/virtio/virtio_pci.c
... ... @@ -652,7 +652,7 @@
652 652 return 0;
653 653 }
654 654  
655   -static struct virtio_config_ops virtio_pci_config_ops = {
  655 +static const struct virtio_config_ops virtio_pci_config_ops = {
656 656 .get = vp_get,
657 657 .set = vp_set,
658 658 .get_status = vp_get_status,
include/linux/virtio.h
... ... @@ -78,7 +78,7 @@
78 78 int index;
79 79 struct device dev;
80 80 struct virtio_device_id id;
81   - struct virtio_config_ops *config;
  81 + const struct virtio_config_ops *config;
82 82 struct list_head vqs;
83 83 /* Note that this is a Linux set_bit-style bitmap. */
84 84 unsigned long features[1];