summaryrefslogtreecommitdiff
path: root/hw/display
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-05-31 18:35:56 +0200
committerMichael Tokarev <mjt@tls.msk.ru>2016-06-07 18:19:24 +0300
commitd0448de7f661070fad1602218f1b7d211e1c2270 (patch)
tree261f6b33437a52576440ae5e33729470bb59e347 /hw/display
parent207ba7c885c80ddb21a7f2fab8bd053fbc23ac3a (diff)
downloadqemu-d0448de7f661070fad1602218f1b7d211e1c2270.tar.gz
qemu-d0448de7f661070fad1602218f1b7d211e1c2270.tar.bz2
qemu-d0448de7f661070fad1602218f1b7d211e1c2270.zip
xen: Use DIV_ROUND_UP
Replace (((n) + (d) - 1) /(d)) by DIV_ROUND_UP(n,d). This patch is the result of coccinelle script scripts/coccinelle/round.cocci CC: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/display')
-rw-r--r--hw/display/xenfb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index 9866dfda5f..570b0977c3 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -472,9 +472,9 @@ static int xenfb_map_fb(struct XenFB *xenfb)
xenfb->pixels = NULL;
}
- xenfb->fbpages = (xenfb->fb_len + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE;
+ xenfb->fbpages = DIV_ROUND_UP(xenfb->fb_len, XC_PAGE_SIZE);
n_fbdirs = xenfb->fbpages * mode / 8;
- n_fbdirs = (n_fbdirs + (XC_PAGE_SIZE - 1)) / XC_PAGE_SIZE;
+ n_fbdirs = DIV_ROUND_UP(n_fbdirs, XC_PAGE_SIZE);
pgmfns = g_malloc0(sizeof(xen_pfn_t) * n_fbdirs);
fbmfns = g_malloc0(sizeof(xen_pfn_t) * xenfb->fbpages);