summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Scheller <d.scheller@gmx.net>2018-02-25 07:31:31 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2018-03-06 10:57:49 -0500
commit66a4c0c749cf9b3ce363085709219cc325d2a647 (patch)
treef02705ba2520b859417191ca5be36d6557717313
parent6795bf6264829b6678f646164d5ab5e335a99fb1 (diff)
media: ngene: use defines to identify the demod_type
Make it more clear which demod_type is used for which hardware by having defines for the possible demod_type values. With that, change the demod_type evaluation in tuner_attach_probe() to a switch-case instead of an if() for each possible value. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/pci/ngene/ngene-cards.c11
-rw-r--r--drivers/media/pci/ngene/ngene.h3
2 files changed, 10 insertions, 4 deletions
diff --git a/drivers/media/pci/ngene/ngene-cards.c b/drivers/media/pci/ngene/ngene-cards.c
index 16666de8cbee..065b83ee569b 100644
--- a/drivers/media/pci/ngene/ngene-cards.c
+++ b/drivers/media/pci/ngene/ngene-cards.c
@@ -123,10 +123,13 @@ static int tuner_attach_tda18271(struct ngene_channel *chan)
static int tuner_attach_probe(struct ngene_channel *chan)
{
- if (chan->demod_type == 0)
+ switch (chan->demod_type) {
+ case DEMOD_TYPE_STV090X:
return tuner_attach_stv6110(chan);
- if (chan->demod_type == 1)
+ case DEMOD_TYPE_DRXK:
return tuner_attach_tda18271(chan);
+ }
+
return -EINVAL;
}
@@ -251,7 +254,7 @@ static int cineS2_probe(struct ngene_channel *chan)
i2c = &chan->dev->channel[1].i2c_adapter;
if (port_has_stv0900(i2c, chan->number)) {
- chan->demod_type = 0;
+ chan->demod_type = DEMOD_TYPE_STV090X;
fe_conf = chan->dev->card_info->fe_config[chan->number];
/* demod found, attach it */
rc = demod_attach_stv0900(chan);
@@ -280,7 +283,7 @@ static int cineS2_probe(struct ngene_channel *chan)
return -EIO;
}
} else if (port_has_drxk(i2c, chan->number^2)) {
- chan->demod_type = 1;
+ chan->demod_type = DEMOD_TYPE_DRXK;
demod_attach_drxk(chan, i2c);
} else {
dev_err(pdev, "No demod found on chan %d\n", chan->number);
diff --git a/drivers/media/pci/ngene/ngene.h b/drivers/media/pci/ngene/ngene.h
index caf8602c7459..9724701a3274 100644
--- a/drivers/media/pci/ngene/ngene.h
+++ b/drivers/media/pci/ngene/ngene.h
@@ -51,6 +51,9 @@
#define VIDEO_CAP_MPEG4 512
#endif
+#define DEMOD_TYPE_STV090X 0
+#define DEMOD_TYPE_DRXK 1
+
enum STREAM {
STREAM_VIDEOIN1 = 0, /* ITU656 or TS Input */
STREAM_VIDEOIN2,