V4L/DVB (8103): videodev: fix/improve ioctl debugging
[pandora-kernel.git] / drivers / media / video / ir-kbd-i2c.c
index 29779d8..7b65f5e 100644 (file)
@@ -40,7 +40,6 @@
 #include <linux/i2c.h>
 #include <linux/i2c-id.h>
 #include <linux/workqueue.h>
-#include <asm/semaphore.h>
 
 #include <media/ir-common.h>
 #include <media/ir-kbd-i2c.h>
@@ -51,7 +50,7 @@
 static int debug;
 module_param(debug, int, 0644);    /* debug level (0,1,2) */
 
-static int hauppauge = 0;
+static int hauppauge;
 module_param(hauppauge, int, 0644);    /* Choose Hauppauge remote */
 MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults to 0)");
 
@@ -154,7 +153,7 @@ static int get_key_fusionhdtv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
        }
 
        if(buf[0] !=0 || buf[1] !=0 || buf[2] !=0 || buf[3] != 0)
-               dprintk(2, "%s: 0x%2x 0x%2x 0x%2x 0x%2x\n", __FUNCTION__,
+               dprintk(2, "%s: 0x%2x 0x%2x 0x%2x 0x%2x\n", __func__,
                        buf[0], buf[1], buf[2], buf[3]);
 
        /* no key pressed or signal from other ir remote */
@@ -398,6 +397,7 @@ static int ir_attach(struct i2c_adapter *adap, int addr,
        case 0x7a:
        case 0x47:
        case 0x71:
+       case 0x2d:
                if (adap->id == I2C_HW_B_CX2388x) {
                        /* Handled by cx88-input */
                        name        = "CX2388x remote";
@@ -504,14 +504,17 @@ static int ir_probe(struct i2c_adapter *adap)
        */
 
        static const int probe_bttv[] = { 0x1a, 0x18, 0x4b, 0x64, 0x30, -1};
-       static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, -1 };
+       static const int probe_saa7134[] = { 0x7a, 0x47, 0x71, 0x2d, -1 };
        static const int probe_em28XX[] = { 0x30, 0x47, -1 };
        static const int probe_cx88[] = { 0x18, 0x6b, 0x71, -1 };
        static const int probe_cx23885[] = { 0x6b, -1 };
-       const int *probe = NULL;
-       struct i2c_client c;
-       unsigned char buf;
-       int i,rc;
+       const int *probe;
+       struct i2c_msg msg = {
+               .flags = I2C_M_RD,
+               .len = 0,
+               .buf = NULL,
+       };
+       int i, rc;
 
        switch (adap->id) {
        case I2C_HW_B_BT848:
@@ -532,20 +535,18 @@ static int ir_probe(struct i2c_adapter *adap)
        case I2C_HW_B_CX23885:
                probe = probe_cx23885;
                break;
-       }
-       if (NULL == probe)
+       default:
                return 0;
+       }
 
-       memset(&c,0,sizeof(c));
-       c.adapter = adap;
        for (i = 0; -1 != probe[i]; i++) {
-               c.addr = probe[i];
-               rc = i2c_master_recv(&c,&buf,0);
+               msg.addr = probe[i];
+               rc = i2c_transfer(adap, &msg, 1);
                dprintk(1,"probe 0x%02x @ %s: %s\n",
                        probe[i], adap->name,
-                       (0 == rc) ? "yes" : "no");
-               if (0 == rc) {
-                       ir_attach(adap,probe[i],0,0);
+                       (1 == rc) ? "yes" : "no");
+               if (1 == rc) {
+                       ir_attach(adap, probe[i], 0, 0);
                        break;
                }
        }