V4L/DVB (7229): saa7134: add support for the Creatix CTX953_V.1.4.3 Hybrid
[safe/jmp/linux-2.6] / drivers / media / video / adv7175.c
index ca86de0..8ee07a6 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  *  adv7175 - adv7175a video encoder driver version 0.0.3
  *
  * Copyright (C) 1998 Dave Perks <dperks@ibm.net>
 #include <linux/major.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
-#include <linux/pci.h>
 #include <linux/signal.h>
+#include <linux/types.h>
+#include <linux/i2c.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/page.h>
-#include <linux/sched.h>
-#include <linux/types.h>
+#include <asm/uaccess.h>
 
 #include <linux/videodev.h>
-#include <asm/uaccess.h>
+#include <linux/video_encoder.h>
 
 MODULE_DESCRIPTION("Analog Devices ADV7175 video encoder driver");
 MODULE_AUTHOR("Dave Perks");
 MODULE_LICENSE("GPL");
 
-#include <linux/i2c.h>
-#include <linux/i2c-dev.h>
 
 #define I2C_NAME(s) (s)->name
 
-#include <linux/video_encoder.h>
 
-static int debug = 0;
+static int debug;
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "Debug level (0-1)");
 
@@ -115,24 +112,21 @@ adv7175_write_block (struct i2c_client *client,
         * the adapter understands raw I2C */
        if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
                /* do raw I2C, not smbus compatible */
-               struct i2c_msg msg;
                u8 block_data[32];
+               int block_len;
 
-               msg.addr = client->addr;
-               msg.flags = 0;
                while (len >= 2) {
-                       msg.buf = (char *) block_data;
-                       msg.len = 0;
-                       block_data[msg.len++] = reg = data[0];
+                       block_len = 0;
+                       block_data[block_len++] = reg = data[0];
                        do {
-                               block_data[msg.len++] = data[1];
+                               block_data[block_len++] = data[1];
                                reg++;
                                len -= 2;
                                data += 2;
                        } while (len >= 2 && data[0] == reg &&
-                                msg.len < 32);
-                       if ((ret = i2c_transfer(client->adapter,
-                                               &msg, 1)) < 0)
+                                block_len < 32);
+                       if ((ret = i2c_master_send(client, block_data,
+                                                  block_len)) < 0)
                                break;
                }
        } else {
@@ -237,7 +231,7 @@ adv7175_command (struct i2c_client *client,
                                    sizeof(init_common));
                adv7175_write(client, 0x07, TR0MODE | TR0RST);
                adv7175_write(client, 0x07, TR0MODE);
-               break;
+               break;
 
        case ENCODER_GET_CAPABILITIES:
        {
@@ -403,7 +397,7 @@ static unsigned short normal_i2c[] =
 };
 
 static unsigned short ignore = I2C_CLIENT_END;
-                                                                                
+
 static struct i2c_client_address_data addr_data = {
        .normal_i2c             = normal_i2c,
        .probe                  = &ignore,
@@ -432,7 +426,7 @@ adv7175_detect_client (struct i2c_adapter *adapter,
                return 0;
 
        client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (client == 0)
+       if (!client)
                return -ENOMEM;
        client->addr = address;
        client->adapter = adapter;