diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-07 19:50:34 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-04-08 06:10:17 -0400 |
commit | 4f62a20dfbdf46825dea707a033f941874e34930 (patch) | |
tree | 08bdbefc7417c9d7786e9fd5040718e9fa75c925 /drivers/media/dvb-frontends/mb86a20s.c | |
parent | 1bacb2df3bc999dcad21e9aab6bdb60d6dc7bc02 (diff) |
[media] mb86a20s: Use a macro for the number of layers
Instead of using the magic number "3", use NUM_LAYERS macro
on all places that are related to the ISDB-T layers.
This makes the source code a little more readable.
No functional changes.
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>
Diffstat (limited to 'drivers/media/dvb-frontends/mb86a20s.c')
-rw-r--r-- | drivers/media/dvb-frontends/mb86a20s.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c index d04b52e3f4cc..80a8ee090c80 100644 --- a/drivers/media/dvb-frontends/mb86a20s.c +++ b/drivers/media/dvb-frontends/mb86a20s.c | |||
@@ -20,6 +20,8 @@ | |||
20 | #include "dvb_frontend.h" | 20 | #include "dvb_frontend.h" |
21 | #include "mb86a20s.h" | 21 | #include "mb86a20s.h" |
22 | 22 | ||
23 | #define NUM_LAYERS 3 | ||
24 | |||
23 | static int debug = 1; | 25 | static int debug = 1; |
24 | module_param(debug, int, 0644); | 26 | module_param(debug, int, 0644); |
25 | MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); | 27 | MODULE_PARM_DESC(debug, "Activates frontend debugging (default:0)"); |
@@ -48,7 +50,7 @@ struct mb86a20s_state { | |||
48 | bool inversion; | 50 | bool inversion; |
49 | u32 subchannel; | 51 | u32 subchannel; |
50 | 52 | ||
51 | u32 estimated_rate[3]; | 53 | u32 estimated_rate[NUM_LAYERS]; |
52 | unsigned long get_strength_time; | 54 | unsigned long get_strength_time; |
53 | 55 | ||
54 | bool need_init; | 56 | bool need_init; |
@@ -666,7 +668,7 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe) | |||
666 | 668 | ||
667 | /* Get per-layer data */ | 669 | /* Get per-layer data */ |
668 | 670 | ||
669 | for (i = 0; i < 3; i++) { | 671 | for (i = 0; i < NUM_LAYERS; i++) { |
670 | dev_dbg(&state->i2c->dev, "%s: getting data for layer %c.\n", | 672 | dev_dbg(&state->i2c->dev, "%s: getting data for layer %c.\n", |
671 | __func__, 'A' + i); | 673 | __func__, 'A' + i); |
672 | 674 | ||
@@ -828,7 +830,7 @@ static int mb86a20s_get_pre_ber(struct dvb_frontend *fe, | |||
828 | 830 | ||
829 | dev_dbg(&state->i2c->dev, "%s called.\n", __func__); | 831 | dev_dbg(&state->i2c->dev, "%s called.\n", __func__); |
830 | 832 | ||
831 | if (layer >= 3) | 833 | if (layer >= NUM_LAYERS) |
832 | return -EINVAL; | 834 | return -EINVAL; |
833 | 835 | ||
834 | /* Check if the BER measures are already available */ | 836 | /* Check if the BER measures are already available */ |
@@ -962,7 +964,7 @@ static int mb86a20s_get_post_ber(struct dvb_frontend *fe, | |||
962 | 964 | ||
963 | dev_dbg(&state->i2c->dev, "%s called.\n", __func__); | 965 | dev_dbg(&state->i2c->dev, "%s called.\n", __func__); |
964 | 966 | ||
965 | if (layer >= 3) | 967 | if (layer >= NUM_LAYERS) |
966 | return -EINVAL; | 968 | return -EINVAL; |
967 | 969 | ||
968 | /* Check if the BER measures are already available */ | 970 | /* Check if the BER measures are already available */ |
@@ -1089,7 +1091,7 @@ static int mb86a20s_get_blk_error(struct dvb_frontend *fe, | |||
1089 | u32 collect_rate; | 1091 | u32 collect_rate; |
1090 | dev_dbg(&state->i2c->dev, "%s called.\n", __func__); | 1092 | dev_dbg(&state->i2c->dev, "%s called.\n", __func__); |
1091 | 1093 | ||
1092 | if (layer >= 3) | 1094 | if (layer >= NUM_LAYERS) |
1093 | return -EINVAL; | 1095 | return -EINVAL; |
1094 | 1096 | ||
1095 | /* Check if the PER measures are already available */ | 1097 | /* Check if the PER measures are already available */ |
@@ -1476,7 +1478,7 @@ static int mb86a20s_get_blk_error_layer_CNR(struct dvb_frontend *fe) | |||
1476 | } | 1478 | } |
1477 | 1479 | ||
1478 | /* Read all layers */ | 1480 | /* Read all layers */ |
1479 | for (i = 0; i < 3; i++) { | 1481 | for (i = 0; i < NUM_LAYERS; i++) { |
1480 | if (!(c->isdbt_layer_enabled & (1 << i))) { | 1482 | if (!(c->isdbt_layer_enabled & (1 << i))) { |
1481 | c->cnr.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; | 1483 | c->cnr.stat[1 + i].scale = FE_SCALE_NOT_AVAILABLE; |
1482 | continue; | 1484 | continue; |
@@ -1565,20 +1567,20 @@ static void mb86a20s_stats_not_ready(struct dvb_frontend *fe) | |||
1565 | c->strength.len = 1; | 1567 | c->strength.len = 1; |
1566 | 1568 | ||
1567 | /* Per-layer stats - 3 layers + global */ | 1569 | /* Per-layer stats - 3 layers + global */ |
1568 | c->cnr.len = 4; | 1570 | c->cnr.len = NUM_LAYERS + 1; |
1569 | c->pre_bit_error.len = 4; | 1571 | c->pre_bit_error.len = NUM_LAYERS + 1; |
1570 | c->pre_bit_count.len = 4; | 1572 | c->pre_bit_count.len = NUM_LAYERS + 1; |
1571 | c->post_bit_error.len = 4; | 1573 | c->post_bit_error.len = NUM_LAYERS + 1; |
1572 | c->post_bit_count.len = 4; | 1574 | c->post_bit_count.len = NUM_LAYERS + 1; |
1573 | c->block_error.len = 4; | 1575 | c->block_error.len = NUM_LAYERS + 1; |
1574 | c->block_count.len = 4; | 1576 | c->block_count.len = NUM_LAYERS + 1; |
1575 | 1577 | ||
1576 | /* Signal is always available */ | 1578 | /* Signal is always available */ |
1577 | c->strength.stat[0].scale = FE_SCALE_RELATIVE; | 1579 | c->strength.stat[0].scale = FE_SCALE_RELATIVE; |
1578 | c->strength.stat[0].uvalue = 0; | 1580 | c->strength.stat[0].uvalue = 0; |
1579 | 1581 | ||
1580 | /* Put all of them at FE_SCALE_NOT_AVAILABLE */ | 1582 | /* Put all of them at FE_SCALE_NOT_AVAILABLE */ |
1581 | for (i = 0; i < 4; i++) { | 1583 | for (i = 0; i < NUM_LAYERS + 1; i++) { |
1582 | c->cnr.stat[i].scale = FE_SCALE_NOT_AVAILABLE; | 1584 | c->cnr.stat[i].scale = FE_SCALE_NOT_AVAILABLE; |
1583 | c->pre_bit_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE; | 1585 | c->pre_bit_error.stat[i].scale = FE_SCALE_NOT_AVAILABLE; |
1584 | c->pre_bit_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE; | 1586 | c->pre_bit_count.stat[i].scale = FE_SCALE_NOT_AVAILABLE; |
@@ -1617,7 +1619,7 @@ static int mb86a20s_get_stats(struct dvb_frontend *fe, int status_nr) | |||
1617 | if (status_nr < 9) | 1619 | if (status_nr < 9) |
1618 | return 0; | 1620 | return 0; |
1619 | 1621 | ||
1620 | for (i = 0; i < 3; i++) { | 1622 | for (i = 0; i < NUM_LAYERS; i++) { |
1621 | if (c->isdbt_layer_enabled & (1 << i)) { | 1623 | if (c->isdbt_layer_enabled & (1 << i)) { |
1622 | /* Layer is active and has rc segments */ | 1624 | /* Layer is active and has rc segments */ |
1623 | active_layers++; | 1625 | active_layers++; |