All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shang XiaoJing <shangxiaojing@huawei.com>
To: <james.schulman@cirrus.com>, <david.rhodes@cirrus.com>,
	<tanureal@opensource.cirrus.com>, <rf@opensource.cirrus.com>,
	<lgirdwood@gmail.com>, <broonie@kernel.org>, <perex@perex.cz>,
	<tiwai@suse.com>, <christophe.jaillet@wanadoo.fr>,
	<peter.ujfalusi@gmail.com>, <alsa-devel@alsa-project.org>,
	<patches@opensource.cirrus.com>
Cc: shangxiaojing@huawei.com
Subject: [PATCH -next 2/4] ASoC: wm8978: Use DIV_ROUND_UP() instead of open-coding it
Date: Tue, 27 Sep 2022 22:09:46 +0800	[thread overview]
Message-ID: <20220927140948.17696-3-shangxiaojing@huawei.com> (raw)
In-Reply-To: <20220927140948.17696-1-shangxiaojing@huawei.com>

Use DIV_ROUND_UP() instead of open-coding it, which intents and makes it
more clear what is going on for the casual reviewer.

The Coccinelle references Commit e4d8aef21403 ("ALSA: usb: Use
DIV_ROUND_UP() instead of open-coding it").

Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
---
 sound/soc/codecs/wm8978.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index a682f8020eb6..aa2f55401a88 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -498,7 +498,7 @@ static int wm8978_configure_pll(struct snd_soc_component *component)
 
 		if (4 * f_opclk < 3 * f_mclk)
 			/* Have to use OPCLKDIV */
-			opclk_div = (3 * f_mclk / 4 + f_opclk - 1) / f_opclk;
+			opclk_div = DIV_ROUND_UP(3 * f_mclk / 4, f_opclk);
 		else
 			opclk_div = 1;
 
-- 
2.17.1


  parent reply	other threads:[~2022-09-29  6:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-27 14:09 [PATCH -next 0/4] ASoC: Use DIV_ROUND_UP() instead of open-coding it Shang XiaoJing
2022-09-27 14:09 ` [PATCH -next 1/4] ASoC: cs35l36: " Shang XiaoJing
2022-09-29  9:07   ` Charles Keepax
2022-09-27 14:09 ` Shang XiaoJing [this message]
2022-09-29  9:07   ` [PATCH -next 2/4] ASoC: wm8978: " Charles Keepax
2022-09-27 14:09 ` [PATCH -next 3/4] ASoC: rsnd: " Shang XiaoJing
2022-09-27 14:09 ` [PATCH -next 4/4] ASoC: ti: davinci-mcasp: " Shang XiaoJing
2022-10-18 11:28 ` [PATCH -next 0/4] ASoC: " Mark Brown

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=20220927140948.17696-3-shangxiaojing@huawei.com \
    --to=shangxiaojing@huawei.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=david.rhodes@cirrus.com \
    --cc=james.schulman@cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=peter.ujfalusi@gmail.com \
    --cc=rf@opensource.cirrus.com \
    --cc=tanureal@opensource.cirrus.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.