diff options
author | Linus Torvalds | 2012-10-02 16:05:10 -0700 |
---|---|---|
committer | Linus Torvalds | 2012-10-02 16:05:10 -0700 |
commit | dff8360a4a079692e65e55fbaa6c5dc605528403 (patch) | |
tree | 0ab8ef7595cdfb918b3fd9a8364c6ea6c9c2798f /drivers/gpio/gpio-pch.c | |
parent | 916082b073ebb7f4e064cebce0768e34cacde508 (diff) | |
parent | 901acf5b2910434501c221a363bb3486b647b5c4 (diff) |
Merge tag 'gpio-for-v3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO changes from Linus Walleij:
"So this is the LW GPIO patch stack for v3.7:
- refactoring from Thierry Redding at Arnd Bergmann's request to use
the seq_file iterator interface in gpiolib.
- A new driver for Avionic Design's N-bit GPIO expander.
- Two instances of mutexes replaced by spinlocks from Axel Lin to
code that is supposed to be fastpath compliant.
- IRQ demuxer and gpio_to_irq() support for pcf857x by Kuninori
Morimoto.
- Dynamic GPIO numbers, device tree support, daisy chaining and some
other fixes for the 74x164 driver by Maxime Ripard.
- IRQ domain and device tree support for the tc3589x driver by Lee
Jones.
- Some conversion to use managed resources devm_* code.
- Some instances of clk_prepare() or clk_prepare_enable() added to
support the new, stricter common clock framework.
- Some for_each_set_bit() simplifications.
- Then a lot of fixes as we fixed up all of the above tripping over
our own shoelaces and that kind of thing."
* tag 'gpio-for-v3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (34 commits)
gpio: pcf857x: select IRQ_DOMAIN
gpio: Document device_node's det_debounce
gpio-lpc32xx: Add GPI_28
gpio: adnp: dt: Reference generic interrupt binding
gpio: Add Avionic Design N-bit GPIO expander support
gpio: pxa: using for_each_set_bit to simplify the code
gpio_msm: using for_each_set_bit to simplify the code
gpio: Enable the tc3298x GPIO expander driver for Device Tree
gpio: Provide the tc3589x GPIO expander driver with an IRQ domain
ARM: shmobile: kzm9g: use gpio-keys instead of gpio-keys-polled
gpio: pcf857x: fixup smatch WARNING
gpio: 74x164: Add support for the daisy-chaining
gpio: 74x164: dts: Add documentation for the dt binding
dt: Fix incorrect reference in gpio-led documentation
gpio: 74x164: Add device tree support
gpio: 74x164: Use dynamic gpio number assignment if no pdata is present
gpio: 74x164: Use devm_kzalloc
gpio: 74x164: Use module_spi_driver boiler plate function
gpio: sx150x: Use irq_data_get_irq_chip_data() at appropriate places
gpio: em: Use irq_data_get_irq_chip_data() at appropriate places
...
Diffstat (limited to 'drivers/gpio/gpio-pch.c')
-rw-r--r-- | drivers/gpio/gpio-pch.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index 139ad3e20011..4ad0c4f9171c 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -92,9 +92,7 @@ struct pch_gpio_reg_data { * @lock: Used for register access protection * @irq_base: Save base of IRQ number for interrupt * @ioh: IOH ID - * @spinlock: Used for register access protection in - * interrupt context pch_irq_mask, - * pch_irq_unmask and pch_irq_type; + * @spinlock: Used for register access protection */ struct pch_gpio { void __iomem *base; @@ -102,7 +100,6 @@ struct pch_gpio { struct device *dev; struct gpio_chip gpio; struct pch_gpio_reg_data pch_gpio_reg; - struct mutex lock; int irq_base; enum pch_type_t ioh; spinlock_t spinlock; @@ -112,8 +109,9 @@ static void pch_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) { u32 reg_val; struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); + unsigned long flags; - mutex_lock(&chip->lock); + spin_lock_irqsave(&chip->spinlock, flags); reg_val = ioread32(&chip->reg->po); if (val) reg_val |= (1 << nr); @@ -121,7 +119,7 @@ static void pch_gpio_set(struct gpio_chip *gpio, unsigned nr, int val) reg_val &= ~(1 << nr); iowrite32(reg_val, &chip->reg->po); - mutex_unlock(&chip->lock); + spin_unlock_irqrestore(&chip->spinlock, flags); } static int pch_gpio_get(struct gpio_chip *gpio, unsigned nr) @@ -137,8 +135,9 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); u32 pm; u32 reg_val; + unsigned long flags; - mutex_lock(&chip->lock); + spin_lock_irqsave(&chip->spinlock, flags); pm = ioread32(&chip->reg->pm) & ((1 << gpio_pins[chip->ioh]) - 1); pm |= (1 << nr); iowrite32(pm, &chip->reg->pm); @@ -149,8 +148,7 @@ static int pch_gpio_direction_output(struct gpio_chip *gpio, unsigned nr, else reg_val &= ~(1 << nr); iowrite32(reg_val, &chip->reg->po); - - mutex_unlock(&chip->lock); + spin_unlock_irqrestore(&chip->spinlock, flags); return 0; } @@ -159,12 +157,13 @@ static int pch_gpio_direction_input(struct gpio_chip *gpio, unsigned nr) { struct pch_gpio *chip = container_of(gpio, struct pch_gpio, gpio); u32 pm; + unsigned long flags; - mutex_lock(&chip->lock); + spin_lock_irqsave(&chip->spinlock, flags); pm = ioread32(&chip->reg->pm) & ((1 << gpio_pins[chip->ioh]) - 1); pm &= ~(1 << nr); iowrite32(pm, &chip->reg->pm); - mutex_unlock(&chip->lock); + spin_unlock_irqrestore(&chip->spinlock, flags); return 0; } @@ -387,7 +386,6 @@ static int __devinit pch_gpio_probe(struct pci_dev *pdev, chip->reg = chip->base; pci_set_drvdata(pdev, chip); - mutex_init(&chip->lock); spin_lock_init(&chip->spinlock); pch_gpio_setup(chip); ret = gpiochip_add(&chip->gpio); |