Patchwork [08/10] Compile virtio-serial-bus only once

login
register
mail settings
Submitter Blue Swirl
Date March 26, 2010, 7:04 p.m.
Message ID <f43fc5581003261204k28b8839ag4be24cb62908c50b@mail.gmail.com>
Download mbox | patch
Permalink /patch/48718/
State New
Headers show

Comments

Blue Swirl - March 26, 2010, 7:04 p.m.
Replace access macros with direct accesses.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 Makefile.objs          |    2 +-
 Makefile.target        |    2 +-
 hw/virtio-serial-bus.c |   16 ++++++++--------
 3 files changed, 10 insertions(+), 10 deletions(-)

     virtqueue_push(vq, &elem, len);
@@ -135,8 +135,8 @@ static size_t send_control_event(VirtIOSerialPort
*port, uint16_t event,
 {
     struct virtio_console_control cpkt;

-    stw_p(&cpkt.event, event);
-    stw_p(&cpkt.value, value);
+    cpkt.event = event;
+    cpkt.value = value;

     return send_control_msg(port, &cpkt, sizeof(cpkt));
 }
@@ -208,12 +208,12 @@ static void handle_control_message(VirtIOSerial
*vser, void *buf)
     size_t buffer_len;

     gcpkt = buf;
-    port = find_port_by_id(vser, ldl_p(&gcpkt->id));
+    port = find_port_by_id(vser, gcpkt->id);
     if (!port)
         return;

-    cpkt.event = lduw_p(&gcpkt->event);
-    cpkt.value = lduw_p(&gcpkt->value);
+    cpkt.event = gcpkt->event;
+    cpkt.value = gcpkt->value;

     switch(cpkt.event) {
     case VIRTIO_CONSOLE_PORT_READY:
@@ -229,8 +229,8 @@ static void handle_control_message(VirtIOSerial
*vser, void *buf)
         }

         if (port->name) {
-            stw_p(&cpkt.event, VIRTIO_CONSOLE_PORT_NAME);
-            stw_p(&cpkt.value, 1);
+            cpkt.event = VIRTIO_CONSOLE_PORT_NAME;
+            cpkt.value =1;

             buffer_len = sizeof(cpkt) + strlen(port->name) + 1;
             buffer = qemu_malloc(buffer_len);

Patch

diff --git a/Makefile.objs b/Makefile.objs
index 6498ff7..7973ab2 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -128,7 +128,7 @@  user-obj-y += cutils.o cache-utils.o

 hw-obj-y =
 hw-obj-y += loader.o
-hw-obj-y += virtio.o virtio-console.o virtio-pci.o
+hw-obj-y += virtio.o virtio-console.o virtio-pci.o virtio-serial-bus.o
 hw-obj-y += fw_cfg.o pci.o pci_host.o pcie_host.o
 hw-obj-y += watchdog.o
 hw-obj-$(CONFIG_ISA_MMIO) += isa_mmio.o
diff --git a/Makefile.target b/Makefile.target
index 45c9d40..285c805 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -165,7 +165,7 @@  obj-y = vl.o monitor.o machine.o gdbstub.o
 obj-y += qemu-timer.o
 # virtio has to be here due to weird dependency between PCI and virtio-net.
 # need to fix this properly
-obj-y += virtio-blk.o virtio-balloon.o virtio-net.o virtio-serial-bus.o
+obj-y += virtio-blk.o virtio-balloon.o virtio-net.o
 obj-y += rwhandler.o
 obj-$(CONFIG_KVM) += kvm.o kvm-all.o
 LIBS+=-lz
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 17c1ec1..a1c0964 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -122,7 +122,7 @@  static size_t send_control_msg(VirtIOSerialPort
*port, void *buf, size_t len)
     }

     cpkt = (struct virtio_console_control *)buf;
-    stl_p(&cpkt->id, port->id);
+    cpkt->id = port->id;
     memcpy(elem.in_sg[0].iov_base, buf, len);