diff options
author | Michael Hunold <devnull@localhost> | 2004-09-15 16:50:17 +0000 |
---|---|---|
committer | Michael Hunold <devnull@localhost> | 2004-09-15 16:50:17 +0000 |
commit | b61589a51cc27a9785a2b6faa3541474c8fa1dfa (patch) | |
tree | 485379081b2f3f49b317d83c783a04deeb6e3a10 /linux/drivers/media | |
parent | cee2f6018552c03313dc099ea8ebeee6addac22c (diff) | |
download | mediapointer-dvb-s2-b61589a51cc27a9785a2b6faa3541474c8fa1dfa.tar.gz mediapointer-dvb-s2-b61589a51cc27a9785a2b6faa3541474c8fa1dfa.tar.bz2 |
This updates the cx22702 frontend driver:
* make it ignore any non-dvb card i2c adapters.
* fixup the registering / unregistering order and make it more robust.
(Patch by Gerd Knorr)
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/dvb/frontends/cx22702.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/linux/drivers/media/dvb/frontends/cx22702.c b/linux/drivers/media/dvb/frontends/cx22702.c index 53555ad44..ef5217a61 100644 --- a/linux/drivers/media/dvb/frontends/cx22702.c +++ b/linux/drivers/media/dvb/frontends/cx22702.c @@ -734,6 +734,12 @@ static int cx22702_attach_adapter(struct i2c_adapter *adapter) int minfreq; int pll_type; + if (0 == (adapter->class & I2C_CLASS_TV_DIGITAL)) { + dprintk("Ignoring adapter 0x%x:%s (no digital tv card).\n", + adapter->id, adapter->name); + return 0; + } + dprintk("Trying to attach to adapter 0x%x:%s.\n", adapter->id, adapter->name); @@ -780,17 +786,6 @@ static int cx22702_attach_adapter(struct i2c_adapter *adapter) kfree(state); return ret; } - - BUG_ON(!state->dvb); - - if ((ret = dvb_register_frontend(cx22702_ioctl, state->dvb, state, - &state->cx22702_info, THIS_MODULE))) { - i2c_detach_client(client); - kfree(client); - kfree(state); - return ret; - } - return 0; } @@ -798,9 +793,11 @@ static int cx22702_detach_client(struct i2c_client *client) { struct cx22702_state *state = i2c_get_clientdata(client); - dvb_unregister_frontend (cx22702_ioctl, state->dvb); + if (NULL != state->dvb) { + dvb_unregister_frontend (cx22702_ioctl, state->dvb); + state->dvb = NULL; + } i2c_detach_client(client); - BUG_ON(state->dvb); kfree(client); return 0; } @@ -808,12 +805,25 @@ static int cx22702_detach_client(struct i2c_client *client) static int command(struct i2c_client *client, unsigned int cmd, void *arg) { struct cx22702_state *state = i2c_get_clientdata(client); + int rc; switch(cmd) { case FE_REGISTER: + if (NULL != state->dvb) + break; state->dvb = arg; + rc = dvb_register_frontend(cx22702_ioctl, state->dvb, state, + &state->cx22702_info, THIS_MODULE); + if (0 != rc) { + printk("cx22702: dvb_register_frontend failed with rc=%d\n",rc); + state->dvb = NULL; + return rc; + } break; case FE_UNREGISTER: + if (NULL == state->dvb) + break; + dvb_unregister_frontend (cx22702_ioctl, state->dvb); state->dvb = NULL; break; default: |