* [PATCH v3 1/4] dvb: qm1d1c0042: use dvb-core i2c binding model template
2015-01-16 11:24 [PATCH v3 0/4] modify earth-pt3 and its dependees to use i2c template tskd08
@ 2015-01-16 11:24 ` tskd08
2015-01-16 11:24 ` [PATCH v3 2/4] dvb: mxl301rf: " tskd08
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: tskd08 @ 2015-01-16 11:24 UTC (permalink / raw)
To: linux-media; +Cc: m.chehab, Akihiro Tsukada
From: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
---
drivers/media/tuners/qm1d1c0042.c | 60 +++++++++++++--------------------------
drivers/media/tuners/qm1d1c0042.h | 2 --
2 files changed, 19 insertions(+), 43 deletions(-)
diff --git a/drivers/media/tuners/qm1d1c0042.c b/drivers/media/tuners/qm1d1c0042.c
index 18bc745..b6d637d 100644
--- a/drivers/media/tuners/qm1d1c0042.c
+++ b/drivers/media/tuners/qm1d1c0042.c
@@ -29,6 +29,7 @@
#include <linux/kernel.h>
#include <linux/math64.h>
+#include "dvb_i2c.h"
#include "qm1d1c0042.h"
#define QM1D1C0042_NUM_REGS 0x20
@@ -55,11 +56,6 @@ struct qm1d1c0042_state {
u8 regs[QM1D1C0042_NUM_REGS];
};
-static struct qm1d1c0042_state *cfg_to_state(struct qm1d1c0042_config *c)
-{
- return container_of(c, struct qm1d1c0042_state, cfg);
-}
-
static int reg_write(struct qm1d1c0042_state *state, u8 reg, u8 val)
{
u8 wbuf[2] = { reg, val };
@@ -106,10 +102,12 @@ static int qm1d1c0042_set_srch_mode(struct qm1d1c0042_state *state, bool fast)
return reg_write(state, 0x03, state->regs[0x03]);
}
-static int qm1d1c0042_wakeup(struct qm1d1c0042_state *state)
+static int qm1d1c0042_wakeup(struct dvb_frontend *fe)
{
+ struct qm1d1c0042_state *state;
int ret;
+ state = fe->tuner_priv;
state->regs[0x01] |= 1 << 3; /* BB_Reg_enable */
state->regs[0x01] &= (~(1 << 0)) & 0xff; /* NORMAL (wake-up) */
state->regs[0x05] &= (~(1 << 3)) & 0xff; /* pfd_rst NORMAL */
@@ -119,7 +117,7 @@ static int qm1d1c0042_wakeup(struct qm1d1c0042_state *state)
if (ret < 0)
dev_warn(&state->i2c->dev, "(%s) failed. [adap%d-fe%d]\n",
- __func__, state->cfg.fe->dvb->num, state->cfg.fe->id);
+ __func__, fe->dvb->num, fe->id);
return ret;
}
@@ -133,9 +131,6 @@ static int qm1d1c0042_set_config(struct dvb_frontend *fe, void *priv_cfg)
state = fe->tuner_priv;
cfg = priv_cfg;
- if (cfg->fe)
- state->cfg.fe = cfg->fe;
-
if (cfg->xtal_freq != QM1D1C0042_CFG_XTAL_DFLT)
dev_warn(&state->i2c->dev,
"(%s) changing xtal_freq not supported. ", __func__);
@@ -359,7 +354,7 @@ static int qm1d1c0042_init(struct dvb_frontend *fe)
goto failed;
}
- ret = qm1d1c0042_wakeup(state);
+ ret = qm1d1c0042_wakeup(fe);
if (ret < 0)
goto failed;
@@ -395,33 +390,18 @@ static const struct dvb_tuner_ops qm1d1c0042_ops = {
static int qm1d1c0042_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
- struct qm1d1c0042_state *state;
- struct qm1d1c0042_config *cfg;
+ struct dvb_i2c_tuner_config *cfg;
struct dvb_frontend *fe;
-
- state = kzalloc(sizeof(*state), GFP_KERNEL);
- if (!state)
- return -ENOMEM;
- state->i2c = client;
+ struct qm1d1c0042_state *state;
cfg = client->dev.platform_data;
fe = cfg->fe;
- fe->tuner_priv = state;
- qm1d1c0042_set_config(fe, cfg);
- memcpy(&fe->ops.tuner_ops, &qm1d1c0042_ops, sizeof(qm1d1c0042_ops));
+ state = fe->tuner_priv;
+ state->i2c = client;
- i2c_set_clientdata(client, &state->cfg);
- dev_info(&client->dev, "Sharp QM1D1C0042 attached.\n");
- return 0;
-}
+ qm1d1c0042_set_config(fe, (void *)cfg->devcfg.priv_cfg);
-static int qm1d1c0042_remove(struct i2c_client *client)
-{
- struct qm1d1c0042_state *state;
-
- state = cfg_to_state(i2c_get_clientdata(client));
- state->cfg.fe->tuner_priv = NULL;
- kfree(state);
+ dev_info(&client->dev, "Sharp QM1D1C0042 attached.\n");
return 0;
}
@@ -430,18 +410,16 @@ static const struct i2c_device_id qm1d1c0042_id[] = {
{"qm1d1c0042", 0},
{}
};
-MODULE_DEVICE_TABLE(i2c, qm1d1c0042_id);
-static struct i2c_driver qm1d1c0042_driver = {
- .driver = {
- .name = "qm1d1c0042",
- },
- .probe = qm1d1c0042_probe,
- .remove = qm1d1c0042_remove,
- .id_table = qm1d1c0042_id,
+static const struct dvb_i2c_module_param qm1d1c0042_param = {
+ .ops.tuner_ops = &qm1d1c0042_ops,
+ .priv_probe = qm1d1c0042_probe,
+
+ .priv_size = sizeof(struct qm1d1c0042_state),
+ .is_tuner = true,
};
-module_i2c_driver(qm1d1c0042_driver);
+DEFINE_DVB_I2C_MODULE(qm1d1c0042, qm1d1c0042_id, qm1d1c0042_param);
MODULE_DESCRIPTION("Sharp QM1D1C0042 tuner");
MODULE_AUTHOR("Akihiro TSUKADA");
diff --git a/drivers/media/tuners/qm1d1c0042.h b/drivers/media/tuners/qm1d1c0042.h
index 4f5c188..043787e 100644
--- a/drivers/media/tuners/qm1d1c0042.h
+++ b/drivers/media/tuners/qm1d1c0042.h
@@ -21,8 +21,6 @@
struct qm1d1c0042_config {
- struct dvb_frontend *fe;
-
u32 xtal_freq; /* [kHz] */ /* currently ignored */
bool lpf; /* enable LPF */
bool fast_srch; /* enable fast search mode, no LPF */
--
2.2.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 2/4] dvb: mxl301rf: use dvb-core i2c binding model template
2015-01-16 11:24 [PATCH v3 0/4] modify earth-pt3 and its dependees to use i2c template tskd08
2015-01-16 11:24 ` [PATCH v3 1/4] dvb: qm1d1c0042: use dvb-core i2c binding model template tskd08
@ 2015-01-16 11:24 ` tskd08
2015-01-16 11:24 ` [PATCH v3 3/4] dvb: tc90522: " tskd08
2015-01-16 11:24 ` [PATCH v3 4/4] dvb: earth-pt3: " tskd08
3 siblings, 0 replies; 5+ messages in thread
From: tskd08 @ 2015-01-16 11:24 UTC (permalink / raw)
To: linux-media; +Cc: m.chehab, Akihiro Tsukada
From: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
---
drivers/media/tuners/mxl301rf.c | 50 +++++++++++------------------------------
drivers/media/tuners/mxl301rf.h | 2 +-
2 files changed, 14 insertions(+), 38 deletions(-)
diff --git a/drivers/media/tuners/mxl301rf.c b/drivers/media/tuners/mxl301rf.c
index 1575a5d..d94a692 100644
--- a/drivers/media/tuners/mxl301rf.c
+++ b/drivers/media/tuners/mxl301rf.c
@@ -29,6 +29,8 @@
*/
#include <linux/kernel.h>
+#include "dvb_i2c.h"
+
#include "mxl301rf.h"
struct mxl301rf_state {
@@ -36,11 +38,6 @@ struct mxl301rf_state {
struct i2c_client *i2c;
};
-static struct mxl301rf_state *cfg_to_state(struct mxl301rf_config *c)
-{
- return container_of(c, struct mxl301rf_state, cfg);
-}
-
static int raw_write(struct mxl301rf_state *state, const u8 *buf, int len)
{
int ret;
@@ -295,54 +292,33 @@ static const struct dvb_tuner_ops mxl301rf_ops = {
static int mxl301rf_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
+ struct dvb_i2c_tuner_config *cfg;
struct mxl301rf_state *state;
- struct mxl301rf_config *cfg;
- struct dvb_frontend *fe;
- state = kzalloc(sizeof(*state), GFP_KERNEL);
- if (!state)
- return -ENOMEM;
-
- state->i2c = client;
cfg = client->dev.platform_data;
+ state = cfg->fe->tuner_priv;
+ state->i2c = client;
- memcpy(&state->cfg, cfg, sizeof(state->cfg));
- fe = cfg->fe;
- fe->tuner_priv = state;
- memcpy(&fe->ops.tuner_ops, &mxl301rf_ops, sizeof(mxl301rf_ops));
+ memcpy(&state->cfg, cfg->devcfg.priv_cfg, sizeof(state->cfg));
- i2c_set_clientdata(client, &state->cfg);
dev_info(&client->dev, "MaxLinear MxL301RF attached.\n");
return 0;
}
-static int mxl301rf_remove(struct i2c_client *client)
-{
- struct mxl301rf_state *state;
-
- state = cfg_to_state(i2c_get_clientdata(client));
- state->cfg.fe->tuner_priv = NULL;
- kfree(state);
- return 0;
-}
-
-
static const struct i2c_device_id mxl301rf_id[] = {
{"mxl301rf", 0},
{}
};
-MODULE_DEVICE_TABLE(i2c, mxl301rf_id);
-static struct i2c_driver mxl301rf_driver = {
- .driver = {
- .name = "mxl301rf",
- },
- .probe = mxl301rf_probe,
- .remove = mxl301rf_remove,
- .id_table = mxl301rf_id,
+static const struct dvb_i2c_module_param mxl301rf_param = {
+ .ops.tuner_ops = &mxl301rf_ops,
+ .priv_probe = mxl301rf_probe,
+
+ .priv_size = sizeof(struct mxl301rf_state),
+ .is_tuner = true,
};
-module_i2c_driver(mxl301rf_driver);
+DEFINE_DVB_I2C_MODULE(mxl301rf, mxl301rf_id, mxl301rf_param);
MODULE_DESCRIPTION("MaxLinear MXL301RF tuner");
MODULE_AUTHOR("Akihiro TSUKADA");
diff --git a/drivers/media/tuners/mxl301rf.h b/drivers/media/tuners/mxl301rf.h
index 19e6840..069a6a0 100644
--- a/drivers/media/tuners/mxl301rf.h
+++ b/drivers/media/tuners/mxl301rf.h
@@ -20,7 +20,7 @@
#include "dvb_frontend.h"
struct mxl301rf_config {
- struct dvb_frontend *fe;
+ /* none now */
};
#endif /* MXL301RF_H */
--
2.2.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 3/4] dvb: tc90522: use dvb-core i2c binding model template
2015-01-16 11:24 [PATCH v3 0/4] modify earth-pt3 and its dependees to use i2c template tskd08
2015-01-16 11:24 ` [PATCH v3 1/4] dvb: qm1d1c0042: use dvb-core i2c binding model template tskd08
2015-01-16 11:24 ` [PATCH v3 2/4] dvb: mxl301rf: " tskd08
@ 2015-01-16 11:24 ` tskd08
2015-01-16 11:24 ` [PATCH v3 4/4] dvb: earth-pt3: " tskd08
3 siblings, 0 replies; 5+ messages in thread
From: tskd08 @ 2015-01-16 11:24 UTC (permalink / raw)
To: linux-media; +Cc: m.chehab, Akihiro Tsukada
From: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
---
drivers/media/dvb-frontends/tc90522.c | 64 ++++++++++++++++-------------------
drivers/media/dvb-frontends/tc90522.h | 8 ++---
2 files changed, 34 insertions(+), 38 deletions(-)
diff --git a/drivers/media/dvb-frontends/tc90522.c b/drivers/media/dvb-frontends/tc90522.c
index b35d65c..123f42d 100644
--- a/drivers/media/dvb-frontends/tc90522.c
+++ b/drivers/media/dvb-frontends/tc90522.c
@@ -30,6 +30,7 @@
#include <linux/kernel.h>
#include <linux/math64.h>
#include <linux/dvb/frontend.h>
+#include "dvb_i2c.h"
#include "dvb_math.h"
#include "tc90522.h"
@@ -39,7 +40,6 @@
struct tc90522_state {
struct tc90522_config cfg;
- struct dvb_frontend fe;
struct i2c_client *i2c_client;
struct i2c_adapter tuner_i2c;
@@ -98,11 +98,6 @@ static int reg_read(struct tc90522_state *state, u8 reg, u8 *val, u8 len)
return ret;
}
-static struct tc90522_state *cfg_to_state(struct tc90522_config *c)
-{
- return container_of(c, struct tc90522_state, cfg);
-}
-
static int tc90522s_set_tsid(struct dvb_frontend *fe)
{
@@ -512,7 +507,7 @@ static int tc90522_set_frontend(struct dvb_frontend *fe)
return 0;
failed:
- dev_warn(&state->tuner_i2c.dev, "(%s) failed. [adap%d-fe%d]\n",
+ dev_warn(&state->i2c_client->dev, "(%s) failed. [adap%d-fe%d]\n",
__func__, fe->dvb->num, fe->id);
return ret;
}
@@ -587,7 +582,7 @@ static int tc90522_sleep(struct dvb_frontend *fe)
}
}
if (ret < 0)
- dev_warn(&state->tuner_i2c.dev,
+ dev_warn(&state->i2c_client->dev,
"(%s) failed. [adap%d-fe%d]\n",
__func__, fe->dvb->num, fe->id);
return ret;
@@ -620,7 +615,7 @@ static int tc90522_init(struct dvb_frontend *fe)
}
}
if (ret < 0) {
- dev_warn(&state->tuner_i2c.dev,
+ dev_warn(&state->i2c_client->dev,
"(%s) failed. [adap%d-fe%d]\n",
__func__, fe->dvb->num, fe->id);
return ret;
@@ -640,6 +635,7 @@ static int tc90522_init(struct dvb_frontend *fe)
static int
tc90522_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
{
+ struct dvb_frontend *fe;
struct tc90522_state *state;
struct i2c_msg *new_msgs;
int i, j;
@@ -658,7 +654,8 @@ tc90522_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
if (!new_msgs)
return -ENOMEM;
- state = i2c_get_adapdata(adap);
+ fe = i2c_get_adapdata(adap);
+ state = fe->demodulator_priv;
p = wbuf;
bufend = wbuf + sizeof(wbuf);
for (i = 0, j = 0; i < num; i++, j++) {
@@ -766,51 +763,51 @@ static const struct dvb_frontend_ops tc90522_ops_ter = {
static int tc90522_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
+ struct dvb_frontend *fe;
struct tc90522_state *state;
- struct tc90522_config *cfg;
+ struct dvb_i2c_dev_config *cfg;
const struct dvb_frontend_ops *ops;
struct i2c_adapter *adap;
int ret;
- state = kzalloc(sizeof(*state), GFP_KERNEL);
- if (!state)
- return -ENOMEM;
+ fe = i2c_get_clientdata(client);
+ state = fe->demodulator_priv;
state->i2c_client = client;
cfg = client->dev.platform_data;
- memcpy(&state->cfg, cfg, sizeof(state->cfg));
- cfg->fe = state->cfg.fe = &state->fe;
+ if (cfg && cfg->priv_cfg)
+ memcpy(&state->cfg, cfg->priv_cfg, sizeof(state->cfg));
ops = id->driver_data == 0 ? &tc90522_ops_sat : &tc90522_ops_ter;
- memcpy(&state->fe.ops, ops, sizeof(*ops));
- state->fe.demodulator_priv = state;
+ memcpy(&fe->ops, ops, sizeof(*ops));
adap = &state->tuner_i2c;
adap->owner = THIS_MODULE;
adap->algo = &tc90522_tuner_i2c_algo;
adap->dev.parent = &client->dev;
strlcpy(adap->name, "tc90522_sub", sizeof(adap->name));
- i2c_set_adapdata(adap, state);
ret = i2c_add_adapter(adap);
if (ret < 0)
- goto err;
- cfg->tuner_i2c = state->cfg.tuner_i2c = adap;
+ goto err_mem;
+ if (cfg && cfg->out)
+ *cfg->out = (struct tc90522_out *)adap;
+ i2c_set_adapdata(adap, fe); /* used in tc90522_master_xfer() */
- i2c_set_clientdata(client, &state->cfg);
dev_info(&client->dev, "Toshiba TC90522 attached.\n");
return 0;
-err:
+err_mem:
kfree(state);
return ret;
}
static int tc90522_remove(struct i2c_client *client)
{
+ struct dvb_frontend *fe;
struct tc90522_state *state;
- state = cfg_to_state(i2c_get_clientdata(client));
+ fe = i2c_get_clientdata(client);
+ state = fe->demodulator_priv;
i2c_del_adapter(&state->tuner_i2c);
- kfree(state);
return 0;
}
@@ -820,18 +817,17 @@ static const struct i2c_device_id tc90522_id[] = {
{ TC90522_I2C_DEV_TER, 1 },
{}
};
-MODULE_DEVICE_TABLE(i2c, tc90522_id);
-static struct i2c_driver tc90522_driver = {
- .driver = {
- .name = "tc90522",
- },
- .probe = tc90522_probe,
- .remove = tc90522_remove,
- .id_table = tc90522_id,
+static const struct dvb_i2c_module_param tc90522_param = {
+ .ops.fe_ops = NULL,
+ .priv_probe = tc90522_probe,
+ .priv_remove = tc90522_remove,
+
+ .priv_size = sizeof(struct tc90522_state),
+ .is_tuner = false,
};
-module_i2c_driver(tc90522_driver);
+DEFINE_DVB_I2C_MODULE(tc90522, tc90522_id, tc90522_param);
MODULE_DESCRIPTION("Toshiba TC90522 frontend");
MODULE_AUTHOR("Akihiro TSUKADA");
diff --git a/drivers/media/dvb-frontends/tc90522.h b/drivers/media/dvb-frontends/tc90522.h
index b1cbddf..4b69d03 100644
--- a/drivers/media/dvb-frontends/tc90522.h
+++ b/drivers/media/dvb-frontends/tc90522.h
@@ -32,11 +32,11 @@
#define TC90522_I2C_DEV_TER "tc90522ter"
struct tc90522_config {
- /* [OUT] frontend returned by driver */
- struct dvb_frontend *fe;
+ /* none now */
+};
- /* [OUT] tuner I2C adapter returned by driver */
- struct i2c_adapter *tuner_i2c;
+struct tc90522_out {
+ struct i2c_adapter demod_bus;
};
#endif /* TC90522_H */
--
2.2.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 4/4] dvb: earth-pt3: use dvb-core i2c binding model template
2015-01-16 11:24 [PATCH v3 0/4] modify earth-pt3 and its dependees to use i2c template tskd08
` (2 preceding siblings ...)
2015-01-16 11:24 ` [PATCH v3 3/4] dvb: tc90522: " tskd08
@ 2015-01-16 11:24 ` tskd08
3 siblings, 0 replies; 5+ messages in thread
From: tskd08 @ 2015-01-16 11:24 UTC (permalink / raw)
To: linux-media; +Cc: m.chehab, Akihiro Tsukada
From: Akihiro Tsukada <tskd08@gmail.com>
Signed-off-by: Akihiro Tsukada <tskd08@gmail.com>
---
drivers/media/pci/pt3/pt3.c | 85 ++++++++++++++-------------------------------
drivers/media/pci/pt3/pt3.h | 11 +++---
2 files changed, 32 insertions(+), 64 deletions(-)
diff --git a/drivers/media/pci/pt3/pt3.c b/drivers/media/pci/pt3/pt3.c
index 7a37e8f..f21009d 100644
--- a/drivers/media/pci/pt3/pt3.c
+++ b/drivers/media/pci/pt3/pt3.c
@@ -26,6 +26,7 @@
#include "dvbdev.h"
#include "dvb_demux.h"
#include "dvb_frontend.h"
+#include "dvb_i2c.h"
#include "pt3.h"
@@ -375,67 +376,40 @@ static int pt3_fe_init(struct pt3_board *pt3)
static int pt3_attach_fe(struct pt3_board *pt3, int i)
{
- struct i2c_board_info info;
- struct tc90522_config cfg;
- struct i2c_client *cl;
+ struct dvb_frontend *fe;
+ struct tc90522_out *out;
+ struct i2c_client *demod_cl, *tuner_cl;
struct dvb_adapter *dvb_adap;
int ret;
- info = adap_conf[i].demod_info;
- cfg = adap_conf[i].demod_cfg;
- cfg.tuner_i2c = NULL;
- info.platform_data = &cfg;
+ out = NULL;
+ demod_cl = dvb_i2c_attach_fe(&pt3->i2c_adap, &adap_conf[i].demod_info,
+ &adap_conf[i].demod_cfg, (void **)&out);
+ if (!demod_cl)
+ return -ENODEV;
ret = -ENODEV;
- request_module("tc90522");
- cl = i2c_new_device(&pt3->i2c_adap, &info);
- if (!cl || !cl->dev.driver)
- return -ENODEV;
- pt3->adaps[i]->i2c_demod = cl;
- if (!try_module_get(cl->dev.driver->owner))
- goto err_demod_i2c_unregister_device;
-
- if (!strncmp(cl->name, TC90522_I2C_DEV_SAT, sizeof(cl->name))) {
- struct qm1d1c0042_config tcfg;
-
- tcfg = adap_conf[i].tuner_cfg.qm1d1c0042;
- tcfg.fe = cfg.fe;
- info = adap_conf[i].tuner_info;
- info.platform_data = &tcfg;
- request_module("qm1d1c0042");
- cl = i2c_new_device(cfg.tuner_i2c, &info);
- } else {
- struct mxl301rf_config tcfg;
-
- tcfg = adap_conf[i].tuner_cfg.mxl301rf;
- tcfg.fe = cfg.fe;
- info = adap_conf[i].tuner_info;
- info.platform_data = &tcfg;
- request_module("mxl301rf");
- cl = i2c_new_device(cfg.tuner_i2c, &info);
- }
- if (!cl || !cl->dev.driver)
- goto err_demod_module_put;
- pt3->adaps[i]->i2c_tuner = cl;
- if (!try_module_get(cl->dev.driver->owner))
- goto err_tuner_i2c_unregister_device;
+ if (!out)
+ goto err;
+ fe = dvb_i2c_to_fe(demod_cl);
+ tuner_cl = dvb_i2c_attach_tuner(&(out->demod_bus),
+ &adap_conf[i].tuner_info, fe,
+ &adap_conf[i].tuner_cfg, NULL);
+ if (!tuner_cl)
+ goto err;
dvb_adap = &pt3->adaps[one_adapter ? 0 : i]->dvb_adap;
- ret = dvb_register_frontend(dvb_adap, cfg.fe);
+ ret = dvb_register_frontend(dvb_adap, fe);
if (ret < 0)
- goto err_tuner_module_put;
- pt3->adaps[i]->fe = cfg.fe;
+ goto err;
+ pt3->adaps[i]->fe = fe;
+ pt3->adaps[i]->i2c_demod = demod_cl;
return 0;
-err_tuner_module_put:
- module_put(pt3->adaps[i]->i2c_tuner->dev.driver->owner);
-err_tuner_i2c_unregister_device:
- i2c_unregister_device(pt3->adaps[i]->i2c_tuner);
-err_demod_module_put:
- module_put(pt3->adaps[i]->i2c_demod->dev.driver->owner);
-err_demod_i2c_unregister_device:
- i2c_unregister_device(pt3->adaps[i]->i2c_demod);
-
+err:
+ /* tuner i2c_client is unregister'ed as well, */
+ /* because it is a (grand) child of the demod i2c_client device */
+ i2c_unregister_device(demod_cl);
return ret;
}
@@ -630,17 +604,10 @@ static void pt3_cleanup_adapter(struct pt3_board *pt3, int index)
dmx = &adap->demux.dmx;
dmx->close(dmx);
if (adap->fe) {
- adap->fe->callback = NULL;
if (adap->fe->frontend_priv)
dvb_unregister_frontend(adap->fe);
- if (adap->i2c_tuner) {
- module_put(adap->i2c_tuner->dev.driver->owner);
- i2c_unregister_device(adap->i2c_tuner);
- }
- if (adap->i2c_demod) {
- module_put(adap->i2c_demod->dev.driver->owner);
+ if (adap->i2c_demod)
i2c_unregister_device(adap->i2c_demod);
- }
}
pt3_free_dmabuf(adap);
dvb_dmxdev_release(&adap->dmxdev);
diff --git a/drivers/media/pci/pt3/pt3.h b/drivers/media/pci/pt3/pt3.h
index 1b3f2ad..86eafd7 100644
--- a/drivers/media/pci/pt3/pt3.h
+++ b/drivers/media/pci/pt3/pt3.h
@@ -104,15 +104,17 @@ struct dma_data_buffer {
/*
* device things
*/
+union pt3_tuner_config {
+ struct qm1d1c0042_config qm1d1c0042;
+ struct mxl301rf_config mxl301rf;
+};
+
struct pt3_adap_config {
struct i2c_board_info demod_info;
struct tc90522_config demod_cfg;
struct i2c_board_info tuner_info;
- union tuner_config {
- struct qm1d1c0042_config qm1d1c0042;
- struct mxl301rf_config mxl301rf;
- } tuner_cfg;
+ union pt3_tuner_config tuner_cfg;
u32 init_freq;
};
@@ -124,7 +126,6 @@ struct pt3_adapter {
struct dmxdev dmxdev;
struct dvb_frontend *fe;
struct i2c_client *i2c_demod;
- struct i2c_client *i2c_tuner;
/* data fetch thread */
struct task_struct *thread;
--
2.2.2
^ permalink raw reply related [flat|nested] 5+ messages in thread