]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/dvb/b2c2/flexcop.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[linux-2.6-omap-h63xx.git] / drivers / media / dvb / b2c2 / flexcop.c
index 56ba52470676821070a88050b43c35d634f3d209..5f79c8dc383651aa9349e3445f854d24947aab9a 100644 (file)
@@ -49,6 +49,8 @@ module_param_named(debug, b2c2_flexcop_debug,  int, 0644);
 MODULE_PARM_DESC(debug, "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))." DEBSTATUS);
 #undef DEBSTATUS
 
+DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
+
 /* global zero for ibi values */
 flexcop_ibi_value ibi_zero;
 
@@ -66,8 +68,10 @@ static int flexcop_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
 
 static int flexcop_dvb_init(struct flexcop_device *fc)
 {
-       int ret;
-       if ((ret = dvb_register_adapter(&fc->dvb_adapter,"FlexCop Digital TV device",fc->owner)) < 0) {
+       int ret = dvb_register_adapter(&fc->dvb_adapter,
+                                      "FlexCop Digital TV device", fc->owner,
+                                      fc->dev, adapter_nr);
+       if (ret < 0) {
                err("error registering DVB adapter");
                return ret;
        }
@@ -116,7 +120,7 @@ static int flexcop_dvb_init(struct flexcop_device *fc)
        dvb_net_init(&fc->dvb_adapter, &fc->dvbnet, &fc->demux.dmx);
 
        fc->init_state |= FC_STATE_DVB_INIT;
-       goto success;
+       return 0;
 
 err_connect_frontend:
        fc->demux.dmx.remove_frontend(&fc->demux.dmx,&fc->mem_frontend);
@@ -129,9 +133,6 @@ err_dmx_dev:
 err_dmx:
        dvb_unregister_adapter(&fc->dvb_adapter);
        return ret;
-
-success:
-       return 0;
 }
 
 static void flexcop_dvb_exit(struct flexcop_device *fc)
@@ -215,7 +216,6 @@ void flexcop_reset_block_300(struct flexcop_device *fc)
 
        fc->write_ibi_reg(fc,ctrl_208,v208_save);
 }
-EXPORT_SYMBOL(flexcop_reset_block_300);
 
 struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len)
 {
@@ -261,6 +261,12 @@ int flexcop_device_initialize(struct flexcop_device *fc)
        if ((ret = flexcop_dvb_init(fc)))
                goto error;
 
+       /* i2c has to be done before doing EEProm stuff -
+        * because the EEProm is accessed via i2c */
+       ret = flexcop_i2c_init(fc);
+       if (ret)
+               goto error;
+
        /* do the MAC address reading after initializing the dvb_adapter */
        if (fc->get_mac_addr(fc, 0) == 0) {
                u8 *b = fc->dvb_adapter.proposed_mac;
@@ -270,20 +276,15 @@ int flexcop_device_initialize(struct flexcop_device *fc)
        } else
                warn("reading of MAC address failed.\n");
 
-
-       if ((ret = flexcop_i2c_init(fc)))
-               goto error;
-
        if ((ret = flexcop_frontend_init(fc)))
                goto error;
 
        flexcop_device_name(fc,"initialization of","complete");
 
-       ret = 0;
-       goto success;
+       return 0;
+
 error:
        flexcop_device_exit(fc);
-success:
        return ret;
 }
 EXPORT_SYMBOL(flexcop_device_initialize);