aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)
91 return 0; 91 return 0;
92} 92}
93 93
94static inline int __mfp_validate(int mfp)
95{
96 int gpio = mfp_to_gpio(mfp);
97
98 if ((mfp > MFP_PIN_GPIO127) || !gpio_desc[gpio].valid) {
99 pr_warning("%s: GPIO%d is invalid pin\n", __func__, gpio);
100 return -1;
101 }
102
103 return gpio;
104}
105
94void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num) 106void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
95{ 107{
96 unsigned long flags; 108 unsigned long flags;
@@ -99,13 +111,9 @@ void pxa2xx_mfp_config(unsigned long *mfp_cfgs, int num)
99 111
100 for (i = 0, c = mfp_cfgs; i < num; i++, c++) { 112 for (i = 0, c = mfp_cfgs; i < num; i++, c++) {
101 113
102 gpio = mfp_to_gpio(MFP_PIN(*c)); 114 gpio = __mfp_validate(MFP_PIN(*c));
103 115 if (gpio < 0)
104 if (!gpio_desc[gpio].valid) {
105 pr_warning("%s: GPIO%d is invalid pin\n",
106 __func__, gpio);
107 continue; 116 continue;
108 }
109 117
110 local_irq_save(flags); 118 local_irq_save(flags);
111 119