Skip to content

Commit

Permalink
viafb: Do not remove gpiochip under spinlock
Browse files Browse the repository at this point in the history
gpiochip_remove() is not meant to be called with interrupts disabled, and
there is no need for the lock here in any case.

Reported-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
  • Loading branch information
Jonathan Corbet committed May 7, 2010
1 parent 2b78a96 commit 27fe971
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/video/via/via-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,24 +246,23 @@ static int viafb_gpio_remove(struct platform_device *platdev)
unsigned long flags;
int ret = 0, i;

spin_lock_irqsave(&gpio_config.vdev->reg_lock, flags);
/*
* Get unregistered.
*/
if (gpio_config.gpio_chip.ngpio > 0) {
ret = gpiochip_remove(&gpio_config.gpio_chip);
if (ret) { /* Somebody still using it? */
printk(KERN_ERR "Viafb: GPIO remove failed\n");
goto out;
return ret;
}
}
/*
* Disable the ports.
*/
spin_lock_irqsave(&gpio_config.vdev->reg_lock, flags);
for (i = 0; i < gpio_config.gpio_chip.ngpio; i += 2)
viafb_gpio_disable(gpio_config.active_gpios[i]);
gpio_config.gpio_chip.ngpio = 0;
out:
spin_unlock_irqrestore(&gpio_config.vdev->reg_lock, flags);
return ret;
}
Expand Down

0 comments on commit 27fe971

Please sign in to comment.