mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
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>
This commit is contained in:
parent
e2e89d4a73
commit
740a998d58
1 changed files with 2 additions and 3 deletions
|
@ -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);
|
page_lvl0_idx = gasket_extended_lvl0_page_idx(pg_tbl, dev_addr);
|
||||||
|
|
||||||
/* Get the count of affected level 0 pages. */
|
/* Get the count of affected level 0 pages. */
|
||||||
num_lvl0_pages = (num_pages + GASKET_PAGES_PER_SUBTABLE - 1) /
|
num_lvl0_pages = DIV_ROUND_UP(num_pages, GASKET_PAGES_PER_SUBTABLE);
|
||||||
GASKET_PAGES_PER_SUBTABLE;
|
|
||||||
|
|
||||||
if (gasket_components_to_dev_address(pg_tbl, 0, page_global_idx,
|
if (gasket_components_to_dev_address(pg_tbl, 0, page_global_idx,
|
||||||
page_offset) != dev_addr) {
|
page_offset) != dev_addr) {
|
||||||
|
@ -1258,7 +1257,7 @@ int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size,
|
||||||
dma_addr_t handle;
|
dma_addr_t handle;
|
||||||
void *mem;
|
void *mem;
|
||||||
int j;
|
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 =
|
const struct gasket_driver_desc *driver_desc =
|
||||||
gasket_get_driver_desc(gasket_dev);
|
gasket_get_driver_desc(gasket_dev);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue