aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-09-22 17:57:16 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:19 -0400
commit061837bc8687edc2739ef02f721b7ae0b8076390 (patch)
treee1c59ea7212949a91b2cf19ed125c0db24052b29 /drivers/block/cciss.c
parent905bd78f2188da69e74966918e3d71df3dff382b (diff)
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/cciss.c')
-rw-r--r--drivers/block/cciss.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index b73116ef9236..1e1f9153000c 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3460,8 +3460,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3460 hba[i]->intr[SIMPLE_MODE_INT], dac ? "" : " not"); 3460 hba[i]->intr[SIMPLE_MODE_INT], dac ? "" : " not");
3461 3461
3462 hba[i]->cmd_pool_bits = 3462 hba[i]->cmd_pool_bits =
3463 kmalloc(((hba[i]->nr_cmds + BITS_PER_LONG - 3463 kmalloc(DIV_ROUND_UP(hba[i]->nr_cmds, BITS_PER_LONG)
3464 1) / BITS_PER_LONG) * sizeof(unsigned long), GFP_KERNEL); 3464 * sizeof(unsigned long), GFP_KERNEL);
3465 hba[i]->cmd_pool = (CommandList_struct *) 3465 hba[i]->cmd_pool = (CommandList_struct *)
3466 pci_alloc_consistent(hba[i]->pdev, 3466 pci_alloc_consistent(hba[i]->pdev,
3467 hba[i]->nr_cmds * sizeof(CommandList_struct), 3467 hba[i]->nr_cmds * sizeof(CommandList_struct),
@@ -3493,8 +3493,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
3493 /* command and error info recs zeroed out before 3493 /* command and error info recs zeroed out before
3494 they are used */ 3494 they are used */
3495 memset(hba[i]->cmd_pool_bits, 0, 3495 memset(hba[i]->cmd_pool_bits, 0,
3496 ((hba[i]->nr_cmds + BITS_PER_LONG - 3496 DIV_ROUND_UP(hba[i]->nr_cmds, BITS_PER_LONG)
3497 1) / BITS_PER_LONG) * sizeof(unsigned long)); 3497 * sizeof(unsigned long));
3498 3498
3499 hba[i]->num_luns = 0; 3499 hba[i]->num_luns = 0;
3500 hba[i]->highest_lun = -1; 3500 hba[i]->highest_lun = -1;