summaryrefslogtreecommitdiff
path: root/drivers/media/tuners
diff options
context:
space:
mode:
authorMax Kellermann <max.kellermann@gmail.com>2016-08-09 18:32:26 -0300
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-11-18 15:05:44 -0200
commit22a613e89825ea7a3984a968463cc6d425bd8856 (patch)
treeec1841642bf43f88cf9b89323315dfca7418d0d6 /drivers/media/tuners
parent4d5030b69bb4880a760406a6d3d519f02b9351dc (diff)
[media] dvb_frontend: merge duplicate dvb_tuner_ops.release implementations
Most release callback functions are identical: free the "tuner_priv" and clear it. Let's eliminate some bloat by providing this simple implementation in the dvb_frontend library. Signed-off-by: Max Kellermann <max.kellermann@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/tuners')
-rw-r--r--drivers/media/tuners/fc0011.c10
-rw-r--r--drivers/media/tuners/fc0012.c9
-rw-r--r--drivers/media/tuners/fc0013.c9
-rw-r--r--drivers/media/tuners/mc44s803.c12
-rw-r--r--drivers/media/tuners/mt2060.c9
-rw-r--r--drivers/media/tuners/mt20xx.c12
-rw-r--r--drivers/media/tuners/mt2266.c9
-rw-r--r--drivers/media/tuners/qt1010.c9
-rw-r--r--drivers/media/tuners/tda18218.c9
-rw-r--r--drivers/media/tuners/tda827x.c11
-rw-r--r--drivers/media/tuners/tea5761.c10
-rw-r--r--drivers/media/tuners/tea5767.c10
12 files changed, 14 insertions, 105 deletions
diff --git a/drivers/media/tuners/fc0011.c b/drivers/media/tuners/fc0011.c
index 2dda8d993c14..5e9e2e694f98 100644
--- a/drivers/media/tuners/fc0011.c
+++ b/drivers/media/tuners/fc0011.c
@@ -112,14 +112,6 @@ static int fc0011_readreg(struct fc0011_priv *priv, u8 reg, u8 *val)
return 0;
}
-static int fc0011_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
-
- return 0;
-}
-
static int fc0011_init(struct dvb_frontend *fe)
{
struct fc0011_priv *priv = fe->tuner_priv;
@@ -483,7 +475,7 @@ static const struct dvb_tuner_ops fc0011_tuner_ops = {
.frequency_max = 1000000000,
},
- .release = fc0011_release,
+ .release = dvb_tuner_simple_release,
.init = fc0011_init,
.set_params = fc0011_set_params,
diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c
index d74e92056810..7faff84e5ea8 100644
--- a/drivers/media/tuners/fc0012.c
+++ b/drivers/media/tuners/fc0012.c
@@ -55,13 +55,6 @@ static int fc0012_readreg(struct fc0012_priv *priv, u8 reg, u8 *val)
return 0;
}
-static int fc0012_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
static int fc0012_init(struct dvb_frontend *fe)
{
struct fc0012_priv *priv = fe->tuner_priv;
@@ -427,7 +420,7 @@ static const struct dvb_tuner_ops fc0012_tuner_ops = {
.frequency_step = 0,
},
- .release = fc0012_release,
+ .release = dvb_tuner_simple_release,
.init = fc0012_init,
diff --git a/drivers/media/tuners/fc0013.c b/drivers/media/tuners/fc0013.c
index 522690d97b42..b068b9702cf7 100644
--- a/drivers/media/tuners/fc0013.c
+++ b/drivers/media/tuners/fc0013.c
@@ -52,13 +52,6 @@ static int fc0013_readreg(struct fc0013_priv *priv, u8 reg, u8 *val)
return 0;
}
-static int fc0013_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
static int fc0013_init(struct dvb_frontend *fe)
{
struct fc0013_priv *priv = fe->tuner_priv;
@@ -586,7 +579,7 @@ static const struct dvb_tuner_ops fc0013_tuner_ops = {
.frequency_step = 0,
},
- .release = fc0013_release,
+ .release = dvb_tuner_simple_release,
.init = fc0013_init,
.sleep = fc0013_sleep,
diff --git a/drivers/media/tuners/mc44s803.c b/drivers/media/tuners/mc44s803.c
index d5681669d3cd..86542cbd73fb 100644
--- a/drivers/media/tuners/mc44s803.c
+++ b/drivers/media/tuners/mc44s803.c
@@ -80,16 +80,6 @@ static int mc44s803_readreg(struct mc44s803_priv *priv, u8 reg, u32 *val)
return 0;
}
-static int mc44s803_release(struct dvb_frontend *fe)
-{
- struct mc44s803_priv *priv = fe->tuner_priv;
-
- fe->tuner_priv = NULL;
- kfree(priv);
-
- return 0;
-}
-
static int mc44s803_init(struct dvb_frontend *fe)
{
struct mc44s803_priv *priv = fe->tuner_priv;
@@ -312,7 +302,7 @@ static const struct dvb_tuner_ops mc44s803_tuner_ops = {
.frequency_step = 100000,
},
- .release = mc44s803_release,
+ .release = dvb_tuner_simple_release,
.init = mc44s803_init,
.set_params = mc44s803_set_params,
.get_frequency = mc44s803_get_frequency,
diff --git a/drivers/media/tuners/mt2060.c b/drivers/media/tuners/mt2060.c
index b87b2549d58d..14e7b64360cb 100644
--- a/drivers/media/tuners/mt2060.c
+++ b/drivers/media/tuners/mt2060.c
@@ -332,13 +332,6 @@ static int mt2060_sleep(struct dvb_frontend *fe)
return ret;
}
-static int mt2060_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
static const struct dvb_tuner_ops mt2060_tuner_ops = {
.info = {
.name = "Microtune MT2060",
@@ -347,7 +340,7 @@ static const struct dvb_tuner_ops mt2060_tuner_ops = {
.frequency_step = 50000,
},
- .release = mt2060_release,
+ .release = dvb_tuner_simple_release,
.init = mt2060_init,
.sleep = mt2060_sleep,
diff --git a/drivers/media/tuners/mt20xx.c b/drivers/media/tuners/mt20xx.c
index 29dadd171b31..4237d8f15919 100644
--- a/drivers/media/tuners/mt20xx.c
+++ b/drivers/media/tuners/mt20xx.c
@@ -49,14 +49,6 @@ struct microtune_priv {
u32 frequency;
};
-static int microtune_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
-
- return 0;
-}
-
static int microtune_get_frequency(struct dvb_frontend *fe, u32 *frequency)
{
struct microtune_priv *priv = fe->tuner_priv;
@@ -365,7 +357,7 @@ static int mt2032_set_params(struct dvb_frontend *fe,
static const struct dvb_tuner_ops mt2032_tuner_ops = {
.set_analog_params = mt2032_set_params,
- .release = microtune_release,
+ .release = dvb_tuner_simple_release,
.get_frequency = microtune_get_frequency,
};
@@ -560,7 +552,7 @@ static int mt2050_set_params(struct dvb_frontend *fe,
static const struct dvb_tuner_ops mt2050_tuner_ops = {
.set_analog_params = mt2050_set_params,
- .release = microtune_release,
+ .release = dvb_tuner_simple_release,
.get_frequency = microtune_get_frequency,
};
diff --git a/drivers/media/tuners/mt2266.c b/drivers/media/tuners/mt2266.c
index bca4d75e42d4..35ea5e7975ac 100644
--- a/drivers/media/tuners/mt2266.c
+++ b/drivers/media/tuners/mt2266.c
@@ -296,13 +296,6 @@ static int mt2266_sleep(struct dvb_frontend *fe)
return 0;
}
-static int mt2266_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
static const struct dvb_tuner_ops mt2266_tuner_ops = {
.info = {
.name = "Microtune MT2266",
@@ -310,7 +303,7 @@ static const struct dvb_tuner_ops mt2266_tuner_ops = {
.frequency_max = 862000000,
.frequency_step = 50000,
},
- .release = mt2266_release,
+ .release = dvb_tuner_simple_release,
.init = mt2266_init,
.sleep = mt2266_sleep,
.set_params = mt2266_set_params,
diff --git a/drivers/media/tuners/qt1010.c b/drivers/media/tuners/qt1010.c
index ae8cbece6d2b..5a1662aeeb87 100644
--- a/drivers/media/tuners/qt1010.c
+++ b/drivers/media/tuners/qt1010.c
@@ -377,13 +377,6 @@ static int qt1010_init(struct dvb_frontend *fe)
return qt1010_set_params(fe);
}
-static int qt1010_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
static int qt1010_get_frequency(struct dvb_frontend *fe, u32 *frequency)
{
struct qt1010_priv *priv = fe->tuner_priv;
@@ -405,7 +398,7 @@ static const struct dvb_tuner_ops qt1010_tuner_ops = {
.frequency_step = QT1010_STEP,
},
- .release = qt1010_release,
+ .release = dvb_tuner_simple_release,
.init = qt1010_init,
/* TODO: implement sleep */
diff --git a/drivers/media/tuners/tda18218.c b/drivers/media/tuners/tda18218.c
index 9300e9361e3b..4d2916fb9953 100644
--- a/drivers/media/tuners/tda18218.c
+++ b/drivers/media/tuners/tda18218.c
@@ -265,13 +265,6 @@ static int tda18218_init(struct dvb_frontend *fe)
return ret;
}
-static int tda18218_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
static const struct dvb_tuner_ops tda18218_tuner_ops = {
.info = {
.name = "NXP TDA18218",
@@ -281,7 +274,7 @@ static const struct dvb_tuner_ops tda18218_tuner_ops = {
.frequency_step = 1000,
},
- .release = tda18218_release,
+ .release = dvb_tuner_simple_release,
.init = tda18218_init,
.sleep = tda18218_sleep,
diff --git a/drivers/media/tuners/tda827x.c b/drivers/media/tuners/tda827x.c
index 5050ce9be423..4befb81f0c1a 100644
--- a/drivers/media/tuners/tda827x.c
+++ b/drivers/media/tuners/tda827x.c
@@ -767,13 +767,6 @@ static void tda827xa_agcf(struct dvb_frontend *fe)
/* ------------------------------------------------------------------ */
-static int tda827x_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
- return 0;
-}
-
static int tda827x_get_frequency(struct dvb_frontend *fe, u32 *frequency)
{
struct tda827x_priv *priv = fe->tuner_priv;
@@ -825,7 +818,7 @@ static const struct dvb_tuner_ops tda827xo_tuner_ops = {
.frequency_max = 860000000,
.frequency_step = 250000
},
- .release = tda827x_release,
+ .release = dvb_tuner_simple_release,
.init = tda827x_initial_init,
.sleep = tda827x_initial_sleep,
.set_params = tda827xo_set_params,
@@ -841,7 +834,7 @@ static const struct dvb_tuner_ops tda827xa_tuner_ops = {
.frequency_max = 906000000,
.frequency_step = 62500
},
- .release = tda827x_release,
+ .release = dvb_tuner_simple_release,
.init = tda827x_init,
.sleep = tda827xa_sleep,
.set_params = tda827xa_set_params,
diff --git a/drivers/media/tuners/tea5761.c b/drivers/media/tuners/tea5761.c
index 12347aa95de3..82f25621d995 100644
--- a/drivers/media/tuners/tea5761.c
+++ b/drivers/media/tuners/tea5761.c
@@ -284,14 +284,6 @@ int tea5761_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr)
return 0;
}
-static int tea5761_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
-
- return 0;
-}
-
static int tea5761_get_frequency(struct dvb_frontend *fe, u32 *frequency)
{
struct tea5761_priv *priv = fe->tuner_priv;
@@ -305,7 +297,7 @@ static const struct dvb_tuner_ops tea5761_tuner_ops = {
},
.set_analog_params = set_radio_freq,
.sleep = set_radio_sleep,
- .release = tea5761_release,
+ .release = dvb_tuner_simple_release,
.get_frequency = tea5761_get_frequency,
.get_status = tea5761_get_status,
.get_rf_strength = tea5761_get_rf_strength,
diff --git a/drivers/media/tuners/tea5767.c b/drivers/media/tuners/tea5767.c
index d62a6d6b1f42..a33c97de8b8a 100644
--- a/drivers/media/tuners/tea5767.c
+++ b/drivers/media/tuners/tea5767.c
@@ -401,14 +401,6 @@ int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr)
return 0;
}
-static int tea5767_release(struct dvb_frontend *fe)
-{
- kfree(fe->tuner_priv);
- fe->tuner_priv = NULL;
-
- return 0;
-}
-
static int tea5767_get_frequency(struct dvb_frontend *fe, u32 *frequency)
{
struct tea5767_priv *priv = fe->tuner_priv;
@@ -434,7 +426,7 @@ static const struct dvb_tuner_ops tea5767_tuner_ops = {
.set_analog_params = set_radio_freq,
.set_config = tea5767_set_config,
.sleep = tea5767_standby,
- .release = tea5767_release,
+ .release = dvb_tuner_simple_release,
.get_frequency = tea5767_get_frequency,
.get_status = tea5767_get_status,
.get_rf_strength = tea5767_get_rf_strength,