alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next 0/4] ASoC: Use DIV_ROUND_UP() instead of open-coding it
@ 2022-09-27 14:09 Shang XiaoJing
  2022-09-27 14:09 ` [PATCH -next 1/4] ASoC: cs35l36: " Shang XiaoJing
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Shang XiaoJing @ 2022-09-27 14:09 UTC (permalink / raw)
  To: james.schulman, david.rhodes, tanureal, rf, lgirdwood, broonie,
	perex, tiwai, christophe.jaillet, peter.ujfalusi, alsa-devel,
	patches
  Cc: shangxiaojing

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

Shang XiaoJing (4):
  ASoC: cs35l36: Use DIV_ROUND_UP() instead of open-coding it
  ASoC: wm8978: Use DIV_ROUND_UP() instead of open-coding it
  ASoC: rsnd: Use DIV_ROUND_UP() instead of open-coding it
  ASoC: ti: davinci-mcasp: Use DIV_ROUND_UP() instead of open-coding it

 sound/soc/codecs/cs35l36.c   | 4 ++--
 sound/soc/codecs/wm8978.c    | 2 +-
 sound/soc/sh/rcar/core.c     | 4 ++--
 sound/soc/ti/davinci-mcasp.c | 7 +++----
 4 files changed, 8 insertions(+), 9 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH -next 1/4] ASoC: cs35l36: Use DIV_ROUND_UP() instead of open-coding it
  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 ` Shang XiaoJing
  2022-09-29  9:07   ` Charles Keepax
  2022-09-27 14:09 ` [PATCH -next 2/4] ASoC: wm8978: " Shang XiaoJing
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Shang XiaoJing @ 2022-09-27 14:09 UTC (permalink / raw)
  To: james.schulman, david.rhodes, tanureal, rf, lgirdwood, broonie,
	perex, tiwai, christophe.jaillet, peter.ujfalusi, alsa-devel,
	patches
  Cc: shangxiaojing

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/cs35l36.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/cs35l36.c b/sound/soc/codecs/cs35l36.c
index 31ae752e242f..a078dd422ea1 100644
--- a/sound/soc/codecs/cs35l36.c
+++ b/sound/soc/codecs/cs35l36.c
@@ -918,8 +918,8 @@ static int cs35l36_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id,
 		fs1 = CS35L36_FS1_DEFAULT_VAL;
 		fs2 = CS35L36_FS2_DEFAULT_VAL;
 	} else {
-		fs1 = 3 * ((CS35L36_FS_NOM_6MHZ * 4 + freq - 1) / freq) + 4;
-		fs2 = 5 * ((CS35L36_FS_NOM_6MHZ * 4 + freq - 1) / freq) + 4;
+		fs1 = 3 * DIV_ROUND_UP(CS35L36_FS_NOM_6MHZ * 4, freq) + 4;
+		fs2 = 5 * DIV_ROUND_UP(CS35L36_FS_NOM_6MHZ * 4, freq) + 4;
 	}
 
 	regmap_write(cs35l36->regmap, CS35L36_TESTKEY_CTRL,
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH -next 2/4] ASoC: wm8978: Use DIV_ROUND_UP() instead of open-coding it
  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-27 14:09 ` Shang XiaoJing
  2022-09-29  9:07   ` Charles Keepax
  2022-09-27 14:09 ` [PATCH -next 3/4] ASoC: rsnd: " Shang XiaoJing
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Shang XiaoJing @ 2022-09-27 14:09 UTC (permalink / raw)
  To: james.schulman, david.rhodes, tanureal, rf, lgirdwood, broonie,
	perex, tiwai, christophe.jaillet, peter.ujfalusi, alsa-devel,
	patches
  Cc: shangxiaojing

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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH -next 3/4] ASoC: rsnd: Use DIV_ROUND_UP() instead of open-coding it
  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-27 14:09 ` [PATCH -next 2/4] ASoC: wm8978: " Shang XiaoJing
@ 2022-09-27 14:09 ` 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
  4 siblings, 0 replies; 8+ messages in thread
From: Shang XiaoJing @ 2022-09-27 14:09 UTC (permalink / raw)
  To: james.schulman, david.rhodes, tanureal, rf, lgirdwood, broonie,
	perex, tiwai, christophe.jaillet, peter.ujfalusi, alsa-devel,
	patches
  Cc: shangxiaojing

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/sh/rcar/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 7e380d71b0f8..4e21ebce03c6 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -1581,9 +1581,9 @@ static int rsnd_hw_params(struct snd_soc_component *component,
 				hw_params->cmask |= SNDRV_PCM_HW_PARAM_RATE;
 			} else if (params_rate(hw_params) * k_up < io->converted_rate) {
 				hw_param_interval(hw_params, SNDRV_PCM_HW_PARAM_RATE)->min =
-					(io->converted_rate + k_up - 1) / k_up;
+					DIV_ROUND_UP(io->converted_rate, k_up);
 				hw_param_interval(hw_params, SNDRV_PCM_HW_PARAM_RATE)->max =
-					(io->converted_rate + k_up - 1) / k_up;
+					DIV_ROUND_UP(io->converted_rate, k_up);
 				hw_params->cmask |= SNDRV_PCM_HW_PARAM_RATE;
 			}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH -next 4/4] ASoC: ti: davinci-mcasp: Use DIV_ROUND_UP() instead of open-coding it
  2022-09-27 14:09 [PATCH -next 0/4] ASoC: Use DIV_ROUND_UP() instead of open-coding it Shang XiaoJing
                   ` (2 preceding siblings ...)
  2022-09-27 14:09 ` [PATCH -next 3/4] ASoC: rsnd: " Shang XiaoJing
@ 2022-09-27 14:09 ` Shang XiaoJing
  2022-10-18 11:28 ` [PATCH -next 0/4] ASoC: " Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Shang XiaoJing @ 2022-09-27 14:09 UTC (permalink / raw)
  To: james.schulman, david.rhodes, tanureal, rf, lgirdwood, broonie,
	perex, tiwai, christophe.jaillet, peter.ujfalusi, alsa-devel,
	patches
  Cc: shangxiaojing

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/ti/davinci-mcasp.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index ca5d1bb6ac59..f5ac2ab77f5b 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -869,7 +869,7 @@ static int mcasp_common_hw_param(struct davinci_mcasp *mcasp, int stream,
 	if (mcasp->op_mode == DAVINCI_MCASP_DIT_MODE)
 		max_active_serializers = 1;
 	else
-		max_active_serializers = (channels + slots - 1) / slots;
+		max_active_serializers = DIV_ROUND_UP(channels, slots);
 
 	/* Default configuration */
 	if (mcasp->version < MCASP_VERSION_3)
@@ -1002,8 +1002,7 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
 	 */
 	if (mcasp->tdm_mask[stream]) {
 		active_slots = hweight32(mcasp->tdm_mask[stream]);
-		active_serializers = (channels + active_slots - 1) /
-			active_slots;
+		active_serializers = DIV_ROUND_UP(channels, active_slots);
 		if (active_serializers == 1)
 			active_slots = channels;
 		for (i = 0; i < total_slots; i++) {
@@ -1014,7 +1013,7 @@ static int mcasp_i2s_hw_param(struct davinci_mcasp *mcasp, int stream,
 			}
 		}
 	} else {
-		active_serializers = (channels + total_slots - 1) / total_slots;
+		active_serializers = DIV_ROUND_UP(channels, total_slots);
 		if (active_serializers == 1)
 			active_slots = channels;
 		else
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH -next 1/4] ASoC: cs35l36: Use DIV_ROUND_UP() instead of open-coding it
  2022-09-27 14:09 ` [PATCH -next 1/4] ASoC: cs35l36: " Shang XiaoJing
@ 2022-09-29  9:07   ` Charles Keepax
  0 siblings, 0 replies; 8+ messages in thread
From: Charles Keepax @ 2022-09-29  9:07 UTC (permalink / raw)
  To: Shang XiaoJing
  Cc: alsa-devel, tanureal, patches, tiwai, lgirdwood, david.rhodes,
	rf, broonie, christophe.jaillet, james.schulman, peter.ujfalusi

On Tue, Sep 27, 2022 at 10:09:45PM +0800, Shang XiaoJing wrote:
> 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>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next 2/4] ASoC: wm8978: Use DIV_ROUND_UP() instead of open-coding it
  2022-09-27 14:09 ` [PATCH -next 2/4] ASoC: wm8978: " Shang XiaoJing
@ 2022-09-29  9:07   ` Charles Keepax
  0 siblings, 0 replies; 8+ messages in thread
From: Charles Keepax @ 2022-09-29  9:07 UTC (permalink / raw)
  To: Shang XiaoJing
  Cc: alsa-devel, tanureal, patches, tiwai, lgirdwood, david.rhodes,
	rf, broonie, christophe.jaillet, james.schulman, peter.ujfalusi

On Tue, Sep 27, 2022 at 10:09:46PM +0800, Shang XiaoJing wrote:
> 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>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next 0/4] ASoC: Use DIV_ROUND_UP() instead of open-coding it
  2022-09-27 14:09 [PATCH -next 0/4] ASoC: Use DIV_ROUND_UP() instead of open-coding it Shang XiaoJing
                   ` (3 preceding siblings ...)
  2022-09-27 14:09 ` [PATCH -next 4/4] ASoC: ti: davinci-mcasp: " Shang XiaoJing
@ 2022-10-18 11:28 ` Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2022-10-18 11:28 UTC (permalink / raw)
  To: Shang XiaoJing, rf, tiwai, christophe.jaillet, james.schulman,
	david.rhodes, peter.ujfalusi, alsa-devel, lgirdwood, patches,
	tanureal, perex

On Tue, 27 Sep 2022 22:09:44 +0800, Shang XiaoJing wrote:
> Use DIV_ROUND_UP() instead of open-coding it, which intents and makes
> it more clear what is going on for the casual reviewer.
> 
> Shang XiaoJing (4):
>   ASoC: cs35l36: Use DIV_ROUND_UP() instead of open-coding it
>   ASoC: wm8978: Use DIV_ROUND_UP() instead of open-coding it
>   ASoC: rsnd: Use DIV_ROUND_UP() instead of open-coding it
>   ASoC: ti: davinci-mcasp: Use DIV_ROUND_UP() instead of open-coding it
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/4] ASoC: cs35l36: Use DIV_ROUND_UP() instead of open-coding it
      commit: ff091dd23b423e19c8191928daedf62eab6ce523
[2/4] ASoC: wm8978: Use DIV_ROUND_UP() instead of open-coding it
      commit: c54402609820427ff6f725f9182216e7cfe7cfa7
[3/4] ASoC: rsnd: Use DIV_ROUND_UP() instead of open-coding it
      commit: 4aa2b05a24a83cc618fab4c4d343f2179962e5ed
[4/4] ASoC: ti: davinci-mcasp: Use DIV_ROUND_UP() instead of open-coding it
      commit: 98059ddfd1ada95fc9f535ea9c08618aa44ad5d3

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-10-18 11:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH -next 2/4] ASoC: wm8978: " Shang XiaoJing
2022-09-29  9:07   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).