Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linux-dvb] [patch] cx22702: frontend register fixes
Hi,
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.
This one together with the latest v4l snapshot makes cx88 + cx22702 work
nicely together with any module load order. Unloading the modules works
as well of course ;)
Gerd
--- drivers/media/dvb/frontends/cx22702.c.kraxel 2004-09-15 16:44:13.000000000 +0200
+++ drivers/media/dvb/frontends/cx22702.c 2004-09-15 17:17:27.422581128 +0200
@@ -734,6 +734,12 @@
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 @@
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 @@
{
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 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:
Home |
Main Index |
Thread Index