* [PATCH] ASoC: starfive: Use max() to simplify code in jh7110_tdm_syncdiv()
@ 2025-04-24 13:36 Thorsten Blum
2025-04-25 17:40 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2025-04-24 13:36 UTC (permalink / raw)
To: Walker Chen, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai
Cc: Thorsten Blum, linux-sound, linux-kernel
Use max() to simplify jh7110_tdm_syncdiv() and improve its readability.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
sound/soc/starfive/jh7110_tdm.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/sound/soc/starfive/jh7110_tdm.c b/sound/soc/starfive/jh7110_tdm.c
index d38090e68df5..afdcde7df91a 100644
--- a/sound/soc/starfive/jh7110_tdm.c
+++ b/sound/soc/starfive/jh7110_tdm.c
@@ -10,6 +10,7 @@
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/dmaengine.h>
+#include <linux/minmax.h>
#include <linux/module.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
@@ -187,16 +188,8 @@ static int jh7110_tdm_syncdiv(struct jh7110_tdm_dev *tdm)
{
u32 sl, sscale, syncdiv;
- if (tdm->rx.sl >= tdm->tx.sl)
- sl = tdm->rx.sl;
- else
- sl = tdm->tx.sl;
-
- if (tdm->rx.sscale >= tdm->tx.sscale)
- sscale = tdm->rx.sscale;
- else
- sscale = tdm->tx.sscale;
-
+ sl = max(tdm->rx.sl, tdm->tx.sl);
+ sscale = max(tdm->rx.sscale, tdm->tx.sscale);
syncdiv = tdm->pcmclk / tdm->samplerate - 1;
if ((syncdiv + 1) < (sl * sscale)) {
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ASoC: starfive: Use max() to simplify code in jh7110_tdm_syncdiv()
2025-04-24 13:36 [PATCH] ASoC: starfive: Use max() to simplify code in jh7110_tdm_syncdiv() Thorsten Blum
@ 2025-04-25 17:40 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2025-04-25 17:40 UTC (permalink / raw)
To: Walker Chen, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
Thorsten Blum
Cc: linux-sound, linux-kernel
On Thu, 24 Apr 2025 15:36:49 +0200, Thorsten Blum wrote:
> Use max() to simplify jh7110_tdm_syncdiv() and improve its readability.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: starfive: Use max() to simplify code in jh7110_tdm_syncdiv()
commit: 0787a08ae785366b9473905fc8bf23f165a08b8d
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] 2+ messages in thread
end of thread, other threads:[~2025-04-25 17:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 13:36 [PATCH] ASoC: starfive: Use max() to simplify code in jh7110_tdm_syncdiv() Thorsten Blum
2025-04-25 17:40 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox