* [PATCH] mfd: rc5t583: Improve readability of volatile_reg function
@ 2012-03-22 2:25 Axel Lin
0 siblings, 0 replies; only message in thread
From: Axel Lin @ 2012-03-22 2:25 UTC (permalink / raw)
To: linux-kernel; +Cc: Laxman Dewangan, Samuel Ortiz
Actually, we have some duplicate entries in current code:
RC5T583_GPIO_GPEDGE1, RC5T583_GPIO_GPEDGE2, RC5T583_GPIO_EN_INT are also in the
range of ((reg >= RC5T583_GPIO_IOSEL) && (reg <= RC5T583_GPIO_GPOFUNC)).
Let's just list the cases to return false in volatile_reg function.
Otherwise, the default is to return true.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/mfd/rc5t583.c | 33 +++++++++------------------------
1 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c
index 99ef944..ad2c204 100644
--- a/drivers/mfd/rc5t583.c
+++ b/drivers/mfd/rc5t583.c
@@ -241,32 +241,17 @@ static bool volatile_reg(struct device *dev, unsigned int reg)
case RC5T583_INT_EN_ADC1:
case RC5T583_INT_EN_ADC2:
case RC5T583_INT_EN_ADC3:
- case RC5T583_GPIO_GPEDGE1:
- case RC5T583_GPIO_GPEDGE2:
- case RC5T583_GPIO_EN_INT:
+ /* Enable caching in gpio registers, except RC5T583_GPIO_MON_IOIN which
+ * is gpio input register */
+ case RC5T583_GPIO_IOSEL ... RC5T583_GPIO_EN_INT:
+ case RC5T583_GPIO_GPOFUNC:
+ /* Enable caching in sleep seq registers */
+ case RC5T583_SLPSEQ1 ... RC5T583_SLPSEQ11:
+ /* Enable caching of regulator registers */
+ case RC5T583_REG_DC0CTL ... RC5T583_REG_SR3CTL:
+ case RC5T583_REG_LDOEN1 ... RC5T583_REG_LDO9DAC_DS:
return false;
-
- case RC5T583_GPIO_MON_IOIN:
- /* This is gpio input register */
- return true;
-
default:
- /* Enable caching in gpio registers */
- if ((reg >= RC5T583_GPIO_IOSEL) &&
- (reg <= RC5T583_GPIO_GPOFUNC))
- return false;
-
- /* Enable caching in sleep seq registers */
- if ((reg >= RC5T583_SLPSEQ1) && (reg <= RC5T583_SLPSEQ11))
- return false;
-
- /* Enable caching of regulator registers */
- if ((reg >= RC5T583_REG_DC0CTL) && (reg <= RC5T583_REG_SR3CTL))
- return false;
- if ((reg >= RC5T583_REG_LDOEN1) &&
- (reg <= RC5T583_REG_LDO9DAC_DS))
- return false;
-
break;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-03-22 2:25 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-22 2:25 [PATCH] mfd: rc5t583: Improve readability of volatile_reg function Axel Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox