From 38541a7671598dfc9c1f66b994339b59574c06d9 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Mon, 23 May 2016 00:54:43 +0300 Subject: [PATCH] mfd: twl-core: add a way to register dependent device Need to add a regulator after other twl regulators are added but before other devices probe. --- drivers/mfd/twl-core.c | 10 ++++++++++ include/linux/i2c/twl.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 9b1df0baad34..ce83245c79c9 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -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); diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index f1a95c24219c..e33545493afd 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -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 { -- 2.47.2