lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1332383117.13011.3.camel@phoenix>
Date:	Thu, 22 Mar 2012 10:25:17 +0800
From:	Axel Lin <axel.lin@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Laxman Dewangan <ldewangan@...dia.com>,
	Samuel Ortiz <sameo@...ux.intel.com>
Subject: [PATCH] mfd: rc5t583: Improve readability of volatile_reg function

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@...il.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



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ