Skip to contentSkip to conversation

ASoC: da7210: Minor update for PLL and SRM

PATCH Superseded Ashish Chavan 2 participants 4 messages Apr 17, 2012

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: da7210: Minor update for PLL and SRM

This patch converts multiple if conditions in to single if with "&&"s.

---
 sound/soc/codecs/da7210.c |   22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)
sound/soc/codecs/da7210.c +9 -13
index cf4063b..d3ca28b 100644
@@ -992,19 +992,15 @@ static int da7210_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
 
 	/* Search pll div array for correct divisors */
 	for (cnt = 0; cnt < ARRAY_SIZE(da7210_pll_div); cnt++) {
-		/* check fref */
-		if (fref == da7210_pll_div[cnt].fref) {
-			/* check mode */
-			 if (da7210->master ==  da7210_pll_div[cnt].mode) {
-				/* check fout */
-				if (fout == da7210_pll_div[cnt].fout) {
-					/* all match, pick up divisors */
-					pll_div1 = da7210_pll_div[cnt].div1;
-					pll_div2 = da7210_pll_div[cnt].div2;
-					pll_div3 = da7210_pll_div[cnt].div3;
-					break;
-				}
-			}
+		/* check fref, mode  and fout */
+		if ((fref == da7210_pll_div[cnt].fref) &&
+			(da7210->master ==  da7210_pll_div[cnt].mode) &&
+			(fout == da7210_pll_div[cnt].fout)) {
+				/* all match, pick up divisors */
+				pll_div1 = da7210_pll_div[cnt].div1;
+				pll_div2 = da7210_pll_div[cnt].div2;
+				pll_div3 = da7210_pll_div[cnt].div3;
+				break;
 		}
 	}
 	if (cnt >= ARRAY_SIZE(da7210_pll_div))
Signature · 1 line
1.7.1
#1 lore raw

sound/soc/codecs/da7210.c static int da7210_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, · line 998

Quoted 3 lines · Ashish Chavan
sound/soc/codecs/da7210.c +3 -0
+		if ((fref == da7210_pll_div[cnt].fref) &&
+			(da7210->master ==  da7210_pll_div[cnt].mode) &&
+			(fout == da7210_pll_div[cnt].fout)) {

Since this is just a coding style thing how about lining up the (s for the branches?

#2 lore raw
Quoted 8 lines · Mark Brown

sound/soc/codecs/da7210.c static int da7210_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, · line 998

Quoted 3 lines · Ashish Chavan
sound/soc/codecs/da7210.c +3 -0
+		if ((fref == da7210_pll_div[cnt].fref) &&
+			(da7210->master ==  da7210_pll_div[cnt].mode) &&
+			(fout == da7210_pll_div[cnt].fout)) {

Since this is just a coding style thing how about lining up the (s for the branches?

To do that we will have to use spaces instead of tab for indentation. I am not sure if that is fine. You mean something like below, right?

		if ((fref == da7210_pll_div[cnt].fref) &&
		    (da7210->master ==  da7210_pll_div[cnt].mode) &&
		    (fout == da7210_pll_div[cnt].fout)) {
#3 lore raw
Quoted 6 lines · Ashish Chavan

To do that we will have to use spaces instead of tab for indentation. I am not sure if that is fine. You mean something like below, right?

		if ((fref == da7210_pll_div[cnt].fref) &&
		    (da7210->master ==  da7210_pll_div[cnt].mode) &&
		    (fout == da7210_pll_div[cnt].fout)) {

Yes, that's totally fine. 8 character tabs and spaces below that.