aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/arm/palm_bk3710.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-04-26 11:36:35 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-26 11:36:35 -0400
commit00fe8b7ac2ff6b8afba11642fb71cdb17aa34df9 (patch)
tree69ac4748267d573634ed70c724dc5482f112e8ee /drivers/ide/arm/palm_bk3710.c
parent5e71d9c5a50b92b33d35061d42ac39166db9578e (diff)
ide: 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> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/arm/palm_bk3710.c')
-rw-r--r--drivers/ide/arm/palm_bk3710.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c
index caa419404daa..666df779a5f4 100644
--- a/drivers/ide/arm/palm_bk3710.c
+++ b/drivers/ide/arm/palm_bk3710.c
@@ -96,11 +96,11 @@ static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev,
96 u16 val16; 96 u16 val16;
97 97
98 /* DMA Data Setup */ 98 /* DMA Data Setup */
99 t0 = (palm_bk3710_udmatimings[mode].cycletime + ide_palm_clk - 1) 99 t0 = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].cycletime,
100 / ide_palm_clk - 1; 100 ide_palm_clk) - 1;
101 tenv = (20 + ide_palm_clk - 1) / ide_palm_clk - 1; 101 tenv = DIV_ROUND_UP(20, ide_palm_clk) - 1;
102 trp = (palm_bk3710_udmatimings[mode].rptime + ide_palm_clk - 1) 102 trp = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].rptime,
103 / ide_palm_clk - 1; 103 ide_palm_clk) - 1;
104 104
105 /* udmatim Register */ 105 /* udmatim Register */
106 val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0); 106 val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0);
@@ -141,8 +141,8 @@ static void palm_bk3710_setdmamode(void __iomem *base, unsigned int dev,
141 cycletime = max_t(int, t->cycle, min_cycle); 141 cycletime = max_t(int, t->cycle, min_cycle);
142 142
143 /* DMA Data Setup */ 143 /* DMA Data Setup */
144 t0 = (cycletime + ide_palm_clk - 1) / ide_palm_clk; 144 t0 = DIV_ROUND_UP(cycletime, ide_palm_clk);
145 td = (t->active + ide_palm_clk - 1) / ide_palm_clk; 145 td = DIV_ROUND_UP(t->active, ide_palm_clk);
146 tkw = t0 - td - 1; 146 tkw = t0 - td - 1;
147 td -= 1; 147 td -= 1;
148 148
@@ -168,9 +168,9 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate,
168 struct ide_timing *t; 168 struct ide_timing *t;
169 169
170 /* PIO Data Setup */ 170 /* PIO Data Setup */
171 t0 = (cycletime + ide_palm_clk - 1) / ide_palm_clk; 171 t0 = DIV_ROUND_UP(cycletime, ide_palm_clk);
172 t2 = (ide_timing_find_mode(XFER_PIO_0 + mode)->active + 172 t2 = DIV_ROUND_UP(ide_timing_find_mode(XFER_PIO_0 + mode)->active,
173 ide_palm_clk - 1) / ide_palm_clk; 173 ide_palm_clk);
174 174
175 t2i = t0 - t2 - 1; 175 t2i = t0 - t2 - 1;
176 t2 -= 1; 176 t2 -= 1;
@@ -192,8 +192,8 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate,
192 192
193 /* TASKFILE Setup */ 193 /* TASKFILE Setup */
194 t = ide_timing_find_mode(XFER_PIO_0 + mode); 194 t = ide_timing_find_mode(XFER_PIO_0 + mode);
195 t0 = (t->cyc8b + ide_palm_clk - 1) / ide_palm_clk; 195 t0 = DIV_ROUND_UP(t->cyc8b, ide_palm_clk);
196 t2 = (t->act8b + ide_palm_clk - 1) / ide_palm_clk; 196 t2 = DIV_ROUND_UP(t->act8b, ide_palm_clk);
197 197
198 t2i = t0 - t2 - 1; 198 t2i = t0 - t2 - 1;
199 t2 -= 1; 199 t2 -= 1;