From 0787a08ae785366b9473905fc8bf23f165a08b8d Mon Sep 17 00:00:00 2001 From: Thorsten Blum Date: Thu, 24 Apr 2025 15:36:49 +0200 Subject: [PATCH] ASoC: starfive: Use max() to simplify code in jh7110_tdm_syncdiv() Use max() to simplify jh7110_tdm_syncdiv() and improve its readability. Signed-off-by: Thorsten Blum Link: https://patch.msgid.link/20250424133648.86459-2-thorsten.blum@linux.dev Signed-off-by: Mark Brown --- 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 #include #include +#include #include #include #include @@ -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.50.1