aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/twl-core.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-11-13 03:28:48 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2012-11-21 10:08:02 -0500
commitda059ecfc9f9d98556607c6d6db065aa3b7f162d (patch)
tree1378a6df2584381951a41bd3da14165c33699668 /drivers/mfd/twl-core.c
parent0e8f1398a388bbaa5ca965711b9ed5ac4794332d (diff)
mfd: twl: Convert module id definitions to enums
Use enum list for the module definitions (TWL4030_MODULE_*) which will ease up future work with the IDs. At the same time group the IDs in block of five so it is easier to find the ID we are looking for (to count the number they stand for). At the same time define TWL_MODULE_LED so client drivers can switch to use it as soon as it is possible. Acked-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/twl-core.c')
-rw-r--r--drivers/mfd/twl-core.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index d666c9d454cb..bb33b52cfa57 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -66,9 +66,6 @@
66 66
67/* Triton Core internal information (BEGIN) */ 67/* Triton Core internal information (BEGIN) */
68 68
69/* Last - for index max*/
70#define TWL4030_MODULE_LAST TWL4030_MODULE_SECURED_REG
71
72#define TWL_NUM_SLAVES 4 69#define TWL_NUM_SLAVES 4
73 70
74#define SUB_CHIP_ID0 0 71#define SUB_CHIP_ID0 0
@@ -184,7 +181,7 @@ struct twl_mapping {
184}; 181};
185static struct twl_mapping *twl_map; 182static struct twl_mapping *twl_map;
186 183
187static struct twl_mapping twl4030_map[TWL4030_MODULE_LAST + 1] = { 184static struct twl_mapping twl4030_map[] = {
188 /* 185 /*
189 * NOTE: don't change this table without updating the 186 * NOTE: don't change this table without updating the
190 * <linux/i2c/twl.h> defines for TWL4030_MODULE_* 187 * <linux/i2c/twl.h> defines for TWL4030_MODULE_*
@@ -327,7 +324,7 @@ int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
327 int sid; 324 int sid;
328 struct twl_client *twl; 325 struct twl_client *twl;
329 326
330 if (unlikely(mod_no > TWL_MODULE_LAST)) { 327 if (unlikely(mod_no >= TWL_MODULE_LAST)) {
331 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); 328 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
332 return -EPERM; 329 return -EPERM;
333 } 330 }
@@ -369,7 +366,7 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
369 int sid; 366 int sid;
370 struct twl_client *twl; 367 struct twl_client *twl;
371 368
372 if (unlikely(mod_no > TWL_MODULE_LAST)) { 369 if (unlikely(mod_no >= TWL_MODULE_LAST)) {
373 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no); 370 pr_err("%s: invalid module number %d\n", DRIVER_NAME, mod_no);
374 return -EPERM; 371 return -EPERM;
375 } 372 }