diff options
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r-- | drivers/block/virtio_blk.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index ba73661fb9f3..e8af52355bf5 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -362,6 +362,18 @@ static void virtblk_config_changed(struct virtio_device *vdev) | |||
362 | queue_work(virtblk_wq, &vblk->config_work); | 362 | queue_work(virtblk_wq, &vblk->config_work); |
363 | } | 363 | } |
364 | 364 | ||
365 | static int init_vq(struct virtio_blk *vblk) | ||
366 | { | ||
367 | int err = 0; | ||
368 | |||
369 | /* We expect one virtqueue, for output. */ | ||
370 | vblk->vq = virtio_find_single_vq(vblk->vdev, blk_done, "requests"); | ||
371 | if (IS_ERR(vblk->vq)) | ||
372 | err = PTR_ERR(vblk->vq); | ||
373 | |||
374 | return err; | ||
375 | } | ||
376 | |||
365 | static int __devinit virtblk_probe(struct virtio_device *vdev) | 377 | static int __devinit virtblk_probe(struct virtio_device *vdev) |
366 | { | 378 | { |
367 | struct virtio_blk *vblk; | 379 | struct virtio_blk *vblk; |
@@ -405,12 +417,9 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
405 | INIT_WORK(&vblk->config_work, virtblk_config_changed_work); | 417 | INIT_WORK(&vblk->config_work, virtblk_config_changed_work); |
406 | vblk->config_enable = true; | 418 | vblk->config_enable = true; |
407 | 419 | ||
408 | /* We expect one virtqueue, for output. */ | 420 | err = init_vq(vblk); |
409 | vblk->vq = virtio_find_single_vq(vdev, blk_done, "requests"); | 421 | if (err) |
410 | if (IS_ERR(vblk->vq)) { | ||
411 | err = PTR_ERR(vblk->vq); | ||
412 | goto out_free_vblk; | 422 | goto out_free_vblk; |
413 | } | ||
414 | 423 | ||
415 | vblk->pool = mempool_create_kmalloc_pool(1,sizeof(struct virtblk_req)); | 424 | vblk->pool = mempool_create_kmalloc_pool(1,sizeof(struct virtblk_req)); |
416 | if (!vblk->pool) { | 425 | if (!vblk->pool) { |