Skip to content

Commit

Permalink
ALSA: riptide: Use DIV_ROUND_UP
Browse files Browse the repository at this point in the history
The kernel.h macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)) but is perhaps more readable.

The Coccinelle script used to make this change is as follows:
@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)
)

Signed-off-by: Amitoj Kaur Chawla <[email protected]>
Reviewed-by: Takashi Sakamoto <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
musicakc authored and tiwai committed Jun 30, 2016
1 parent 3915bf2 commit cf7d7ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sound/pci/riptide/riptide.c
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
f = PAGE_SIZE;
while ((size + (f >> 1) - 1) <= (f << 7) && (f << 1) > period)
f = f >> 1;
pages = (size + f - 1) / f;
pages = DIV_ROUND_UP(size, f);
data->size = size;
data->pages = pages;
snd_printdd
Expand Down

0 comments on commit cf7d7ed

Please sign in to comment.