Commit 382dbe5b39a4efa6fdb3e5093e5d0bdbb5c5301f
Committed by
Mike Frysinger
1 parent
3322c7bbf6
Exists in
master
and in
4 other branches
Blackfin: portmux: fix peripheral map overflow when requesting pins
Some processors have groups of pins that aren't an even number of 16. This causes the array size calculation to under count the number of needed entries due to integer truncation. So on the BF51x, while we should have 3 bitmaps (41 / 16), we end up with 2 and pin requests for the 3rd bank end up scribbling over the top of the GPIO IRQ array. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff
arch/blackfin/kernel/bfin_gpio.c
... | ... | @@ -157,7 +157,7 @@ |
157 | 157 | #define DECLARE_RESERVED_MAP(m, c) static unsigned short reserved_##m##_map[c] |
158 | 158 | |
159 | 159 | DECLARE_RESERVED_MAP(gpio, GPIO_BANK_NUM); |
160 | -DECLARE_RESERVED_MAP(peri, gpio_bank(MAX_RESOURCES)); | |
160 | +DECLARE_RESERVED_MAP(peri, DIV_ROUND_UP(MAX_RESOURCES, GPIO_BANKSIZE)); | |
161 | 161 | DECLARE_RESERVED_MAP(gpio_irq, GPIO_BANK_NUM); |
162 | 162 | |
163 | 163 | inline int check_gpio(unsigned gpio) |