OpenCloudOS-Kernel/drivers/pinctrl/samsung
Youngmin Nam d9ff0eb9ca pinctrl: samsung: fix SMP race condition
Previously, samsung_gpio_drection_in/output function were not covered
with a spinlock.

For example, samsung_gpio_direction_output function consists of
two functions.
1. samsung_gpio_set
2. samsung_gpio_set_direction

When 2 CPUs try to control the same gpio pin heavily,
(situation like i2c control with gpio emulation)
This situation can cause below problem.

CPU 0                                   | CPU1
                                        |
samsung_gpio_direction_output           |
   samsung_gpio_set(pin A as 1)         | samsung_gpio_direction_output
                                        |    samsung_gpio_set(pin A as 0)
   samsung_gpio_set_direction           |
                                        |    samsung_gpio_set_direction

The initial value of pin A will be set as 0 while we wanted to set pin A as 1.

This patch modifies samsung_gpio_direction_in/output function
to be done in one spinlock to fix race condition.

Additionally, the new samsung_gpio_set_value was added to implement
gpio set callback(samsung_gpio_set) with spinlock using this function.

Cc: stable@vger.kernel.org
Signed-off-by: Youngmin Nam <ym0914@gmail.com>
Acked-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-15 20:45:50 +01:00
..
Kconfig pinctrl: samsung: Group all drivers in a sub-dir 2014-07-11 14:08:40 +02:00
Makefile pinctrl: samsung: Group all drivers in a sub-dir 2014-07-11 14:08:40 +02:00
pinctrl-exynos.c GPIO bulk updates for the v4.5 kernel cycle: 2016-01-17 12:32:01 -08:00
pinctrl-exynos.h pinctrl: exynos: Add irq_chip instance for Exynos7 wakeup interrupts 2014-11-09 22:27:19 +09:00
pinctrl-exynos5440.c pinctrl: exynos5440: use gpiochip data pointer 2016-01-05 14:15:08 +01:00
pinctrl-s3c24xx.c Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2015-09-18 08:11:42 -07:00
pinctrl-s3c64xx.c genirq: Remove irq argument from irq flow handlers 2015-09-16 15:47:51 +02:00
pinctrl-samsung.c pinctrl: samsung: fix SMP race condition 2016-02-15 20:45:50 +01:00
pinctrl-samsung.h pinctrl: exynos: add exynos5410 SoC specific data 2015-11-16 10:54:43 +09:00