include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / staging / go7007 / go7007-driver.c
index c5dc3b6..372a7c6 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/firmware.h>
 #include <linux/mutex.h>
 #include <linux/uaccess.h>
+#include <linux/slab.h>
 #include <asm/system.h>
 #include <linux/videodev2.h>
 #include <media/tuner.h>
@@ -128,6 +129,8 @@ static int go7007_load_encoder(struct go7007 *go)
        return rv;
 }
 
+MODULE_FIRMWARE("go7007fw.bin");
+
 /*
  * Boot the encoder and register the I2C adapter if requested.  Do the
  * minimum initialization necessary, since the board-specific code may
@@ -193,7 +196,8 @@ int go7007_reset_encoder(struct go7007 *go)
 static int init_i2c_module(struct i2c_adapter *adapter, const char *type,
                           int id, int addr)
 {
-       struct i2c_board_info info;
+       struct go7007 *go = i2c_get_adapdata(adapter);
+       struct v4l2_device *v4l2_dev = &go->v4l2_dev;
        char *modname;
 
        switch (id) {
@@ -225,14 +229,10 @@ static int init_i2c_module(struct i2c_adapter *adapter, const char *type,
                modname = NULL;
                break;
        }
-       if (modname != NULL)
-               request_module(modname);
 
-       memset(&info, 0, sizeof(struct i2c_board_info));
-       info.addr = addr;
-       strlcpy(info.type, type, I2C_NAME_SIZE);
-       if (!i2c_new_device(adapter, &info))
+       if (v4l2_i2c_new_subdev(v4l2_dev, adapter, modname, type, addr, NULL))
                return 0;
+
        if (modname != NULL)
                printk(KERN_INFO
                        "go7007: probing for module %s failed\n", modname);
@@ -262,6 +262,11 @@ int go7007_register_encoder(struct go7007 *go)
        if (ret < 0)
                return -1;
 
+       /* v4l2 init must happen before i2c subdevs */
+       ret = go7007_v4l2_init(go);
+       if (ret < 0)
+               return ret;
+
        if (!go->i2c_adapter_online &&
                        go->board_info->flags & GO7007_BOARD_USE_ONBOARD_I2C) {
                if (go7007_i2c_init(go) < 0)
@@ -282,7 +287,7 @@ int go7007_register_encoder(struct go7007 *go)
                go->audio_enabled = 1;
                go7007_snd_init(go);
        }
-       return go7007_v4l2_init(go);
+       return 0;
 }
 EXPORT_SYMBOL(go7007_register_encoder);