Skip to content

Commit

Permalink
[ARM] pxa: introduce dedicated __mfp_validate() to check PXA2xx MFP
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Miao authored and Russell King committed Jul 9, 2008
1 parent d4a6780 commit 0fedb0c
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions arch/arm/mach-pxa/mfp-pxa2xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand Down

0 comments on commit 0fedb0c

Please sign in to comment.