Commit f7ad26ff authored by Stefan Hajnoczi's avatar Stefan Hajnoczi Committed by Michael S. Tsirkin

virtio: make find_vqs() checkpatch.pl-friendly

checkpatch.pl wants arrays of strings declared as follows:

  static const char * const names[] = { "vq-1", "vq-2", "vq-3" };

Currently the find_vqs() function takes a const char *names[] argument
so passing checkpatch.pl's const char * const names[] results in a
compiler error due to losing the second const.

This patch adjusts the find_vqs() prototype and updates all virtio
transports.  This makes it possible for virtio_balloon.c, virtio_input.c,
virtgpu_kms.c, and virtio_rpmsg_bus.c to use the checkpatch.pl-friendly
type.
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarBjorn Andersson <bjorn.andersson@sonymobile.com>
parent 21ea9fb6
...@@ -130,7 +130,7 @@ int virtio_gpu_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -130,7 +130,7 @@ int virtio_gpu_driver_load(struct drm_device *dev, unsigned long flags)
static vq_callback_t *callbacks[] = { static vq_callback_t *callbacks[] = {
virtio_gpu_ctrl_ack, virtio_gpu_cursor_ack virtio_gpu_ctrl_ack, virtio_gpu_cursor_ack
}; };
static const char *names[] = { "control", "cursor" }; static const char * const names[] = { "control", "cursor" };
struct virtio_gpu_device *vgdev; struct virtio_gpu_device *vgdev;
/* this will expand later */ /* this will expand later */
......
...@@ -311,7 +311,7 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev, ...@@ -311,7 +311,7 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev,
static int mic_find_vqs(struct virtio_device *vdev, unsigned nvqs, static int mic_find_vqs(struct virtio_device *vdev, unsigned nvqs,
struct virtqueue *vqs[], struct virtqueue *vqs[],
vq_callback_t *callbacks[], vq_callback_t *callbacks[],
const char *names[]) const char * const names[])
{ {
struct mic_vdev *mvdev = to_micvdev(vdev); struct mic_vdev *mvdev = to_micvdev(vdev);
struct mic_device_ctrl __iomem *dc = mvdev->dc; struct mic_device_ctrl __iomem *dc = mvdev->dc;
......
...@@ -147,7 +147,7 @@ static void rproc_virtio_del_vqs(struct virtio_device *vdev) ...@@ -147,7 +147,7 @@ static void rproc_virtio_del_vqs(struct virtio_device *vdev)
static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs, static int rproc_virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
struct virtqueue *vqs[], struct virtqueue *vqs[],
vq_callback_t *callbacks[], vq_callback_t *callbacks[],
const char *names[]) const char * const names[])
{ {
struct rproc *rproc = vdev_to_rproc(vdev); struct rproc *rproc = vdev_to_rproc(vdev);
int i, ret; int i, ret;
......
...@@ -945,7 +945,7 @@ static void rpmsg_ns_cb(struct rpmsg_channel *rpdev, void *data, int len, ...@@ -945,7 +945,7 @@ static void rpmsg_ns_cb(struct rpmsg_channel *rpdev, void *data, int len,
static int rpmsg_probe(struct virtio_device *vdev) static int rpmsg_probe(struct virtio_device *vdev)
{ {
vq_callback_t *vq_cbs[] = { rpmsg_recv_done, rpmsg_xmit_done }; vq_callback_t *vq_cbs[] = { rpmsg_recv_done, rpmsg_xmit_done };
const char *names[] = { "input", "output" }; static const char * const names[] = { "input", "output" };
struct virtqueue *vqs[2]; struct virtqueue *vqs[2];
struct virtproc_info *vrp; struct virtproc_info *vrp;
void *bufs_va; void *bufs_va;
......
...@@ -255,7 +255,7 @@ static void kvm_del_vqs(struct virtio_device *vdev) ...@@ -255,7 +255,7 @@ static void kvm_del_vqs(struct virtio_device *vdev)
static int kvm_find_vqs(struct virtio_device *vdev, unsigned nvqs, static int kvm_find_vqs(struct virtio_device *vdev, unsigned nvqs,
struct virtqueue *vqs[], struct virtqueue *vqs[],
vq_callback_t *callbacks[], vq_callback_t *callbacks[],
const char *names[]) const char * const names[])
{ {
struct kvm_device *kdev = to_kvmdev(vdev); struct kvm_device *kdev = to_kvmdev(vdev);
int i; int i;
......
...@@ -635,7 +635,7 @@ static int virtio_ccw_register_adapter_ind(struct virtio_ccw_device *vcdev, ...@@ -635,7 +635,7 @@ static int virtio_ccw_register_adapter_ind(struct virtio_ccw_device *vcdev,
static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs, static int virtio_ccw_find_vqs(struct virtio_device *vdev, unsigned nvqs,
struct virtqueue *vqs[], struct virtqueue *vqs[],
vq_callback_t *callbacks[], vq_callback_t *callbacks[],
const char *names[]) const char * const names[])
{ {
struct virtio_ccw_device *vcdev = to_vc_device(vdev); struct virtio_ccw_device *vcdev = to_vc_device(vdev);
unsigned long *indicatorp = NULL; unsigned long *indicatorp = NULL;
......
...@@ -388,7 +388,7 @@ static int init_vqs(struct virtio_balloon *vb) ...@@ -388,7 +388,7 @@ static int init_vqs(struct virtio_balloon *vb)
{ {
struct virtqueue *vqs[3]; struct virtqueue *vqs[3];
vq_callback_t *callbacks[] = { balloon_ack, balloon_ack, stats_request }; vq_callback_t *callbacks[] = { balloon_ack, balloon_ack, stats_request };
const char *names[] = { "inflate", "deflate", "stats" }; static const char * const names[] = { "inflate", "deflate", "stats" };
int err, nvqs; int err, nvqs;
/* /*
......
...@@ -170,7 +170,7 @@ static int virtinput_init_vqs(struct virtio_input *vi) ...@@ -170,7 +170,7 @@ static int virtinput_init_vqs(struct virtio_input *vi)
struct virtqueue *vqs[2]; struct virtqueue *vqs[2];
vq_callback_t *cbs[] = { virtinput_recv_events, vq_callback_t *cbs[] = { virtinput_recv_events,
virtinput_recv_status }; virtinput_recv_status };
static const char *names[] = { "events", "status" }; static const char * const names[] = { "events", "status" };
int err; int err;
err = vi->vdev->config->find_vqs(vi->vdev, 2, vqs, cbs, names); err = vi->vdev->config->find_vqs(vi->vdev, 2, vqs, cbs, names);
......
...@@ -482,7 +482,7 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, unsigned index, ...@@ -482,7 +482,7 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, unsigned index,
static int vm_find_vqs(struct virtio_device *vdev, unsigned nvqs, static int vm_find_vqs(struct virtio_device *vdev, unsigned nvqs,
struct virtqueue *vqs[], struct virtqueue *vqs[],
vq_callback_t *callbacks[], vq_callback_t *callbacks[],
const char *names[]) const char * const names[])
{ {
struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev); struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vdev);
unsigned int irq = platform_get_irq(vm_dev->pdev, 0); unsigned int irq = platform_get_irq(vm_dev->pdev, 0);
......
...@@ -296,7 +296,7 @@ void vp_del_vqs(struct virtio_device *vdev) ...@@ -296,7 +296,7 @@ void vp_del_vqs(struct virtio_device *vdev)
static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs, static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs,
struct virtqueue *vqs[], struct virtqueue *vqs[],
vq_callback_t *callbacks[], vq_callback_t *callbacks[],
const char *names[], const char * const names[],
bool use_msix, bool use_msix,
bool per_vq_vectors) bool per_vq_vectors)
{ {
...@@ -376,7 +376,7 @@ static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs, ...@@ -376,7 +376,7 @@ static int vp_try_to_find_vqs(struct virtio_device *vdev, unsigned nvqs,
int vp_find_vqs(struct virtio_device *vdev, unsigned nvqs, int vp_find_vqs(struct virtio_device *vdev, unsigned nvqs,
struct virtqueue *vqs[], struct virtqueue *vqs[],
vq_callback_t *callbacks[], vq_callback_t *callbacks[],
const char *names[]) const char * const names[])
{ {
int err; int err;
......
...@@ -139,7 +139,7 @@ void vp_del_vqs(struct virtio_device *vdev); ...@@ -139,7 +139,7 @@ void vp_del_vqs(struct virtio_device *vdev);
int vp_find_vqs(struct virtio_device *vdev, unsigned nvqs, int vp_find_vqs(struct virtio_device *vdev, unsigned nvqs,
struct virtqueue *vqs[], struct virtqueue *vqs[],
vq_callback_t *callbacks[], vq_callback_t *callbacks[],
const char *names[]); const char * const names[]);
const char *vp_bus_name(struct virtio_device *vdev); const char *vp_bus_name(struct virtio_device *vdev);
/* Setup the affinity for a virtqueue: /* Setup the affinity for a virtqueue:
......
...@@ -418,7 +418,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev, ...@@ -418,7 +418,7 @@ static struct virtqueue *setup_vq(struct virtio_pci_device *vp_dev,
static int vp_modern_find_vqs(struct virtio_device *vdev, unsigned nvqs, static int vp_modern_find_vqs(struct virtio_device *vdev, unsigned nvqs,
struct virtqueue *vqs[], struct virtqueue *vqs[],
vq_callback_t *callbacks[], vq_callback_t *callbacks[],
const char *names[]) const char * const names[])
{ {
struct virtio_pci_device *vp_dev = to_vp_device(vdev); struct virtio_pci_device *vp_dev = to_vp_device(vdev);
struct virtqueue *vq; struct virtqueue *vq;
......
...@@ -70,7 +70,7 @@ struct virtio_config_ops { ...@@ -70,7 +70,7 @@ struct virtio_config_ops {
int (*find_vqs)(struct virtio_device *, unsigned nvqs, int (*find_vqs)(struct virtio_device *, unsigned nvqs,
struct virtqueue *vqs[], struct virtqueue *vqs[],
vq_callback_t *callbacks[], vq_callback_t *callbacks[],
const char *names[]); const char * const names[]);
void (*del_vqs)(struct virtio_device *); void (*del_vqs)(struct virtio_device *);
u64 (*get_features)(struct virtio_device *vdev); u64 (*get_features)(struct virtio_device *vdev);
int (*finalize_features)(struct virtio_device *vdev); int (*finalize_features)(struct virtio_device *vdev);
......
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