mfd: twl-core: add a way to register dependent device
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 22 May 2016 21:54:43 +0000 (00:54 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 3 Jul 2016 00:23:25 +0000 (03:23 +0300)
Need to add a regulator after other twl regulators are added but before
other devices probe.

drivers/mfd/twl-core.c
include/linux/i2c/twl.h

index 9b1df0b..ce83245 100644 (file)
@@ -1389,6 +1389,16 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
        }
 
        status = add_children(pdata, id->driver_data);
+       if (status < 0)
+               goto fail;
+
+       if (pdata->dep_device) {
+               ret = platform_device_register(pdata->dep_device);
+               if (ret != 0)
+                       dev_err(&client->dev,
+                               "failed to register dep_device: %d\n", ret);
+       }
+
 fail:
        if (status < 0)
                twl_remove(client);
index f1a95c2..e335454 100644 (file)
@@ -754,6 +754,9 @@ struct twl4030_platform_data {
        struct regulator_init_data              *smps3;
        struct regulator_init_data              *smps4;
        struct regulator_init_data              *vio6025;
+
+       /* device that needs to probe early and after twl */
+       struct platform_device                  *dep_device;
 };
 
 struct twl_regulator_driver_data {