public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Laxman Dewangan <ldewangan@nvidia.com>,
	Samuel Ortiz <sameo@linux.intel.com>
Subject: [PATCH] mfd: rc5t583: Improve readability of volatile_reg function
Date: Thu, 22 Mar 2012 10:25:17 +0800	[thread overview]
Message-ID: <1332383117.13011.3.camel@phoenix> (raw)

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




                 reply	other threads:[~2012-03-22  2:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332383117.13011.3.camel@phoenix \
    --to=axel.lin@gmail.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox