diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2015-07-24 13:33:08 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2015-09-07 14:19:00 +0100 |
commit | 1d0148fe6c121b21476ac1ba5120f8990e7fe6cd (patch) | |
tree | b397772e8c32a9332e3837e3c0dfb0aa42f0ffc3 /hw | |
parent | 9bff5d8135fc3f37932d4177727d293aa93ce79b (diff) | |
download | qemu-1d0148fe6c121b21476ac1ba5120f8990e7fe6cd.zip |
hw/virtio/virtio-pci: Use pow2ceil() rather than hand-calculation
Use the utility function pow2ceil() for rounding up to the next
largest power of 2, rather than inline calculation.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1437741192-20955-3-git-send-email-peter.maydell@linaro.org
Diffstat (limited to 'hw')
-rw-r--r-- | hw/virtio/virtio-pci.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index c024161f59..43b300f4a3 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1505,9 +1505,7 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) if (legacy) { size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev) + virtio_bus_get_vdev_config_len(bus); - if (size & (size - 1)) { - size = 1 << qemu_fls(size); - } + size = pow2ceil(size); memory_region_init_io(&proxy->bar, OBJECT(proxy), &virtio_pci_config_ops, |