aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2013-01-16 08:53:56 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-02-13 18:22:51 -0500
commit6382a0614144901af1cbbfdf9b9a618f5dfb8548 (patch)
tree3bc1be702cd90b9fbfdff1bae045865aee537a15
parent7e2e6c5758de94ec22686b30e7b906a3ddcd9896 (diff)
mfd: twl-core: Move 'inuse' check early at probe time
We can fail earlier in case multiple instance of the twl-core is tried to be loaded. The twl-core by design only supports one instance. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/twl-core.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 547fed540ef7..182708811065 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -1170,6 +1170,12 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1170 return -EINVAL; 1170 return -EINVAL;
1171 } 1171 }
1172 1172
1173 if (inuse) {
1174 dev_dbg(&client->dev, "only one instance of %s allowed\n",
1175 DRIVER_NAME);
1176 return -EBUSY;
1177 }
1178
1173 pdev = platform_device_alloc(DRIVER_NAME, -1); 1179 pdev = platform_device_alloc(DRIVER_NAME, -1);
1174 if (!pdev) { 1180 if (!pdev) {
1175 dev_err(&client->dev, "can't alloc pdev\n"); 1181 dev_err(&client->dev, "can't alloc pdev\n");
@@ -1188,12 +1194,6 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
1188 goto free; 1194 goto free;
1189 } 1195 }
1190 1196
1191 if (inuse) {
1192 dev_dbg(&client->dev, "driver is already in use\n");
1193 status = -EBUSY;
1194 goto free;
1195 }
1196
1197 if ((id->driver_data) & TWL6030_CLASS) { 1197 if ((id->driver_data) & TWL6030_CLASS) {
1198 twl_id = TWL6030_CLASS_ID; 1198 twl_id = TWL6030_CLASS_ID;
1199 twl_map = &twl6030_map[0]; 1199 twl_map = &twl6030_map[0];