linux_dsm_epyc7002/drivers/pinctrl
Patrice Chotard 42fed7ba44 pinctrl: move subsystem mutex to pinctrl_dev struct
This mutex avoids deadlock in case of use of multiple pin
controllers. Before this modification, by using a global
mutex, deadlock appeared when, for example, a call to
pinctrl_pins_show() locked the pinctrl_mutex, called the
ops->pin_dbg_show of a particular pin controller. If this
pin controller needs I2C access to retrieve configuration
information and I2C driver is using pinctrl to drive its
pins, a call to pinctrl_select_state() try to lock again
pinctrl_mutex which leads to a deadlock.

Notice that the mutex grab from the two direction functions
was moved into pinctrl_gpio_direction().

For several cases, we can't replace pinctrl_mutex by
pctldev->mutex, because at this stage, pctldev is
not accessible :
	- pinctrl_get()/pinctrl_put()
	- pinctrl_register_maps()

So add respectively pinctrl_list_mutex and
pinctrl_maps_mutex in order to protect
pinctrl_list and pinctrl_maps list instead.

Reintroduce pinctrldev_list_mutex in
find_pinctrl_by_of_node(),
pinctrl_find_and_add_gpio_range()
pinctrl_request_gpio(), pinctrl_free_gpio(),
pinctrl_gpio_direction(), pinctrl_devices_show(),
pinctrl_register() and pinctrl_unregister() to
protect pinctrldev_list.

Changes v2->v3:
- Fix a missing EXPORT_SYMBOL_GPL() for pinctrl_select_state().

Changes v1->v2:
- pinctrl_select_state_locked() is removed, all lock mechanism
  is located inside pinctrl_select_state(). When parsing
  the state->setting list, take the per-pin-controller driver
  lock. (Patrice).
- Introduce pinctrldev_list_mutex to protect pinctrldev_list
  in all functions which parse or modify pictrldev_list.
  (Patrice).
- move find_pinctrl_by_of_node() from pinctrl/devicetree.c to
  pinctrl/core.c in order to protect pinctrldev_list.
  (Patrice).
- Sink mutex:es into some functions and remove some _locked
  variants down to where the lists are actually accessed to
  make things simpler. (Linus)
- Drop *all* mutexes completely from pinctrl_lookup_state()
  and pinctrl_select_state() - no relevant mutex was taken
  and it was unclear what this was protecting against. (Linus)

Reported by : Seraphin Bonnaffe <seraphin.bonnaffe@stericsson.com>
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2013-04-26 17:01:35 +02:00
..
mvebu Linux 3.9-rc5 2013-04-03 22:18:36 +02:00
sh-pfc sh-pfc: sh_pfc_probe() sizeof() fix 2013-02-16 10:58:50 +09:00
spear pinctrl: Declare operation structures as const 2013-03-07 05:27:29 +01:00
core.c pinctrl: move subsystem mutex to pinctrl_dev struct 2013-04-26 17:01:35 +02:00
core.h pinctrl: move subsystem mutex to pinctrl_dev struct 2013-04-26 17:01:35 +02:00
devicetree.c pinctrl: move subsystem mutex to pinctrl_dev struct 2013-04-26 17:01:35 +02:00
devicetree.h pinctrl: core device tree mapping table parsing support 2012-04-18 13:53:10 +02:00
Kconfig pinctrl: Add pinctrl-s3c64xx driver 2013-04-09 09:45:10 +02:00
Makefile pinctrl: Add pinctrl-s3c64xx driver 2013-04-09 09:45:10 +02:00
pinconf-generic.c pinctrl: generic: Fix checkpatch errors 2013-03-27 22:49:13 +01:00
pinconf.c pinctrl: move subsystem mutex to pinctrl_dev struct 2013-04-26 17:01:35 +02:00
pinconf.h Linux 3.9-rc5 2013-04-03 22:18:36 +02:00
pinctrl-ab8500.c pinctrl: ab8500: Staticize some symbols 2013-04-09 09:54:00 +02:00
pinctrl-ab8505.c pinctrl: ab8505: Staticize some symbols 2013-04-09 09:59:42 +02:00
pinctrl-ab8540.c pinctrl: ab8540: Staticize some symbols 2013-04-09 09:58:02 +02:00
pinctrl-ab9540.c pinctrl: ab9540: Staticize some symbols 2013-04-09 09:55:59 +02:00
pinctrl-abx500.c pinctrl: abx500: fix issue when no pdata 2013-04-18 10:28:04 +02:00
pinctrl-abx500.h pinctrl/abx500: replace IRQ offsets with table read-in values 2013-02-10 15:44:33 +01:00
pinctrl-at91.c Linux 3.9-rc5 2013-04-03 22:18:36 +02:00
pinctrl-bcm2835.c pinctrl: Declare operation structures as const 2013-03-07 05:27:29 +01:00
pinctrl-coh901.c pinctrl: coh901: Fix error checking in u300_gpio_to_irq 2013-04-03 14:31:19 +02:00
pinctrl-coh901.h pinctrl: support pinconfig on the U300 2012-03-12 22:49:03 +01:00
pinctrl-exynos5440.c pinctrl: exynos5440: add gpio interrupt support 2013-04-09 10:16:53 +02:00
pinctrl-exynos.c pinctrl: samsung: Remove hardcoded register offsets 2013-04-09 09:42:25 +02:00
pinctrl-exynos.h pinctrl: samsung: Split pin bank description into two structures 2013-04-09 09:41:09 +02:00
pinctrl-falcon.c pinctrl: Declare operation structures as const 2013-03-07 05:27:29 +01:00
pinctrl-imx6q.c Drivers: pinctrl: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
pinctrl-imx23.c Drivers: pinctrl: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
pinctrl-imx28.c Drivers: pinctrl: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
pinctrl-imx35.c Drivers: pinctrl: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
pinctrl-imx51.c Drivers: pinctrl: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
pinctrl-imx53.c Driver core __dev* removal patches 2013-01-03 16:17:50 -08:00
pinctrl-imx.c pinctrl: Declare operation structures as const 2013-03-07 05:27:29 +01:00
pinctrl-imx.h pinctrl: pinctrl-imx: add imx pinctrl core driver 2012-05-02 01:14:40 +02:00
pinctrl-lantiq.c pinctrl: Declare operation structures as const 2013-03-07 05:27:29 +01:00
pinctrl-lantiq.h pinctrl/lantiq: add output pinconf parameter 2013-02-05 16:17:22 +01:00
pinctrl-mxs.c pinctrl: Declare operation structures as const 2013-03-07 05:27:29 +01:00
pinctrl-mxs.h pinctrl: add pinctrl-mxs support 2012-05-02 01:18:27 +02:00
pinctrl-nomadik-db8500.c pinctrl/nomadik-db8500: Fix checkpatch errors 2013-03-27 22:21:32 +01:00
pinctrl-nomadik-db8540.c Drivers: pinctrl: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
pinctrl-nomadik-stn8815.c pinctrl: pinctrl-nomadik-stn8815: Fix checkpatch error 2013-03-13 19:50:20 +01:00
pinctrl-nomadik.c pinctrl/nomadik: add device tree bindings for db8540 2013-04-03 19:21:05 +02:00
pinctrl-nomadik.h pinctrl/nomadik: move the platform data header 2012-11-05 09:55:27 +01:00
pinctrl-s3c64xx.c pinctrl: s3c64xx: Fix build error caused by undefined chained_irq_enter 2013-04-23 13:59:45 +02:00
pinctrl-samsung.c pinctrl: Add pinctrl-s3c64xx driver 2013-04-09 09:45:10 +02:00
pinctrl-samsung.h pinctrl: Add pinctrl-s3c64xx driver 2013-04-09 09:45:10 +02:00
pinctrl-single.c pinctrl: single: correct argument for pinconf 2013-03-13 19:50:19 +01:00
pinctrl-sirf.c pinctrl: sirf: using for_each_set_bit to simplify the code 2013-03-27 22:57:14 +01:00
pinctrl-sunxi.c pinctrl: sunxi: Rename wemac functions to emac 2013-04-09 10:47:52 +02:00
pinctrl-sunxi.h ARM: pinctrl: sunxi: Add the pinctrl pin set for Allwinner A10 2013-02-01 10:45:34 +01:00
pinctrl-tegra20.c pinctrl: tegra: add support for rcv-sel and drive type 2013-01-18 16:13:52 +01:00
pinctrl-tegra30.c pinctrl: tegra: add support for rcv-sel and drive type 2013-01-18 16:13:52 +01:00
pinctrl-tegra114.c pinctrl: tegra: add clfvs function to Tegra114 support 2013-02-15 20:22:39 +01:00
pinctrl-tegra.c pinctrl: Declare operation structures as const 2013-03-07 05:27:29 +01:00
pinctrl-tegra.h pinctrl: tegra: add support for rcv-sel and drive type 2013-01-18 16:13:52 +01:00
pinctrl-u300.c pinctrl: Declare operation structures as const 2013-03-07 05:27:29 +01:00
pinctrl-xway.c pinctrl: Declare operation structures as const 2013-03-07 05:27:29 +01:00
pinmux.c pinctrl: move subsystem mutex to pinctrl_dev struct 2013-04-26 17:01:35 +02:00
pinmux.h pinctrl: ifdef CONFIG_DEBUG_FS cleanup 2012-04-18 13:53:12 +02:00