aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/net/claw.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-02-18 08:41:55 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-23 23:57:45 -0500
commitf5154fbf4902744cdd2bb7548487ceaac9840fd2 (patch)
treeffafe109911852c73c1d3f25f4e4ec1c259b3a72 /drivers/s390/net/claw.c
parent61da96be07ec860e260ca4af0199b9d48d000b80 (diff)
claw: make use of DIV_ROUND_UP
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) / (d)) but is perhaps more readable. Signed-off-by: Ursula Braun <braunu@de.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/s390/net/claw.c')
-rw-r--r--drivers/s390/net/claw.c39
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c
index c3076217871e..d8a5c229c5a7 100644
--- a/drivers/s390/net/claw.c
+++ b/drivers/s390/net/claw.c
@@ -1851,8 +1851,7 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid)
1851 } 1851 }
1852 } 1852 }
1853 /* See how many write buffers are required to hold this data */ 1853 /* See how many write buffers are required to hold this data */
1854 numBuffers= ( skb->len + privptr->p_env->write_size - 1) / 1854 numBuffers = DIV_ROUND_UP(skb->len, privptr->p_env->write_size);
1855 ( privptr->p_env->write_size);
1856 1855
1857 /* If that number of buffers isn't available, give up for now */ 1856 /* If that number of buffers isn't available, give up for now */
1858 if (privptr->write_free_count < numBuffers || 1857 if (privptr->write_free_count < numBuffers ||
@@ -2114,8 +2113,7 @@ init_ccw_bk(struct net_device *dev)
2114 */ 2113 */
2115 ccw_blocks_perpage= PAGE_SIZE / CCWBK_SIZE; 2114 ccw_blocks_perpage= PAGE_SIZE / CCWBK_SIZE;
2116 ccw_pages_required= 2115 ccw_pages_required=
2117 (ccw_blocks_required+ccw_blocks_perpage -1) / 2116 DIV_ROUND_UP(ccw_blocks_required, ccw_blocks_perpage);
2118 ccw_blocks_perpage;
2119 2117
2120#ifdef DEBUGMSG 2118#ifdef DEBUGMSG
2121 printk(KERN_INFO "%s: %s() > ccw_blocks_perpage=%d\n", 2119 printk(KERN_INFO "%s: %s() > ccw_blocks_perpage=%d\n",
@@ -2131,30 +2129,29 @@ init_ccw_bk(struct net_device *dev)
2131 * provide good performance. With packing buffers support 32k 2129 * provide good performance. With packing buffers support 32k
2132 * buffers are used. 2130 * buffers are used.
2133 */ 2131 */
2134 if (privptr->p_env->read_size < PAGE_SIZE) { 2132 if (privptr->p_env->read_size < PAGE_SIZE) {
2135 claw_reads_perpage= PAGE_SIZE / privptr->p_env->read_size; 2133 claw_reads_perpage = PAGE_SIZE / privptr->p_env->read_size;
2136 claw_read_pages= (privptr->p_env->read_buffers + 2134 claw_read_pages = DIV_ROUND_UP(privptr->p_env->read_buffers,
2137 claw_reads_perpage -1) / claw_reads_perpage; 2135 claw_reads_perpage);
2138 } 2136 }
2139 else { /* > or equal */ 2137 else { /* > or equal */
2140 privptr->p_buff_pages_perread= 2138 privptr->p_buff_pages_perread =
2141 (privptr->p_env->read_size + PAGE_SIZE - 1) / PAGE_SIZE; 2139 DIV_ROUND_UP(privptr->p_env->read_size, PAGE_SIZE);
2142 claw_read_pages= 2140 claw_read_pages = privptr->p_env->read_buffers *
2143 privptr->p_env->read_buffers * privptr->p_buff_pages_perread; 2141 privptr->p_buff_pages_perread;
2144 } 2142 }
2145 if (privptr->p_env->write_size < PAGE_SIZE) { 2143 if (privptr->p_env->write_size < PAGE_SIZE) {
2146 claw_writes_perpage= 2144 claw_writes_perpage =
2147 PAGE_SIZE / privptr->p_env->write_size; 2145 PAGE_SIZE / privptr->p_env->write_size;
2148 claw_write_pages= 2146 claw_write_pages = DIV_ROUND_UP(privptr->p_env->write_buffers,
2149 (privptr->p_env->write_buffers + claw_writes_perpage -1) / 2147 claw_writes_perpage);
2150 claw_writes_perpage;
2151 2148
2152 } 2149 }
2153 else { /* > or equal */ 2150 else { /* > or equal */
2154 privptr->p_buff_pages_perwrite= 2151 privptr->p_buff_pages_perwrite =
2155 (privptr->p_env->read_size + PAGE_SIZE - 1) / PAGE_SIZE; 2152 DIV_ROUND_UP(privptr->p_env->read_size, PAGE_SIZE);
2156 claw_write_pages= 2153 claw_write_pages = privptr->p_env->write_buffers *
2157 privptr->p_env->write_buffers * privptr->p_buff_pages_perwrite; 2154 privptr->p_buff_pages_perwrite;
2158 } 2155 }
2159#ifdef DEBUGMSG 2156#ifdef DEBUGMSG
2160 if (privptr->p_env->read_size < PAGE_SIZE) { 2157 if (privptr->p_env->read_size < PAGE_SIZE) {