mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-03 23:58:05 +00:00
staging: vc04_services: Using macro DIV_ROUND_UP
The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This occurence was detected using the coccinelle script: @@ expression e1; expression e2; @@ ( - ((e1) + e2 - 1) / (e2) + DIV_ROUND_UP(e1,e2) | - ((e1) + (e2 - 1)) / (e2) + DIV_ROUND_UP(e1,e2) ) Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
6e475350a4
commit
0169acaea5
2 changed files with 2 additions and 2 deletions
|
@ -408,7 +408,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type,
|
|||
dma_addr_t dma_addr;
|
||||
|
||||
offset = ((unsigned int)(unsigned long)buf & (PAGE_SIZE - 1));
|
||||
num_pages = (count + offset + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
num_pages = DIV_ROUND_UP(count + offset, PAGE_SIZE);
|
||||
|
||||
pagelist_size = sizeof(PAGELIST_T) +
|
||||
(num_pages * sizeof(u32)) +
|
||||
|
|
|
@ -1587,7 +1587,7 @@ dump_phys_mem(void *virt_addr, u32 num_bytes)
|
|||
offset = (int)(long)virt_addr & (PAGE_SIZE - 1);
|
||||
end_offset = (int)(long)end_virt_addr & (PAGE_SIZE - 1);
|
||||
|
||||
num_pages = (offset + num_bytes + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
num_pages = DIV_ROUND_UP(offset + num_bytes, PAGE_SIZE);
|
||||
|
||||
pages = kmalloc(sizeof(struct page *) * num_pages, GFP_KERNEL);
|
||||
if (pages == NULL) {
|
||||
|
|
Loading…
Reference in a new issue