Commit 0fedb0ca authored by Eric Miao's avatar Eric Miao Committed by Russell King

[ARM] pxa: introduce dedicated __mfp_validate() to check PXA2xx MFP

Signed-off-by: default avatarEric Miao <eric.miao@marvell.com>
Tested-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent d4a67808
...@@ -91,6 +91,18 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c) ...@@ -91,6 +91,18 @@ static int __mfp_config_gpio(unsigned gpio, unsigned long c)
return 0; 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) void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
{ {
unsigned long flags; unsigned long flags;
...@@ -99,13 +111,9 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num) ...@@ -99,13 +111,9 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
for (i = 0, c = mfp_cfgs; i < num; i++, c++) { for (i = 0, c = mfp_cfgs; i < num; i++, c++) {
gpio = mfp_to_gpio(MFP_PIN(*c)); gpio = __mfp_validate(MFP_PIN(*c));
if (gpio < 0)
if (!gpio_desc[gpio].valid) {
pr_warning("%s: GPIO%d is invalid pin\n",
__func__, gpio);
continue; continue;
}
local_irq_save(flags); local_irq_save(flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment