From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEBE319DF53 for ; Thu, 24 Apr 2025 13:37:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745501876; cv=none; b=Lvc4r23GwdybspaG8kYbovYByfmhkCtUBIUzWuYE63ehopCyCUSY6RLdgYL7UtESsqQxwUgow4UaWfTe3wYPCI1fu44Y+IQofSXygqtPqPVK2krdGnoXGlCxlEgwADOrQgLXRcGxD89apEz42erOFE8Cvm6JJyOFX427dIt/gq0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745501876; c=relaxed/simple; bh=0B08tQCDV/YYmOgIK6Ue4xy6kn4g5vJClte6djnepHw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=E/kknC4noJaTqk0gK8POxyo/8kpHmqyacEzuWsAYJv6XPVw+yVkY6gDMUc+763VcliYsOwFB+NSLEmlokmVkAEZIiZfD2hzqINfw/mA3JnM5bgfCS7eivhOzBD63Vr3HUnEr1MTSQJ8em2lmSFaNCSlsK0/Js+Y/etrXK6nuDkM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=AHIPHdh0; arc=none smtp.client-ip=95.215.58.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="AHIPHdh0" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1745501859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=cUgeUuGuwZsJXWXL0X2PpcBzTbL1vlhXpdOq9KiwkCA=; b=AHIPHdh0Hoc8CUyvtohOmSv8X2zBRpftm+c5MW5HHSGG+Dlq9wD4g6r13CNNfu/RQZA2fh 8BV3SnZmV1BuvXOr083sl0UvAIaVG0qJJYw/rV6tzO7QJkQC2FFwnsZzZRymdkt4Mt/FS/ jU/R6SkB0uPjWdVEm1nvd/Zp8/z5Fi0= From: Thorsten Blum To: Walker Chen , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: Thorsten Blum , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: starfive: Use max() to simplify code in jh7110_tdm_syncdiv() Date: Thu, 24 Apr 2025 15:36:49 +0200 Message-ID: <20250424133648.86459-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Use max() to simplify jh7110_tdm_syncdiv() and improve its readability. Signed-off-by: Thorsten Blum --- 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.49.0