]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/i2c/busses/i2c-mv64xxx.c
Pull add-mmio-to-proc-iomem into release branch
[linux-2.6-omap-h63xx.git] / drivers / i2c / busses / i2c-mv64xxx.c
index eb6cc0869938c75f1e2d53b2a35d179956f3ae66..6b48027b2ee340b9cdab8624c03f7c029abea6b2 100644 (file)
@@ -17,6 +17,8 @@
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/mv643xx.h>
+#include <linux/platform_device.h>
+
 #include <asm/io.h>
 
 /* Register defines */
@@ -423,13 +425,13 @@ static int
 mv64xxx_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 {
        struct mv64xxx_i2c_data *drv_data = i2c_get_adapdata(adap);
-       int     i, rc = 0;
+       int     i, rc;
 
        for (i=0; i<num; i++)
-               if ((rc = mv64xxx_i2c_execute_msg(drv_data, &msgs[i])) != 0)
-                       break;
+               if ((rc = mv64xxx_i2c_execute_msg(drv_data, &msgs[i])) < 0)
+                       return rc;
 
-       return rc;
+       return num;
 }
 
 static struct i2c_algorithm mv64xxx_i2c_algo = {
@@ -500,13 +502,10 @@ mv64xxx_i2c_probe(struct device *dev)
        if ((pd->id != 0) || !pdata)
                return -ENODEV;
 
-       drv_data = kmalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL);
-
+       drv_data = kzalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL);
        if (!drv_data)
                return -ENOMEM;
 
-       memset(drv_data, 0, sizeof(struct mv64xxx_i2c_data));
-
        if (mv64xxx_i2c_map_regs(pd, drv_data)) {
                rc = -ENODEV;
                goto exit_kfree;
@@ -570,6 +569,7 @@ mv64xxx_i2c_remove(struct device *dev)
 }
 
 static struct device_driver mv64xxx_i2c_driver = {
+       .owner  = THIS_MODULE,
        .name   = MV64XXX_I2C_CTLR_NAME,
        .bus    = &platform_bus_type,
        .probe  = mv64xxx_i2c_probe,