Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'gpio-fixes-v3.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
- Fix a potential bit wrap issue in the Timberdale driver
- Fix up the buffer allocation size in the 74x164 driver
- Set the value in direction_output() right in the mvebu driver
- Return proper error codes for invalid GPIOs
- Fix an off-mode bug for the OMAP
- Don't initialize the mask_cach on the mvebu driver

* tag 'gpio-fixes-v3.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
GPIO: mvebu-gpio: Don't initialize the mask_cache
gpio/omap: fix off-mode bug: clear debounce settings on free/reset
gpiolib: Don't return -EPROBE_DEFER to sysfs, or for invalid gpios
gpio: mvebu: correctly set the value in direction_output()
gpio-74x164: Fix buffer allocation size
gpio-timberdale: fix a potential wrapping issue

+48 -7
+1 -1
drivers/gpio/gpio-74x164.c
··· 153 153 } 154 154 155 155 chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers; 156 - chip->buffer = devm_kzalloc(&spi->dev, chip->gpio_chip.ngpio, GFP_KERNEL); 156 + chip->buffer = devm_kzalloc(&spi->dev, chip->registers, GFP_KERNEL); 157 157 if (!chip->buffer) { 158 158 ret = -ENOMEM; 159 159 goto exit_destroy;
+3 -1
drivers/gpio/gpio-mvebu.c
··· 244 244 if (ret) 245 245 return ret; 246 246 247 + mvebu_gpio_set(chip, pin, value); 248 + 247 249 spin_lock_irqsave(&mvchip->lock, flags); 248 250 u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); 249 251 u &= ~(1 << pin); ··· 646 644 ct->handler = handle_edge_irq; 647 645 ct->chip.name = mvchip->chip.label; 648 646 649 - irq_setup_generic_chip(gc, IRQ_MSK(ngpios), IRQ_GC_INIT_MASK_CACHE, 647 + irq_setup_generic_chip(gc, IRQ_MSK(ngpios), 0, 650 648 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); 651 649 652 650 /* Setup irq domain on top of the generic chip. */
+35
drivers/gpio/gpio-omap.c
··· 251 251 } 252 252 } 253 253 254 + /** 255 + * _clear_gpio_debounce - clear debounce settings for a gpio 256 + * @bank: the gpio bank we're acting upon 257 + * @gpio: the gpio number on this @gpio 258 + * 259 + * If a gpio is using debounce, then clear the debounce enable bit and if 260 + * this is the only gpio in this bank using debounce, then clear the debounce 261 + * time too. The debounce clock will also be disabled when calling this function 262 + * if this is the only gpio in the bank using debounce. 263 + */ 264 + static void _clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio) 265 + { 266 + u32 gpio_bit = GPIO_BIT(bank, gpio); 267 + 268 + if (!bank->dbck_flag) 269 + return; 270 + 271 + if (!(bank->dbck_enable_mask & gpio_bit)) 272 + return; 273 + 274 + bank->dbck_enable_mask &= ~gpio_bit; 275 + bank->context.debounce_en &= ~gpio_bit; 276 + __raw_writel(bank->context.debounce_en, 277 + bank->base + bank->regs->debounce_en); 278 + 279 + if (!bank->dbck_enable_mask) { 280 + bank->context.debounce = 0; 281 + __raw_writel(bank->context.debounce, bank->base + 282 + bank->regs->debounce); 283 + clk_disable(bank->dbck); 284 + bank->dbck_enabled = false; 285 + } 286 + } 287 + 254 288 static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, 255 289 unsigned trigger) 256 290 { ··· 573 539 _set_gpio_irqenable(bank, gpio, 0); 574 540 _clear_gpio_irqstatus(bank, gpio); 575 541 _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); 542 + _clear_gpio_debounce(bank, gpio); 576 543 } 577 544 578 545 /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */
+2 -2
drivers/gpio/gpio-timberdale.c
··· 116 116 unsigned long flags; 117 117 118 118 spin_lock_irqsave(&tgpio->lock, flags); 119 - tgpio->last_ier &= ~(1 << offset); 119 + tgpio->last_ier &= ~(1UL << offset); 120 120 iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); 121 121 spin_unlock_irqrestore(&tgpio->lock, flags); 122 122 } ··· 128 128 unsigned long flags; 129 129 130 130 spin_lock_irqsave(&tgpio->lock, flags); 131 - tgpio->last_ier |= 1 << offset; 131 + tgpio->last_ier |= 1UL << offset; 132 132 iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); 133 133 spin_unlock_irqrestore(&tgpio->lock, flags); 134 134 }
+7 -3
drivers/gpio/gpiolib.c
··· 623 623 */ 624 624 625 625 status = gpio_request(gpio, "sysfs"); 626 - if (status < 0) 626 + if (status < 0) { 627 + if (status == -EPROBE_DEFER) 628 + status = -ENODEV; 627 629 goto done; 628 - 630 + } 629 631 status = gpio_export(gpio, true); 630 632 if (status < 0) 631 633 gpio_free(gpio); ··· 1193 1191 1194 1192 spin_lock_irqsave(&gpio_lock, flags); 1195 1193 1196 - if (!gpio_is_valid(gpio)) 1194 + if (!gpio_is_valid(gpio)) { 1195 + status = -EINVAL; 1197 1196 goto done; 1197 + } 1198 1198 desc = &gpio_desc[gpio]; 1199 1199 chip = desc->chip; 1200 1200 if (chip == NULL)