summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/mfp-pxa2xx.c
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2008-06-16 09:38:27 +0800
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-09 21:38:32 +0100
commit0fedb0cad6ebc00af01013b5bbe52dd596853c63 (patch)
tree40f6993a3926ec109e639dcb765db449c60a8f6b /arch/arm/mach-pxa/mfp-pxa2xx.c
parentd4a678080e83ff96e3933fa1e631cef3cda04bef (diff)
downloadtalos-obmc-linux-0fedb0cad6ebc00af01013b5bbe52dd596853c63.tar.gz
talos-obmc-linux-0fedb0cad6ebc00af01013b5bbe52dd596853c63.zip
[ARM] pxa: introduce dedicated __mfp_validate() to check PXA2xx MFP
Signed-off-by: Eric Miao <eric.miao@marvell.com> Tested-by: Robert Jarzmik <robert.jarzmik@free.fr> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/mfp-pxa2xx.c')
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index d1cdb4ecb0b8..ed91c043471b 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -91,6 +91,18 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
return 0;
}
+static inline int __mfp_validate(int mfp)
+{
+ int gpio = mfp_to_gpio(mfp);
+
+ if ((mfp > MFP_PIN_GPIO127) || !gpio_desc[gpio].valid) {
+ pr_warning("%s: GPIO%d is invalid pin\n", __func__, gpio);
+ return -1;
+ }
+
+ return gpio;
+}
+
void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
{
unsigned long flags;
@@ -99,13 +111,9 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
for (i = 0, c = mfp_cfgs; i < num; i++, c++) {
- gpio = mfp_to_gpio(MFP_PIN(*c));
-
- if (!gpio_desc[gpio].valid) {
- pr_warning("%s: GPIO%d is invalid pin\n",
- __func__, gpio);
+ gpio = __mfp_validate(MFP_PIN(*c));
+ if (gpio < 0)
continue;
- }
local_irq_save(flags);
OpenPOWER on IntegriCloud