Skip to content

Commit

Permalink
virtio: make config_ops const
Browse files Browse the repository at this point in the history
It is just a table of function pointers, make it const for cleanliness and security
reasons.

Signed-off-by: Stephen Hemminger <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
shemminger authored and rustyrussell committed Feb 11, 2013
1 parent 0d34cc2 commit 9350393
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/lguest/lguest_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ static const char *lg_bus_name(struct virtio_device *vdev)
}

/* 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,
.finalize_features = lg_finalize_features,
.get = lg_get,
Expand Down
2 changes: 1 addition & 1 deletion drivers/remoteproc/remoteproc_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static void rproc_virtio_finalize_features(struct virtio_device *vdev)
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,
.finalize_features = rproc_virtio_finalize_features,
.find_vqs = rproc_virtio_find_vqs,
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/kvm/kvm_virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ static const char *kvm_bus_name(struct virtio_device *vdev)
/*
* 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,
.finalize_features = kvm_finalize_features,
.get = kvm_get,
Expand Down
2 changes: 1 addition & 1 deletion drivers/virtio/virtio_mmio.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ static const char *vm_bus_name(struct virtio_device *vdev)
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,
.set = vm_set,
.get_status = vm_get_status,
Expand Down
2 changes: 1 addition & 1 deletion drivers/virtio/virtio_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ static int vp_set_vq_affinity(struct virtqueue *vq, int cpu)
return 0;
}

static struct virtio_config_ops virtio_pci_config_ops = {
static const struct virtio_config_ops virtio_pci_config_ops = {
.get = vp_get,
.set = vp_set,
.get_status = vp_get_status,
Expand Down
2 changes: 1 addition & 1 deletion include/linux/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct virtio_device {
int index;
struct device dev;
struct virtio_device_id id;
struct virtio_config_ops *config;
const struct virtio_config_ops *config;
struct list_head vqs;
/* Note that this is a Linux set_bit-style bitmap. */
unsigned long features[1];
Expand Down

0 comments on commit 9350393

Please sign in to comment.