aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-05 07:00:45 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-05 07:00:45 -0500
commita23547374215422017239af32094e1aacc5d435e (patch)
treed6985e67ace677061a4800bc63bfd762474bd78b
parent6deaca2bc3224aa138c93447000677ba5731007e (diff)
[media] cx24110: Simplify error handling at cx24110_set_fec()
move the return to happen before the logic. This way, we can avoid one extra identation. This also fixes an identation issue on this function. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/dvb-frontends/cx24110.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/media/dvb-frontends/cx24110.c b/drivers/media/dvb-frontends/cx24110.c
index 5a31b3f59306..7b510f2ae20f 100644
--- a/drivers/media/dvb-frontends/cx24110.c
+++ b/drivers/media/dvb-frontends/cx24110.c
@@ -177,10 +177,8 @@ static int cx24110_set_inversion (struct cx24110_state* state, fe_spectral_inver
177 return 0; 177 return 0;
178} 178}
179 179
180static int cx24110_set_fec (struct cx24110_state* state, fe_code_rate_t fec) 180static int cx24110_set_fec(struct cx24110_state* state, fe_code_rate_t fec)
181{ 181{
182/* fixme (low): error handling */
183
184 static const int rate[FEC_AUTO] = {-1, 1, 2, 3, 5, 7, -1}; 182 static const int rate[FEC_AUTO] = {-1, 1, 2, 3, 5, 7, -1};
185 static const int g1[FEC_AUTO] = {-1, 0x01, 0x02, 0x05, 0x15, 0x45, -1}; 183 static const int g1[FEC_AUTO] = {-1, 0x01, 0x02, 0x05, 0x15, 0x45, -1};
186 static const int g2[FEC_AUTO] = {-1, 0x01, 0x03, 0x06, 0x1a, 0x7a, -1}; 184 static const int g2[FEC_AUTO] = {-1, 0x01, 0x03, 0x06, 0x1a, 0x7a, -1};
@@ -208,16 +206,16 @@ static int cx24110_set_fec (struct cx24110_state* state, fe_code_rate_t fec)
208 } else { 206 } else {
209 cx24110_writereg(state, 0x37, cx24110_readreg(state, 0x37) | 0x20); 207 cx24110_writereg(state, 0x37, cx24110_readreg(state, 0x37) | 0x20);
210 /* set AcqVitDis bit */ 208 /* set AcqVitDis bit */
211 if (rate[fec] > 0) { 209 if (rate[fec] < 0)
212 cx24110_writereg(state, 0x05, (cx24110_readreg(state, 0x05) & 0xf0) | rate[fec]); 210 return -EINVAL;
213 /* set nominal Viterbi rate */ 211
214 cx24110_writereg(state, 0x22, (cx24110_readreg(state, 0x22) & 0xf0) | rate[fec]); 212 cx24110_writereg(state, 0x05, (cx24110_readreg(state, 0x05) & 0xf0) | rate[fec]);
215 /* set current Viterbi rate */ 213 /* set nominal Viterbi rate */
216 cx24110_writereg(state, 0x1a, g1[fec]); 214 cx24110_writereg(state, 0x22, (cx24110_readreg(state, 0x22) & 0xf0) | rate[fec]);
217 cx24110_writereg(state, 0x1b, g2[fec]); 215 /* set current Viterbi rate */
218 /* not sure if this is the right way: I always used AutoAcq mode */ 216 cx24110_writereg(state, 0x1a, g1[fec]);
219 } else 217 cx24110_writereg(state, 0x1b, g2[fec]);
220 return -EINVAL; 218 /* not sure if this is the right way: I always used AutoAcq mode */
221 } 219 }
222 return 0; 220 return 0;
223} 221}