[PATCH] sound: Fix traditional comparison using max/min method

Li Dong posted 1 patch 2 years, 7 months ago
sound/soc/starfive/jh7110_tdm.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
[PATCH] sound: Fix traditional comparison using max/min method
Posted by Li Dong 2 years, 7 months ago
It would be better to replace the traditional ternary conditional
operator with max()/min()

Signed-off-by: Li Dong <lidong@vivo.com>
---
 sound/soc/starfive/jh7110_tdm.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/sound/soc/starfive/jh7110_tdm.c b/sound/soc/starfive/jh7110_tdm.c
index 5f5a6ca7dbda..a17437dd8c3e 100644
--- a/sound/soc/starfive/jh7110_tdm.c
+++ b/sound/soc/starfive/jh7110_tdm.c
@@ -187,15 +187,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;
 
-- 
2.31.1.windows.1