]> err.no Git - linux-2.6/blobdiff - drivers/media/dvb/b2c2/flexcop.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/async_tx
[linux-2.6] / drivers / media / dvb / b2c2 / flexcop.c
index 123ed96f6faa54d4851c6e3c3171735dc9a01bd7..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,25 +216,22 @@ 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)
 {
        void *bus;
-       struct flexcop_device *fc = kmalloc(sizeof(struct flexcop_device), GFP_KERNEL);
+       struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), GFP_KERNEL);
        if (!fc) {
                err("no memory");
                return NULL;
        }
-       memset(fc, 0, sizeof(struct flexcop_device));
 
-       bus = kmalloc(bus_specific_len, GFP_KERNEL);
+       bus = kzalloc(bus_specific_len, GFP_KERNEL);
        if (!bus) {
                err("no memory");
                kfree(fc);
                return NULL;
        }
-       memset(bus, 0, bus_specific_len);
 
        fc->bus_specific = bus;
 
@@ -263,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;
@@ -272,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);