diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-05-20 00:15:46 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-05-19 08:45:46 -0400 |
commit | 3425e706bf6faa2965c4e99f39085f7367a8f4e2 (patch) | |
tree | 5c7dbbb262edcaff27ae8bbe299b538bf1dad36f /drivers/char | |
parent | b99fa815d71023b2e330d63cd7f47d6247ffa321 (diff) |
virtio: console: Add a __send_control_msg() that can send messages without a valid port
We will introduce control messages that operate on the device as a whole
rather than just ports. Make send_control_msg() a wrapper around
__send_control_msg() which does not need a valid port.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/virtio_console.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index e53c52b904fb..8c24b86aadc9 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -374,22 +374,22 @@ out: | |||
374 | return ret; | 374 | return ret; |
375 | } | 375 | } |
376 | 376 | ||
377 | static ssize_t send_control_msg(struct port *port, unsigned int event, | 377 | static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id, |
378 | unsigned int value) | 378 | unsigned int event, unsigned int value) |
379 | { | 379 | { |
380 | struct scatterlist sg[1]; | 380 | struct scatterlist sg[1]; |
381 | struct virtio_console_control cpkt; | 381 | struct virtio_console_control cpkt; |
382 | struct virtqueue *vq; | 382 | struct virtqueue *vq; |
383 | unsigned int len; | 383 | unsigned int len; |
384 | 384 | ||
385 | if (!use_multiport(port->portdev)) | 385 | if (!use_multiport(portdev)) |
386 | return 0; | 386 | return 0; |
387 | 387 | ||
388 | cpkt.id = port->id; | 388 | cpkt.id = port_id; |
389 | cpkt.event = event; | 389 | cpkt.event = event; |
390 | cpkt.value = value; | 390 | cpkt.value = value; |
391 | 391 | ||
392 | vq = port->portdev->c_ovq; | 392 | vq = portdev->c_ovq; |
393 | 393 | ||
394 | sg_init_one(sg, &cpkt, sizeof(cpkt)); | 394 | sg_init_one(sg, &cpkt, sizeof(cpkt)); |
395 | if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt) >= 0) { | 395 | if (virtqueue_add_buf(vq, sg, 1, 0, &cpkt) >= 0) { |
@@ -400,6 +400,12 @@ static ssize_t send_control_msg(struct port *port, unsigned int event, | |||
400 | return 0; | 400 | return 0; |
401 | } | 401 | } |
402 | 402 | ||
403 | static ssize_t send_control_msg(struct port *port, unsigned int event, | ||
404 | unsigned int value) | ||
405 | { | ||
406 | return __send_control_msg(port->portdev, port->id, event, value); | ||
407 | } | ||
408 | |||
403 | static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count) | 409 | static ssize_t send_buf(struct port *port, void *in_buf, size_t in_count) |
404 | { | 410 | { |
405 | struct scatterlist sg[1]; | 411 | struct scatterlist sg[1]; |