aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/gasket
diff options
context:
space:
mode:
authorMadhumitha Prabakaran <madhumithabiw@gmail.com>2019-04-03 10:06:43 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-16 13:22:50 +0200
commit740a998d58eecf00e0ba7bbe8cf1c0351a91a331 (patch)
tree1f20357f7e971369c819c390c267b46969770633 /drivers/staging/gasket
parentstaging: wilc1000: fix spelling mistake "dissconect" -> "disconnect" (diff)
downloadlinux-dev-740a998d58eecf00e0ba7bbe8cf1c0351a91a331.tar.xz
linux-dev-740a998d58eecf00e0ba7bbe8cf1c0351a91a331.zip
Staging: gasket: Use DIV_ROUND_UP
Use DIV_ROUND_UP in-kernel function to make code simple and more understandable. Issue found using Coccinelle. Signed-off-by: Madhumitha Prabakaran <madhumithabiw@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/gasket')
-rw-r--r--drivers/staging/gasket/gasket_page_table.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c
index 26755d9ca41d..600928f63577 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -768,8 +768,7 @@ static bool gasket_is_extended_dev_addr_bad(struct gasket_page_table *pg_tbl,
page_lvl0_idx = gasket_extended_lvl0_page_idx(pg_tbl, dev_addr);
/* Get the count of affected level 0 pages. */
- num_lvl0_pages = (num_pages + GASKET_PAGES_PER_SUBTABLE - 1) /
- GASKET_PAGES_PER_SUBTABLE;
+ num_lvl0_pages = DIV_ROUND_UP(num_pages, GASKET_PAGES_PER_SUBTABLE);
if (gasket_components_to_dev_address(pg_tbl, 0, page_global_idx,
page_offset) != dev_addr) {
@@ -1258,7 +1257,7 @@ int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size,
dma_addr_t handle;
void *mem;
int j;
- unsigned int num_pages = (size + PAGE_SIZE - 1) / PAGE_SIZE;
+ unsigned int num_pages = DIV_ROUND_UP(size, PAGE_SIZE);
const struct gasket_driver_desc *driver_desc =
gasket_get_driver_desc(gasket_dev);