diff mbox series

sound: Fix traditional comparison using max/min method

Message ID 20230619100055.1680-1-lidong@vivo.com (mailing list archive)
State New, archived
Headers show
Series sound: Fix traditional comparison using max/min method | expand

Commit Message

Li Dong June 19, 2023, 10 a.m. UTC
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 mbox series

Patch

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;