summaryrefslogtreecommitdiffstats
path: root/drivers/media/pci/ngene/ngene-cards.c
diff options
context:
space:
mode:
authorDaniel Scheller <d.scheller@gmx.net>2018-03-07 15:07:56 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2018-03-08 06:06:51 -0500
commit78c4e0820134fdf873c8ab6660b9283bb4be5496 (patch)
treefca9e27b24399ad055988affd5c4a05f816d5e4c /drivers/media/pci/ngene/ngene-cards.c
parentc966453b1386136e47f7c45a6d3b66f4013f974d (diff)
downloadop-kernel-dev-78c4e0820134fdf873c8ab6660b9283bb4be5496.zip
op-kernel-dev-78c4e0820134fdf873c8ab6660b9283bb4be5496.tar.gz
media: ngene: use common DVB I2C client handling helpers
Like in ddbridge, get rid of all duplicated I2C client handling constructs and rather make use of the newly added dvb_module_*() helpers. Makes things more clean and removes the (cosmetic) need for some variables. The check on a valid ptr on ci->en isn't really needed since the cxd2099 driver will set it at a time where it is going to return successfully from probing. Signed-off-by: Daniel Scheller <d.scheller@gmx.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/pci/ngene/ngene-cards.c')
-rw-r--r--drivers/media/pci/ngene/ngene-cards.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/media/pci/ngene/ngene-cards.c b/drivers/media/pci/ngene/ngene-cards.c
index 37e9f0e..65fc8f2 100644
--- a/drivers/media/pci/ngene/ngene-cards.c
+++ b/drivers/media/pci/ngene/ngene-cards.c
@@ -253,15 +253,7 @@ static int tuner_attach_tda18212(struct ngene_channel *chan, u32 dmdtype)
.if_dvbt2_8 = 4000,
.if_dvbc = 5000,
};
- struct i2c_board_info board_info = {
- .type = "tda18212",
- .platform_data = &config,
- };
-
- if (chan->number & 1)
- board_info.addr = 0x63;
- else
- board_info.addr = 0x60;
+ u8 addr = (chan->number & 1) ? 0x63 : 0x60;
/*
* due to a hardware quirk with the I2C gate on the stv0367+tda18212
@@ -269,20 +261,13 @@ static int tuner_attach_tda18212(struct ngene_channel *chan, u32 dmdtype)
* cold started, or it very likely will fail.
*/
if (dmdtype == DEMOD_TYPE_STV0367)
- tuner_tda18212_ping(chan, i2c, board_info.addr);
-
- request_module(board_info.type);
+ tuner_tda18212_ping(chan, i2c, addr);
- /* perform tuner init/attach */
- client = i2c_new_device(i2c, &board_info);
- if (!client || !client->dev.driver)
+ /* perform tuner probe/init/attach */
+ client = dvb_module_probe("tda18212", NULL, i2c, addr, &config);
+ if (!client)
goto err;
- if (!try_module_get(client->dev.driver->owner)) {
- i2c_unregister_device(client);
- goto err;
- }
-
chan->i2c_client[0] = client;
chan->i2c_client_fe = 1;
OpenPOWER on IntegriCloud