Skip to content

Commit

Permalink
hw/virtio/virtio-pci: Use pow2ceil() rather than hand-calculation
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pm215 committed Sep 7, 2015
1 parent 9bff5d8 commit 1d0148f
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions hw/virtio/virtio-pci.c
Expand Up @@ -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,
Expand Down

0 comments on commit 1d0148f

Please sign in to comment.