]> Pileus Git - ~andy/linux/blobdiff - drivers/i2c/busses/i2c-gpio.c
i2c: move OF helpers into the core
[~andy/linux] / drivers / i2c / busses / i2c-gpio.c
index bc6e139c6e7f3f6b91e1f054c7569a5191a08b9a..bfa02c6c2ddaf01b03a9a5121c2ddcf122f9a3e2 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
 #include <linux/of_gpio.h>
-#include <linux/of_i2c.h>
 
 struct i2c_gpio_private_data {
        struct i2c_adapter adap;
@@ -137,9 +136,9 @@ static int i2c_gpio_probe(struct platform_device *pdev)
                if (ret)
                        return ret;
        } else {
-               if (!pdev->dev.platform_data)
+               if (!dev_get_platdata(&pdev->dev))
                        return -ENXIO;
-               pdata = pdev->dev.platform_data;
+               pdata = dev_get_platdata(&pdev->dev);
                sda_pin = pdata->sda_pin;
                scl_pin = pdata->scl_pin;
        }
@@ -171,7 +170,7 @@ static int i2c_gpio_probe(struct platform_device *pdev)
                pdata->scl_pin = scl_pin;
                of_i2c_gpio_get_props(pdev->dev.of_node, pdata);
        } else {
-               memcpy(pdata, pdev->dev.platform_data, sizeof(*pdata));
+               memcpy(pdata, dev_get_platdata(&pdev->dev), sizeof(*pdata));
        }
 
        if (pdata->sda_is_open_drain) {
@@ -224,8 +223,6 @@ static int i2c_gpio_probe(struct platform_device *pdev)
        if (ret)
                goto err_add_bus;
 
-       of_i2c_register_devices(adap);
-
        platform_set_drvdata(pdev, priv);
 
        dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",