aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2013-04-07 20:07:47 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-04-08 06:12:19 -0400
commit0562aef296c251e50b0934e6af113c511349dd9c (patch)
tree4eed80136b101379a769208bf19736200c20d477
parentb1f89331190820c42397156063fe5e39bc514e3b (diff)
[media] mb86a20s: better name temp vars at mb86a20s_layer_bitrate()
Using 'i' for the guard interval temporary var is a bad idea, as 'i' is generally used by "anonymous" indexes. Let's rename modulation, fec and guard interval temp vars with a meaningful name, as that makes easier to understand the code and avoids cut-and-paste types of error. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/dvb-frontends/mb86a20s.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c
index d25df75ed404..856374bd3676 100644
--- a/drivers/media/dvb-frontends/mb86a20s.c
+++ b/drivers/media/dvb-frontends/mb86a20s.c
@@ -566,12 +566,13 @@ static u32 isdbt_rate[3][5][4] = {
566}; 566};
567 567
568static void mb86a20s_layer_bitrate(struct dvb_frontend *fe, u32 layer, 568static void mb86a20s_layer_bitrate(struct dvb_frontend *fe, u32 layer,
569 u32 modulation, u32 fec, u32 interleaving, 569 u32 modulation, u32 forward_error_correction,
570 u32 interleaving,
570 u32 segment) 571 u32 segment)
571{ 572{
572 struct mb86a20s_state *state = fe->demodulator_priv; 573 struct mb86a20s_state *state = fe->demodulator_priv;
573 u32 rate; 574 u32 rate;
574 int m, f, i; 575 int mod, fec, guard;
575 576
576 /* 577 /*
577 * If modulation/fec/interleaving is not detected, the default is 578 * If modulation/fec/interleaving is not detected, the default is
@@ -582,54 +583,54 @@ static void mb86a20s_layer_bitrate(struct dvb_frontend *fe, u32 layer,
582 case DQPSK: 583 case DQPSK:
583 case QPSK: 584 case QPSK:
584 default: 585 default:
585 m = 0; 586 mod = 0;
586 break; 587 break;
587 case QAM_16: 588 case QAM_16:
588 m = 1; 589 mod = 1;
589 break; 590 break;
590 case QAM_64: 591 case QAM_64:
591 m = 2; 592 mod = 2;
592 break; 593 break;
593 } 594 }
594 595
595 switch (fec) { 596 switch (forward_error_correction) {
596 default: 597 default:
597 case FEC_1_2: 598 case FEC_1_2:
598 case FEC_AUTO: 599 case FEC_AUTO:
599 f = 0; 600 fec = 0;
600 break; 601 break;
601 case FEC_2_3: 602 case FEC_2_3:
602 f = 1; 603 fec = 1;
603 break; 604 break;
604 case FEC_3_4: 605 case FEC_3_4:
605 f = 2; 606 fec = 2;
606 break; 607 break;
607 case FEC_5_6: 608 case FEC_5_6:
608 f = 3; 609 fec = 3;
609 break; 610 break;
610 case FEC_7_8: 611 case FEC_7_8:
611 f = 4; 612 fec = 4;
612 break; 613 break;
613 } 614 }
614 615
615 switch (interleaving) { 616 switch (interleaving) {
616 default: 617 default:
617 case GUARD_INTERVAL_1_4: 618 case GUARD_INTERVAL_1_4:
618 i = 0; 619 guard = 0;
619 break; 620 break;
620 case GUARD_INTERVAL_1_8: 621 case GUARD_INTERVAL_1_8:
621 i = 1; 622 guard = 1;
622 break; 623 break;
623 case GUARD_INTERVAL_1_16: 624 case GUARD_INTERVAL_1_16:
624 i = 2; 625 guard = 2;
625 break; 626 break;
626 case GUARD_INTERVAL_1_32: 627 case GUARD_INTERVAL_1_32:
627 i = 3; 628 guard = 3;
628 break; 629 break;
629 } 630 }
630 631
631 /* Samples BER at BER_SAMPLING_RATE seconds */ 632 /* Samples BER at BER_SAMPLING_RATE seconds */
632 rate = isdbt_rate[m][f][i] * segment * BER_SAMPLING_RATE; 633 rate = isdbt_rate[mod][fec][guard] * segment * BER_SAMPLING_RATE;
633 634
634 /* Avoids sampling too quickly or to overflow the register */ 635 /* Avoids sampling too quickly or to overflow the register */
635 if (rate < 256) 636 if (rate < 256)
@@ -639,13 +640,13 @@ static void mb86a20s_layer_bitrate(struct dvb_frontend *fe, u32 layer,
639 640
640 dev_dbg(&state->i2c->dev, 641 dev_dbg(&state->i2c->dev,
641 "%s: layer %c bitrate: %d kbps; counter = %d (0x%06x)\n", 642 "%s: layer %c bitrate: %d kbps; counter = %d (0x%06x)\n",
642 __func__, 'A' + layer, segment * isdbt_rate[m][f][i]/1000, 643 __func__, 'A' + layer,
644 segment * isdbt_rate[mod][fec][guard]/1000,
643 rate, rate); 645 rate, rate);
644 646
645 state->estimated_rate[layer] = rate; 647 state->estimated_rate[layer] = rate;
646} 648}
647 649
648
649static int mb86a20s_get_frontend(struct dvb_frontend *fe) 650static int mb86a20s_get_frontend(struct dvb_frontend *fe)
650{ 651{
651 struct mb86a20s_state *state = fe->demodulator_priv; 652 struct mb86a20s_state *state = fe->demodulator_priv;