mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
virtio_ring: remove a level of indirection
We have a single virtqueue_ops implementation, and it seems unlikely we'll get another one at this point. So let's remove an unnecessary level of indirection: it would be very easy to re-add it if another implementation surfaces. Signed-off-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Rusty Russell <[email protected]>
This commit is contained in:
parent
1915a712f2
commit
7c5e9ed0c8
2 changed files with 34 additions and 73 deletions
|
|
@ -155,11 +155,11 @@ static int vring_add_indirect(struct vring_virtqueue *vq,
|
|||
return head;
|
||||
}
|
||||
|
||||
static int vring_add_buf(struct virtqueue *_vq,
|
||||
struct scatterlist sg[],
|
||||
unsigned int out,
|
||||
unsigned int in,
|
||||
void *data)
|
||||
int virtqueue_add_buf(struct virtqueue *_vq,
|
||||
struct scatterlist sg[],
|
||||
unsigned int out,
|
||||
unsigned int in,
|
||||
void *data)
|
||||
{
|
||||
struct vring_virtqueue *vq = to_vvq(_vq);
|
||||
unsigned int i, avail, head, uninitialized_var(prev);
|
||||
|
|
@ -232,8 +232,9 @@ add_head:
|
|||
return vq->num_free ? vq->vring.num : 0;
|
||||
return vq->num_free;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(virtqueue_add_buf);
|
||||
|
||||
static void vring_kick(struct virtqueue *_vq)
|
||||
void virtqueue_kick(struct virtqueue *_vq)
|
||||
{
|
||||
struct vring_virtqueue *vq = to_vvq(_vq);
|
||||
START_USE(vq);
|
||||
|
|
@ -253,6 +254,7 @@ static void vring_kick(struct virtqueue *_vq)
|
|||
|
||||
END_USE(vq);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(virtqueue_kick);
|
||||
|
||||
static void detach_buf(struct vring_virtqueue *vq, unsigned int head)
|
||||
{
|
||||
|
|
@ -284,7 +286,7 @@ static inline bool more_used(const struct vring_virtqueue *vq)
|
|||
return vq->last_used_idx != vq->vring.used->idx;
|
||||
}
|
||||
|
||||
static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len)
|
||||
void *virtqueue_get_buf(struct virtqueue *_vq, unsigned int *len)
|
||||
{
|
||||
struct vring_virtqueue *vq = to_vvq(_vq);
|
||||
void *ret;
|
||||
|
|
@ -325,15 +327,17 @@ static void *vring_get_buf(struct virtqueue *_vq, unsigned int *len)
|
|||
END_USE(vq);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(virtqueue_get_buf);
|
||||
|
||||
static void vring_disable_cb(struct virtqueue *_vq)
|
||||
void virtqueue_disable_cb(struct virtqueue *_vq)
|
||||
{
|
||||
struct vring_virtqueue *vq = to_vvq(_vq);
|
||||
|
||||
vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(virtqueue_disable_cb);
|
||||
|
||||
static bool vring_enable_cb(struct virtqueue *_vq)
|
||||
bool virtqueue_enable_cb(struct virtqueue *_vq)
|
||||
{
|
||||
struct vring_virtqueue *vq = to_vvq(_vq);
|
||||
|
||||
|
|
@ -351,8 +355,9 @@ static bool vring_enable_cb(struct virtqueue *_vq)
|
|||
END_USE(vq);
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(virtqueue_enable_cb);
|
||||
|
||||
static void *vring_detach_unused_buf(struct virtqueue *_vq)
|
||||
void *virtqueue_detach_unused_buf(struct virtqueue *_vq)
|
||||
{
|
||||
struct vring_virtqueue *vq = to_vvq(_vq);
|
||||
unsigned int i;
|
||||
|
|
@ -375,6 +380,7 @@ static void *vring_detach_unused_buf(struct virtqueue *_vq)
|
|||
END_USE(vq);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(virtqueue_detach_unused_buf);
|
||||
|
||||
irqreturn_t vring_interrupt(int irq, void *_vq)
|
||||
{
|
||||
|
|
@ -396,15 +402,6 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(vring_interrupt);
|
||||
|
||||
static struct virtqueue_ops vring_vq_ops = {
|
||||
.add_buf = vring_add_buf,
|
||||
.get_buf = vring_get_buf,
|
||||
.kick = vring_kick,
|
||||
.disable_cb = vring_disable_cb,
|
||||
.enable_cb = vring_enable_cb,
|
||||
.detach_unused_buf = vring_detach_unused_buf,
|
||||
};
|
||||
|
||||
struct virtqueue *vring_new_virtqueue(unsigned int num,
|
||||
unsigned int vring_align,
|
||||
struct virtio_device *vdev,
|
||||
|
|
@ -429,7 +426,6 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
|
|||
vring_init(&vq->vring, num, pages, vring_align);
|
||||
vq->vq.callback = callback;
|
||||
vq->vq.vdev = vdev;
|
||||
vq->vq.vq_ops = &vring_vq_ops;
|
||||
vq->vq.name = name;
|
||||
vq->notify = notify;
|
||||
vq->broken = false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue