summaryrefslogtreecommitdiffstats
path: root/drivers/block/cpqarray.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-09-22 14:57:16 -0700
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 08:56:19 +0200
commit061837bc8687edc2739ef02f721b7ae0b8076390 (patch)
treee1c59ea7212949a91b2cf19ed125c0db24052b29 /drivers/block/cpqarray.c
parent905bd78f2188da69e74966918e3d71df3dff382b (diff)
downloadblackbird-op-linux-061837bc8687edc2739ef02f721b7ae0b8076390.tar.gz
blackbird-op-linux-061837bc8687edc2739ef02f721b7ae0b8076390.zip
drivers/block: Use DIV_ROUND_UP
The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) / (d)) but is perhaps more readable. An extract of the semantic patch that makes this change is as follows: (http://www.emn.fr/x-info/coccinelle/) // <smpl> @haskernel@ @@ #include <linux/kernel.h> @depends on haskernel@ expression n,d; @@ ( - (n + d - 1) / d + DIV_ROUND_UP(n,d) | - (n + (d - 1)) / d + DIV_ROUND_UP(n,d) ) @depends on haskernel@ expression n,d; @@ - DIV_ROUND_UP((n),d) + DIV_ROUND_UP(n,d) @depends on haskernel@ expression n,d; @@ - DIV_ROUND_UP(n,(d)) + DIV_ROUND_UP(n,d) // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: <mike.miller@hp.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block/cpqarray.c')
-rw-r--r--drivers/block/cpqarray.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
index 09c14341e6e3..3d967525e9a9 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -424,7 +424,7 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev)
hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t),
&(hba[i]->cmd_pool_dhandle));
hba[i]->cmd_pool_bits = kcalloc(
- (NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG, sizeof(unsigned long),
+ DIV_ROUND_UP(NR_CMDS, BITS_PER_LONG), sizeof(unsigned long),
GFP_KERNEL);
if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool)
OpenPOWER on IntegriCloud