From: Grazvydas Ignotas Date: Sun, 22 May 2016 21:54:43 +0000 (+0300) Subject: mfd: twl-core: add a way to register dependent device X-Git-Tag: sz_175~21 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38541a7671598dfc9c1f66b994339b59574c06d9;p=pandora-kernel.git 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. --- 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 {