public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>,
	perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Cc: julia.lawall@lip6.fr
Subject: Re: [PATCH] ALSA: riptide: Use DIV_ROUND_UP
Date: Thu, 30 Jun 2016 11:14:36 +0900	[thread overview]
Message-ID: <5774808C.60206@sakamocchi.jp> (raw)
In-Reply-To: <20160629145628.GA13915@amitoj-Inspiron-3542>

On Jun 29 2016 23:56, Amitoj Kaur Chawla wrote:
> 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 <amitoj1606@gmail.com>
> ---
>   sound/pci/riptide/riptide.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
> index 94639d6..067a912 100644
> --- a/sound/pci/riptide/riptide.c
> +++ b/sound/pci/riptide/riptide.c
> @@ -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
>

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>


Regards

Takashi Sakamoto

  reply	other threads:[~2016-06-30  2:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-29 14:56 [PATCH] ALSA: riptide: Use DIV_ROUND_UP Amitoj Kaur Chawla
2016-06-30  2:14 ` Takashi Sakamoto [this message]
2016-06-30  6:35 ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5774808C.60206@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=amitoj1606@gmail.com \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox