diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-01-12 00:14:42 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-01-12 00:14:42 -0500 |
commit | f96fde41f7f9af6cf20f6a1919f5d9670f84d574 (patch) | |
tree | 14b8a0343b255989ac8ba0ea34e18dca419723df /drivers/virtio | |
parent | 5dfc17628d57f9e62043ed0cba03a6e3eb019a78 (diff) |
virtio: rename virtqueue_add_buf_gfp to virtqueue_add_buf
Remove wrapper functions. This makes the allocation type explicit in
all callers; I used GPF_KERNEL where it seemed obvious, left it at
GFP_ATOMIC otherwise.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio_balloon.c | 7 | ||||
-rw-r--r-- | drivers/virtio/virtio_ring.c | 22 |
2 files changed, 15 insertions, 14 deletions
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c index f64ff185b8b5..0a6425aadf95 100644 --- a/drivers/virtio/virtio_balloon.c +++ b/drivers/virtio/virtio_balloon.c | |||
@@ -88,7 +88,7 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq) | |||
88 | init_completion(&vb->acked); | 88 | init_completion(&vb->acked); |
89 | 89 | ||
90 | /* We should always be able to add one buffer to an empty queue. */ | 90 | /* We should always be able to add one buffer to an empty queue. */ |
91 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb) < 0) | 91 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) |
92 | BUG(); | 92 | BUG(); |
93 | virtqueue_kick(vq); | 93 | virtqueue_kick(vq); |
94 | 94 | ||
@@ -220,7 +220,7 @@ static void stats_handle_request(struct virtio_balloon *vb) | |||
220 | 220 | ||
221 | vq = vb->stats_vq; | 221 | vq = vb->stats_vq; |
222 | sg_init_one(&sg, vb->stats, sizeof(vb->stats)); | 222 | sg_init_one(&sg, vb->stats, sizeof(vb->stats)); |
223 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb) < 0) | 223 | if (virtqueue_add_buf(vq, &sg, 1, 0, vb, GFP_KERNEL) < 0) |
224 | BUG(); | 224 | BUG(); |
225 | virtqueue_kick(vq); | 225 | virtqueue_kick(vq); |
226 | } | 226 | } |
@@ -313,7 +313,8 @@ static int virtballoon_probe(struct virtio_device *vdev) | |||
313 | * use it to signal us later. | 313 | * use it to signal us later. |
314 | */ | 314 | */ |
315 | sg_init_one(&sg, vb->stats, sizeof vb->stats); | 315 | sg_init_one(&sg, vb->stats, sizeof vb->stats); |
316 | if (virtqueue_add_buf(vb->stats_vq, &sg, 1, 0, vb) < 0) | 316 | if (virtqueue_add_buf(vb->stats_vq, &sg, 1, 0, vb, GFP_KERNEL) |
317 | < 0) | ||
317 | BUG(); | 318 | BUG(); |
318 | virtqueue_kick(vb->stats_vq); | 319 | virtqueue_kick(vb->stats_vq); |
319 | } | 320 | } |
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index fe50486341a4..6ea92a6d1134 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -167,7 +167,7 @@ static int vring_add_indirect(struct vring_virtqueue *vq, | |||
167 | } | 167 | } |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * virtqueue_add_buf_gfp - expose buffer to other end | 170 | * virtqueue_add_buf - expose buffer to other end |
171 | * @vq: the struct virtqueue we're talking about. | 171 | * @vq: the struct virtqueue we're talking about. |
172 | * @sg: the description of the buffer(s). | 172 | * @sg: the description of the buffer(s). |
173 | * @out_num: the number of sg readable by other side | 173 | * @out_num: the number of sg readable by other side |
@@ -183,12 +183,12 @@ static int vring_add_indirect(struct vring_virtqueue *vq, | |||
183 | * positive return values as "available": indirect buffers mean that | 183 | * positive return values as "available": indirect buffers mean that |
184 | * we can put an entire sg[] array inside a single queue entry. | 184 | * we can put an entire sg[] array inside a single queue entry. |
185 | */ | 185 | */ |
186 | int virtqueue_add_buf_gfp(struct virtqueue *_vq, | 186 | int virtqueue_add_buf(struct virtqueue *_vq, |
187 | struct scatterlist sg[], | 187 | struct scatterlist sg[], |
188 | unsigned int out, | 188 | unsigned int out, |
189 | unsigned int in, | 189 | unsigned int in, |
190 | void *data, | 190 | void *data, |
191 | gfp_t gfp) | 191 | gfp_t gfp) |
192 | { | 192 | { |
193 | struct vring_virtqueue *vq = to_vvq(_vq); | 193 | struct vring_virtqueue *vq = to_vvq(_vq); |
194 | unsigned int i, avail, uninitialized_var(prev); | 194 | unsigned int i, avail, uninitialized_var(prev); |
@@ -259,13 +259,13 @@ add_head: | |||
259 | 259 | ||
260 | return vq->num_free; | 260 | return vq->num_free; |
261 | } | 261 | } |
262 | EXPORT_SYMBOL_GPL(virtqueue_add_buf_gfp); | 262 | EXPORT_SYMBOL_GPL(virtqueue_add_buf); |
263 | 263 | ||
264 | /** | 264 | /** |
265 | * virtqueue_kick - update after add_buf | 265 | * virtqueue_kick - update after add_buf |
266 | * @vq: the struct virtqueue | 266 | * @vq: the struct virtqueue |
267 | * | 267 | * |
268 | * After one or more virtqueue_add_buf_gfp calls, invoke this to kick | 268 | * After one or more virtqueue_add_buf calls, invoke this to kick |
269 | * the other side. | 269 | * the other side. |
270 | * | 270 | * |
271 | * Caller must ensure we don't call this with other virtqueue | 271 | * Caller must ensure we don't call this with other virtqueue |
@@ -341,7 +341,7 @@ static inline bool more_used(const struct vring_virtqueue *vq) | |||
341 | * operations at the same time (except where noted). | 341 | * operations at the same time (except where noted). |
342 | * | 342 | * |
343 | * Returns NULL if there are no used buffers, or the "data" token | 343 | * Returns NULL if there are no used buffers, or the "data" token |
344 | * handed to virtqueue_add_buf_gfp(). | 344 | * handed to virtqueue_add_buf(). |
345 | */ | 345 | */ |
346 | void *virtqueue_get_buf(struct virtqueue *_vq, unsigned int *len) | 346 | void *virtqueue_get_buf(struct virtqueue *_vq, unsigned int *len) |
347 | { | 347 | { |
@@ -490,7 +490,7 @@ EXPORT_SYMBOL_GPL(virtqueue_enable_cb_delayed); | |||
490 | * virtqueue_detach_unused_buf - detach first unused buffer | 490 | * virtqueue_detach_unused_buf - detach first unused buffer |
491 | * @vq: the struct virtqueue we're talking about. | 491 | * @vq: the struct virtqueue we're talking about. |
492 | * | 492 | * |
493 | * Returns NULL or the "data" token handed to virtqueue_add_buf_gfp(). | 493 | * Returns NULL or the "data" token handed to virtqueue_add_buf(). |
494 | * This is not valid on an active queue; it is useful only for device | 494 | * This is not valid on an active queue; it is useful only for device |
495 | * shutdown. | 495 | * shutdown. |
496 | */ | 496 | */ |