ASoC: wm8978: Use DIV_ROUND_UP() instead of open-coding it
authorShang XiaoJing <shangxiaojing@huawei.com>
Tue, 27 Sep 2022 14:09:46 +0000 (22:09 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 17 Oct 2022 11:48:22 +0000 (12:48 +0100)
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>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220927140948.17696-3-shangxiaojing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/wm8978.c

index a682f80..aa2f554 100644 (file)
@@ -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;