aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2013-01-16 08:53:55 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-02-13 18:22:50 -0500
commit7e2e6c5758de94ec22686b30e7b906a3ddcd9896 (patch)
tree4cf5c122c626a30f1b161c6fd134c5ce46db551c /drivers
parente581238f2817d8ca8948340a2bc26dd9504bb812 (diff)
mfd: twl-core: Do not create dummy pdata when booted with DT
When booted with DT we can manage without the dummy pdata. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mfd/twl-core.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 86cca9e09380..547fed540ef7 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -1165,6 +1165,11 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1165 int status; 1165 int status;
1166 unsigned i, num_slaves; 1166 unsigned i, num_slaves;
1167 1167
1168 if (!node && !pdata) {
1169 dev_err(&client->dev, "no platform data\n");
1170 return -EINVAL;
1171 }
1172
1168 pdev = platform_device_alloc(DRIVER_NAME, -1); 1173 pdev = platform_device_alloc(DRIVER_NAME, -1);
1169 if (!pdev) { 1174 if (!pdev) {
1170 dev_err(&client->dev, "can't alloc pdev\n"); 1175 dev_err(&client->dev, "can't alloc pdev\n");
@@ -1177,28 +1182,6 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1177 return status; 1182 return status;
1178 } 1183 }
1179 1184
1180 if (node && !pdata) {
1181 /*
1182 * XXX: Temporary pdata until the information is correctly
1183 * retrieved by every TWL modules from DT.
1184 */
1185 pdata = devm_kzalloc(&client->dev,
1186 sizeof(struct twl4030_platform_data),
1187 GFP_KERNEL);
1188 if (!pdata) {
1189 status = -ENOMEM;
1190 goto free;
1191 }
1192 }
1193
1194 if (!pdata) {
1195 dev_dbg(&client->dev, "no platform data?\n");
1196 status = -EINVAL;
1197 goto free;
1198 }
1199
1200 platform_set_drvdata(pdev, pdata);
1201
1202 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) { 1185 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) {
1203 dev_dbg(&client->dev, "can't talk I2C?\n"); 1186 dev_dbg(&client->dev, "can't talk I2C?\n");
1204 status = -EIO; 1187 status = -EIO;
@@ -1264,7 +1247,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1264 inuse = true; 1247 inuse = true;
1265 1248
1266 /* setup clock framework */ 1249 /* setup clock framework */
1267 clocks_init(&pdev->dev, pdata->clock); 1250 clocks_init(&pdev->dev, pdata ? pdata->clock : NULL);
1268 1251
1269 /* read TWL IDCODE Register */ 1252 /* read TWL IDCODE Register */
1270 if (twl_id == TWL4030_CLASS_ID) { 1253 if (twl_id == TWL4030_CLASS_ID) {
@@ -1273,7 +1256,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1273 } 1256 }
1274 1257
1275 /* load power event scripts */ 1258 /* load power event scripts */
1276 if (IS_ENABLED(CONFIG_TWL4030_POWER) && pdata->power) 1259 if (IS_ENABLED(CONFIG_TWL4030_POWER) && pdata && pdata->power)
1277 twl4030_power_init(pdata->power); 1260 twl4030_power_init(pdata->power);
1278 1261
1279 /* Maybe init the T2 Interrupt subsystem */ 1262 /* Maybe init the T2 Interrupt subsystem */