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>
This commit is contained in:
parent
207ba7c885
commit
d0448de7f6
@ -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);
|
||||
|
@ -567,7 +567,7 @@ static void xen_sync_dirty_bitmap(XenIOState *state,
|
||||
{
|
||||
hwaddr npages = size >> TARGET_PAGE_BITS;
|
||||
const int width = sizeof(unsigned long) * 8;
|
||||
unsigned long bitmap[(npages + width - 1) / width];
|
||||
unsigned long bitmap[DIV_ROUND_UP(npages, width)];
|
||||
int rc, i, j;
|
||||
const XenPhysmap *physmap = NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user