diff options
author | Kevin Hilman <khilman@ti.com> | 2011-04-22 11:15:46 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@ti.com> | 2011-06-16 14:14:00 -0400 |
commit | 7a6f8416e22a6d9f4708847bb2d88f0719b0f49e (patch) | |
tree | ccc425c0e8d30ce03866073a16f9655c17cabcad | |
parent | f8b46b58348f151e45274c93ebe51467cf10e2f2 (diff) |
gpio/omap: remove useless gpio_valid() & check_gpio() checks
These functions are useless. They are only called in a few places,
and where they are called, the GPIO has already been converted from an
IRQ or masked, so these functions will never fail.
Signed-off-by: Kevin Hilman <khilman@ti.com>
-rw-r--r-- | drivers/gpio/gpio-omap.c | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index e5667baf5004..857ec3939fdd 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -90,40 +90,6 @@ int gpio_bank_count; | |||
90 | #define GPIO_INDEX(bank, gpio) (gpio % bank->width) | 90 | #define GPIO_INDEX(bank, gpio) (gpio % bank->width) |
91 | #define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio)) | 91 | #define GPIO_BIT(bank, gpio) (1 << GPIO_INDEX(bank, gpio)) |
92 | 92 | ||
93 | static inline int gpio_valid(int gpio) | ||
94 | { | ||
95 | if (gpio < 0) | ||
96 | return -1; | ||
97 | if (cpu_class_is_omap1() && OMAP_GPIO_IS_MPUIO(gpio)) { | ||
98 | if (gpio >= OMAP_MAX_GPIO_LINES + 16) | ||
99 | return -1; | ||
100 | return 0; | ||
101 | } | ||
102 | if (cpu_is_omap15xx() && gpio < 16) | ||
103 | return 0; | ||
104 | if ((cpu_is_omap16xx()) && gpio < 64) | ||
105 | return 0; | ||
106 | if (cpu_is_omap7xx() && gpio < 192) | ||
107 | return 0; | ||
108 | if (cpu_is_omap2420() && gpio < 128) | ||
109 | return 0; | ||
110 | if (cpu_is_omap2430() && gpio < 160) | ||
111 | return 0; | ||
112 | if ((cpu_is_omap34xx() || cpu_is_omap44xx()) && gpio < 192) | ||
113 | return 0; | ||
114 | return -1; | ||
115 | } | ||
116 | |||
117 | static int check_gpio(int gpio) | ||
118 | { | ||
119 | if (unlikely(gpio_valid(gpio) < 0)) { | ||
120 | printk(KERN_ERR "omap-gpio: invalid GPIO %d\n", gpio); | ||
121 | dump_stack(); | ||
122 | return -1; | ||
123 | } | ||
124 | return 0; | ||
125 | } | ||
126 | |||
127 | static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input) | 93 | static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input) |
128 | { | 94 | { |
129 | void __iomem *reg = bank->base; | 95 | void __iomem *reg = bank->base; |
@@ -172,9 +138,6 @@ static int _get_gpio_datain(struct gpio_bank *bank, int gpio) | |||
172 | { | 138 | { |
173 | void __iomem *reg = bank->base + bank->regs->datain; | 139 | void __iomem *reg = bank->base + bank->regs->datain; |
174 | 140 | ||
175 | if (check_gpio(gpio) < 0) | ||
176 | return -EINVAL; | ||
177 | |||
178 | return (__raw_readl(reg) & GPIO_BIT(bank, gpio)) != 0; | 141 | return (__raw_readl(reg) & GPIO_BIT(bank, gpio)) != 0; |
179 | } | 142 | } |
180 | 143 | ||
@@ -182,9 +145,6 @@ static int _get_gpio_dataout(struct gpio_bank *bank, int gpio) | |||
182 | { | 145 | { |
183 | void __iomem *reg = bank->base + bank->regs->dataout; | 146 | void __iomem *reg = bank->base + bank->regs->dataout; |
184 | 147 | ||
185 | if (check_gpio(gpio) < 0) | ||
186 | return -EINVAL; | ||
187 | |||
188 | return (__raw_readl(reg) & GPIO_BIT(bank, gpio)) != 0; | 148 | return (__raw_readl(reg) & GPIO_BIT(bank, gpio)) != 0; |
189 | } | 149 | } |
190 | 150 | ||
@@ -453,9 +413,6 @@ static int gpio_irq_type(struct irq_data *d, unsigned type) | |||
453 | else | 413 | else |
454 | gpio = d->irq - IH_GPIO_BASE; | 414 | gpio = d->irq - IH_GPIO_BASE; |
455 | 415 | ||
456 | if (check_gpio(gpio) < 0) | ||
457 | return -EINVAL; | ||
458 | |||
459 | if (type & ~IRQ_TYPE_SENSE_MASK) | 416 | if (type & ~IRQ_TYPE_SENSE_MASK) |
460 | return -EINVAL; | 417 | return -EINVAL; |
461 | 418 | ||
@@ -621,8 +578,6 @@ static int gpio_wake_enable(struct irq_data *d, unsigned int enable) | |||
621 | struct gpio_bank *bank; | 578 | struct gpio_bank *bank; |
622 | int retval; | 579 | int retval; |
623 | 580 | ||
624 | if (check_gpio(gpio) < 0) | ||
625 | return -ENODEV; | ||
626 | bank = irq_data_get_irq_chip_data(d); | 581 | bank = irq_data_get_irq_chip_data(d); |
627 | retval = _set_gpio_wakeup(bank, GPIO_INDEX(bank, gpio), enable); | 582 | retval = _set_gpio_wakeup(bank, GPIO_INDEX(bank, gpio), enable); |
628 | 583 | ||