Merge branch 'for-2639/i2c/i2c-u2c12' into for-linus/2639/i2c-12
[pandora-kernel.git] / drivers / i2c / busses / i2c-mpc.c
index a1c419a..75b984c 100644 (file)
@@ -560,8 +560,7 @@ static struct i2c_adapter mpc_ops = {
        .timeout = HZ,
 };
 
-static int __devinit fsl_i2c_probe(struct platform_device *op,
-                                  const struct of_device_id *match)
+static int __devinit fsl_i2c_probe(struct platform_device *op)
 {
        struct mpc_i2c *i2c;
        const u32 *prop;
@@ -569,6 +568,9 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
        int result = 0;
        int plen;
 
+       if (!op->dev.of_match)
+               return -EINVAL;
+
        i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
        if (!i2c)
                return -ENOMEM;
@@ -603,8 +605,8 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
                        clock = *prop;
        }
 
-       if (match->data) {
-               struct mpc_i2c_data *data = match->data;
+       if (op->dev.of_match->data) {
+               struct mpc_i2c_data *data = op->dev.of_match->data;
                data->setup(op->dev.of_node, i2c, clock, data->prescaler);
        } else {
                /* Backwards compatibility */
@@ -632,6 +634,7 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
                dev_err(i2c->dev, "failed to add adapter\n");
                goto fail_add;
        }
+       of_i2c_register_devices(&i2c->adap);
 
        return result;
 
@@ -699,7 +702,7 @@ static const struct of_device_id mpc_i2c_of_match[] = {
 MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
 
 /* Structure for a device driver */
-static struct of_platform_driver mpc_i2c_driver = {
+static struct platform_driver mpc_i2c_driver = {
        .probe          = fsl_i2c_probe,
        .remove         = __devexit_p(fsl_i2c_remove),
        .driver = {
@@ -711,18 +714,12 @@ static struct of_platform_driver mpc_i2c_driver = {
 
 static int __init fsl_i2c_init(void)
 {
-       int rv;
-
-       rv = of_register_platform_driver(&mpc_i2c_driver);
-       if (rv)
-               printk(KERN_ERR DRV_NAME
-                      " of_register_platform_driver failed (%i)\n", rv);
-       return rv;
+       return platform_driver_register(&mpc_i2c_driver);
 }
 
 static void __exit fsl_i2c_exit(void)
 {
-       of_unregister_platform_driver(&mpc_i2c_driver);
+       platform_driver_unregister(&mpc_i2c_driver);
 }
 
 module_init(fsl_i2c_init);