Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8a1988f authored by zhong jiang's avatar zhong jiang Committed by David S. Miller
Browse files

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: default avatarzhong jiang <zhongjiang@huawei.com>
Acked-by: default avatarTariq Toukan <tariqt@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent db3df242
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ enum sbmac_state {
			  (d)->sbdma_dscrtable : (d)->f+1)


#define NUMCACHEBLKS(x) (((x)+SMP_CACHE_BYTES-1)/SMP_CACHE_BYTES)
#define NUMCACHEBLKS(x) DIV_ROUND_UP(x, SMP_CACHE_BYTES)

#define SBMAC_MAX_TXDESCR	256
#define SBMAC_MAX_RXDESCR	256
+1 −1
Original line number Diff line number Diff line
@@ -526,7 +526,7 @@ int octeon_retry_droq_refill(struct octeon_droq *droq)
static inline u32
octeon_droq_get_bufcount(u32 buf_size, u32 total_len)
{
	return ((total_len + buf_size - 1) / buf_size);
	return DIV_ROUND_UP(total_len, buf_size);
}

static int
+1 −1
Original line number Diff line number Diff line
@@ -230,7 +230,7 @@ static unsigned int gfar_usecs2ticks(struct gfar_private *priv,

	/* Make sure we return a number greater than 0
	 * if usecs > 0 */
	return (usecs * 1000 + count - 1) / count;
	return DIV_ROUND_UP(usecs * 1000, count);
}

/* Convert ethernet clock ticks to microseconds */
+1 −1
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ static inline int mal_rx_size(int len)

static inline int mal_tx_chunks(int len)
{
	return (len + MAL_MAX_TX_SIZE - 1) / MAL_MAX_TX_SIZE;
	return DIV_ROUND_UP(len, MAL_MAX_TX_SIZE);
}

#define MAL_CHAN_MASK(n)	(0x80000000 >> (n))
+1 −1
Original line number Diff line number Diff line
@@ -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),
Loading