diff options
author | zhong jiang <zhongjiang@huawei.com> | 2018-09-11 21:08:15 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-12 20:34:47 -0700 |
commit | f8a1988f655192ae8ea6e1d940706a8340924bbc (patch) | |
tree | 6204f0a1b89706cc0b513394e74eabae8c369c0d /drivers/net/ethernet/mellanox/mlx4/alloc.c | |
parent | db3df242bc4407ce92fdd0ec429e15bcfb961b00 (diff) |
net: ethernet: Use DIV_ROUND_UP instead of reimplementing its function
DIV_ROUND_UP has implemented the code-opened function. Therefore, just
replace the implementation with DIV_ROUND_UP.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Acked-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/alloc.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/alloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/alloc.c b/drivers/net/ethernet/mellanox/mlx4/alloc.c index 4bdf25059542..deef5a998985 100644 --- a/drivers/net/ethernet/mellanox/mlx4/alloc.c +++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c @@ -614,7 +614,7 @@ int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct, int i; buf->direct.buf = NULL; - buf->nbufs = (size + PAGE_SIZE - 1) / PAGE_SIZE; + buf->nbufs = DIV_ROUND_UP(size, PAGE_SIZE); buf->npages = buf->nbufs; buf->page_shift = PAGE_SHIFT; buf->page_list = kcalloc(buf->nbufs, sizeof(*buf->page_list), |