Commit c40cf519 authored by Ilpo Järvinen's avatar Ilpo Järvinen Committed by David S. Miller

hp100: use roundup instead of open coding

Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 82ad3329
...@@ -1212,7 +1212,7 @@ static int hp100_init_rxpdl(struct net_device *dev, ...@@ -1212,7 +1212,7 @@ static int hp100_init_rxpdl(struct net_device *dev,
*(pdlptr + 2) = (u_int) virt_to_whatever(dev, pdlptr); /* Address Frag 1 */ *(pdlptr + 2) = (u_int) virt_to_whatever(dev, pdlptr); /* Address Frag 1 */
*(pdlptr + 3) = 4; /* Length Frag 1 */ *(pdlptr + 3) = 4; /* Length Frag 1 */
return ((((MAX_RX_FRAG * 2 + 2) + 3) / 4) * 4); return roundup(MAX_RX_FRAG * 2 + 2, 4);
} }
...@@ -1227,7 +1227,7 @@ static int hp100_init_txpdl(struct net_device *dev, ...@@ -1227,7 +1227,7 @@ static int hp100_init_txpdl(struct net_device *dev,
ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr); /* +1 */ ringptr->pdl_paddr = virt_to_whatever(dev, pdlptr); /* +1 */
ringptr->skb = (void *) NULL; ringptr->skb = (void *) NULL;
return ((((MAX_TX_FRAG * 2 + 2) + 3) / 4) * 4); return roundup(MAX_TX_FRAG * 2 + 2, 4);
} }
/* /*
...@@ -1256,7 +1256,7 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, ...@@ -1256,7 +1256,7 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr,
/* Note: This depends on the alloc_skb functions allocating more /* Note: This depends on the alloc_skb functions allocating more
* space than requested, i.e. aligning to 16bytes */ * space than requested, i.e. aligning to 16bytes */
ringptr->skb = dev_alloc_skb(((MAX_ETHER_SIZE + 2 + 3) / 4) * 4); ringptr->skb = dev_alloc_skb(roundup(MAX_ETHER_SIZE + 2, 4));
if (NULL != ringptr->skb) { if (NULL != ringptr->skb) {
/* /*
...@@ -1279,7 +1279,7 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr, ...@@ -1279,7 +1279,7 @@ static int hp100_build_rx_pdl(hp100_ring_t * ringptr,
#ifdef HP100_DEBUG_BM #ifdef HP100_DEBUG_BM
printk("hp100: %s: build_rx_pdl: PDH@0x%x, skb->data (len %d) at 0x%x\n", printk("hp100: %s: build_rx_pdl: PDH@0x%x, skb->data (len %d) at 0x%x\n",
dev->name, (u_int) ringptr->pdl, dev->name, (u_int) ringptr->pdl,
((MAX_ETHER_SIZE + 2 + 3) / 4) * 4, roundup(MAX_ETHER_SIZE + 2, 4),
(unsigned int) ringptr->skb->data); (unsigned int) ringptr->skb->data);
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment