aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-20 11:37:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-20 11:37:05 -0500
commitb7dfde956daee23f4439d0c8562a5e38b43e79d9 (patch)
tree2ed71fb5c5eac6957fd1e1ad0a67be6c3282167a /drivers/scsi
parent03c850ec327c42a97e44c448b75983e12da417d9 (diff)
parent1b6370463e88b0c1c317de16d7b962acc1dab4f2 (diff)
Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux
Pull virtio update from Rusty Russell: "Some nice cleanups, and even a patch my wife did as a "live" demo for Latinoware 2012. There's a slightly non-trivial merge in virtio-net, as we cleaned up the virtio add_buf interface while DaveM accepted the mq virtio-net patches." * tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (27 commits) virtio_console: Add support for remoteproc serial virtio_console: Merge struct buffer_token into struct port_buffer virtio: add drv_to_virtio to make code clearly virtio: use dev_to_virtio wrapper in virtio virtio-mmio: Fix irq parsing in command line parameter virtio_console: Free buffers from out-queue upon close virtio: Convert dev_printk(KERN_<LEVEL> to dev_<level>( virtio_console: Use kmalloc instead of kzalloc virtio_console: Free buffer if splice fails virtio: tools: make it clear that virtqueue_add_buf() no longer returns > 0 virtio: scsi: make it clear that virtqueue_add_buf() no longer returns > 0 virtio: rpmsg: make it clear that virtqueue_add_buf() no longer returns > 0 virtio: net: make it clear that virtqueue_add_buf() no longer returns > 0 virtio: console: make it clear that virtqueue_add_buf() no longer returns > 0 virtio: make virtqueue_add_buf() returning 0 on success, not capacity. virtio: console: don't rely on virtqueue_add_buf() returning capacity. virtio_net: don't rely on virtqueue_add_buf() returning capacity. virtio-net: remove unused skb_vnet_hdr->num_sg field virtio-net: correct capacity math on ring full virtio: move queue_index and num_free fields into core struct virtqueue. ...
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/virtio_scsi.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index dd8dc27fa32c..74ab67a169ec 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -215,7 +215,7 @@ static void virtscsi_ctrl_done(struct virtqueue *vq)
215static int virtscsi_kick_event(struct virtio_scsi *vscsi, 215static int virtscsi_kick_event(struct virtio_scsi *vscsi,
216 struct virtio_scsi_event_node *event_node) 216 struct virtio_scsi_event_node *event_node)
217{ 217{
218 int ret; 218 int err;
219 struct scatterlist sg; 219 struct scatterlist sg;
220 unsigned long flags; 220 unsigned long flags;
221 221
@@ -223,13 +223,14 @@ static int virtscsi_kick_event(struct virtio_scsi *vscsi,
223 223
224 spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags); 224 spin_lock_irqsave(&vscsi->event_vq.vq_lock, flags);
225 225
226 ret = virtqueue_add_buf(vscsi->event_vq.vq, &sg, 0, 1, event_node, GFP_ATOMIC); 226 err = virtqueue_add_buf(vscsi->event_vq.vq, &sg, 0, 1, event_node,
227 if (ret >= 0) 227 GFP_ATOMIC);
228 if (!err)
228 virtqueue_kick(vscsi->event_vq.vq); 229 virtqueue_kick(vscsi->event_vq.vq);
229 230
230 spin_unlock_irqrestore(&vscsi->event_vq.vq_lock, flags); 231 spin_unlock_irqrestore(&vscsi->event_vq.vq_lock, flags);
231 232
232 return ret; 233 return err;
233} 234}
234 235
235static int virtscsi_kick_event_all(struct virtio_scsi *vscsi) 236static int virtscsi_kick_event_all(struct virtio_scsi *vscsi)
@@ -410,22 +411,23 @@ static int virtscsi_kick_cmd(struct virtio_scsi_target_state *tgt,
410{ 411{
411 unsigned int out_num, in_num; 412 unsigned int out_num, in_num;
412 unsigned long flags; 413 unsigned long flags;
413 int ret; 414 int err;
415 bool needs_kick = false;
414 416
415 spin_lock_irqsave(&tgt->tgt_lock, flags); 417 spin_lock_irqsave(&tgt->tgt_lock, flags);
416 virtscsi_map_cmd(tgt, cmd, &out_num, &in_num, req_size, resp_size); 418 virtscsi_map_cmd(tgt, cmd, &out_num, &in_num, req_size, resp_size);
417 419
418 spin_lock(&vq->vq_lock); 420 spin_lock(&vq->vq_lock);
419 ret = virtqueue_add_buf(vq->vq, tgt->sg, out_num, in_num, cmd, gfp); 421 err = virtqueue_add_buf(vq->vq, tgt->sg, out_num, in_num, cmd, gfp);
420 spin_unlock(&tgt->tgt_lock); 422 spin_unlock(&tgt->tgt_lock);
421 if (ret >= 0) 423 if (!err)
422 ret = virtqueue_kick_prepare(vq->vq); 424 needs_kick = virtqueue_kick_prepare(vq->vq);
423 425
424 spin_unlock_irqrestore(&vq->vq_lock, flags); 426 spin_unlock_irqrestore(&vq->vq_lock, flags);
425 427
426 if (ret > 0) 428 if (needs_kick)
427 virtqueue_notify(vq->vq); 429 virtqueue_notify(vq->vq);
428 return ret; 430 return err;
429} 431}
430 432
431static int virtscsi_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc) 433static int virtscsi_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc)
@@ -467,7 +469,7 @@ static int virtscsi_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc)
467 469
468 if (virtscsi_kick_cmd(tgt, &vscsi->req_vq, cmd, 470 if (virtscsi_kick_cmd(tgt, &vscsi->req_vq, cmd,
469 sizeof cmd->req.cmd, sizeof cmd->resp.cmd, 471 sizeof cmd->req.cmd, sizeof cmd->resp.cmd,
470 GFP_ATOMIC) >= 0) 472 GFP_ATOMIC) == 0)
471 ret = 0; 473 ret = 0;
472 else 474 else
473 mempool_free(cmd, virtscsi_cmd_pool); 475 mempool_free(cmd, virtscsi_cmd_pool);