]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/dvb/b2c2/flexcop-i2c.c
Pull battery into release branch
[linux-2.6-omap-h63xx.git] / drivers / media / dvb / b2c2 / flexcop-i2c.c
index e0bd2d8f0f0c92e08235aa9e15db650d43723f21..6bf858a436c98048653f1a6a0ef9eb9305709584 100644 (file)
@@ -135,6 +135,13 @@ static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs
        struct flexcop_device *fc = i2c_get_adapdata(i2c_adap);
        int i, ret = 0;
 
+       /* Some drivers use 1 byte or 0 byte reads as probes, which this
+        * driver doesn't support.  These probes will always fail, so this
+        * hack makes them always succeed.  If one knew how, it would of
+        * course be better to actually do the read.  */
+       if (num == 1 && msgs[0].flags == I2C_M_RD && msgs[0].len <= 1)
+               return 1;
+
        if (mutex_lock_interruptible(&fc->i2c_mutex))
                return -ERESTARTSYS;
 
@@ -183,13 +190,15 @@ int flexcop_i2c_init(struct flexcop_device *fc)
        mutex_init(&fc->i2c_mutex);
 
        memset(&fc->i2c_adap, 0, sizeof(struct i2c_adapter));
-       strncpy(fc->i2c_adap.name, "B2C2 FlexCop device",I2C_NAME_SIZE);
+       strncpy(fc->i2c_adap.name, "B2C2 FlexCop device",
+               sizeof(fc->i2c_adap.name));
 
        i2c_set_adapdata(&fc->i2c_adap,fc);
 
        fc->i2c_adap.class          = I2C_CLASS_TV_DIGITAL;
        fc->i2c_adap.algo       = &flexcop_algo;
        fc->i2c_adap.algo_data  = NULL;
+       fc->i2c_adap.dev.parent = fc->dev;
 
        if ((ret = i2c_add_adapter(&fc->i2c_adap)) < 0)
                return ret;