+++ /dev/null
-From 9097103f06332d099c5ab06d1e7f22f4bcaca6e2 Mon Sep 17 00:00:00 2001
-From: Robert Jarzmik <robert.jarzmik@free.fr>
-Date: Fri, 12 Feb 2016 23:29:04 +0100
-Subject: mtd: nand: pxa3xx_nand: fix dmaengine initialization
-
-From: Robert Jarzmik <robert.jarzmik@free.fr>
-
-commit 9097103f06332d099c5ab06d1e7f22f4bcaca6e2 upstream.
-
-When the driver is initialized in a pure device-tree platform, the
-driver's probe fails allocating the dma channel :
-[ 525.624435] pxa3xx-nand 43100000.nand: no resource defined for data DMA
-[ 525.632088] pxa3xx-nand 43100000.nand: alloc nand resource failed
-
-The reason is that the DMA IO resource is not acquired through platform
-resources but by OF bindings.
-
-Fix this by ensuring that DMA IO resources are only queried in the non
-device-tree case.
-
-Fixes: 8f5ba31aa565 ("mtd: nand: pxa3xx-nand: switch to dmaengine")
-Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
-Acked-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
-Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- drivers/mtd/nand/pxa3xx_nand.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/mtd/nand/pxa3xx_nand.c
-+++ b/drivers/mtd/nand/pxa3xx_nand.c
-@@ -1750,7 +1750,7 @@ static int alloc_nand_resource(struct pl
- if (ret < 0)
- return ret;
-
-- if (use_dma) {
-+ if (!np && use_dma) {
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (r == NULL) {
- dev_err(&pdev->dev,
--- /dev/null
+From 49a6bb7a1c0963f260e4b0dcc2c0e56ec65a28b2 Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@kernel.org>
+Date: Tue, 1 Dec 2015 15:51:52 +0000
+Subject: regulator: core: Ensure we lock all regulators
+
+From: Mark Brown <broonie@kernel.org>
+
+commit 49a6bb7a1c0963f260e4b0dcc2c0e56ec65a28b2 upstream.
+
+The latest workaround for the lockdep interface's not using the second
+argument of mutex_lock_nested() changed the loop missed locking the last
+regulator due to a thinko with the loop termination condition exiting
+one regulator too soon.
+
+Reported-by: Tyler Baker <tyler.baker@linaro.org>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/regulator/core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/regulator/core.c
++++ b/drivers/regulator/core.c
+@@ -141,7 +141,7 @@ static void regulator_lock_supply(struct
+ int i;
+
+ mutex_lock(&rdev->mutex);
+- for (i = 1; rdev->supply; rdev = rdev->supply->rdev, i++)
++ for (i = 1; rdev; rdev = rdev->supply->rdev, i++)
+ mutex_lock_nested(&rdev->mutex, i);
+ }
+
--- /dev/null
+From 70a7fb80e85ae7f78f8e90cec3fbd862ea6a4d4b Mon Sep 17 00:00:00 2001
+From: Thierry Reding <treding@nvidia.com>
+Date: Wed, 2 Dec 2015 16:54:50 +0100
+Subject: regulator: core: Fix nested locking of supplies
+
+From: Thierry Reding <treding@nvidia.com>
+
+commit 70a7fb80e85ae7f78f8e90cec3fbd862ea6a4d4b upstream.
+
+Commit fa731ac7ea04 ("regulator: core: avoid unused variable warning")
+introduced a subtle change in how supplies are locked. Where previously
+code was always locking the regulator of the current iteration, the new
+implementation only locks the regulator if it has a supply. For any
+given power tree that means that the root will never get locked.
+
+On the other hand the regulator_unlock_supply() will still release all
+the locks, which in turn causes the lock debugging code to warn about a
+mutex being unlocked which wasn't locked.
+
+Cc: Mark Brown <broonie@kernel.org>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Fixes: fa731ac7ea04 ("regulator: core: avoid unused variable warning")
+Signed-off-by: Thierry Reding <treding@nvidia.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/regulator/core.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+--- a/drivers/regulator/core.c
++++ b/drivers/regulator/core.c
+@@ -132,6 +132,14 @@ static bool have_full_constraints(void)
+ return has_full_constraints || of_have_populated_dt();
+ }
+
++static inline struct regulator_dev *rdev_get_supply(struct regulator_dev *rdev)
++{
++ if (rdev && rdev->supply)
++ return rdev->supply->rdev;
++
++ return NULL;
++}
++
+ /**
+ * regulator_lock_supply - lock a regulator and its supplies
+ * @rdev: regulator source
+@@ -140,8 +148,7 @@ static void regulator_lock_supply(struct
+ {
+ int i;
+
+- mutex_lock(&rdev->mutex);
+- for (i = 1; rdev; rdev = rdev->supply->rdev, i++)
++ for (i = 0; rdev; rdev = rdev_get_supply(rdev), i++)
+ mutex_lock_nested(&rdev->mutex, i);
+ }
+
--- /dev/null
+From bb41897e38c53458a88b271f2fbcd905ee1f9584 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Fri, 27 Nov 2015 14:46:41 +0100
+Subject: regulator: core: fix regulator_lock_supply regression
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit bb41897e38c53458a88b271f2fbcd905ee1f9584 upstream.
+
+As noticed by Geert Uytterhoeven, my patch to avoid a harmless build warning
+in regulator_lock_supply() was total crap and introduced a real bug:
+
+> [ BUG: bad unlock balance detected! ]
+> kworker/u4:0/6 is trying to release lock (&rdev->mutex) at:
+> [<c0247b84>] regulator_set_voltage+0x38/0x50
+
+we still lock the regulator supplies, but not the actual regulators,
+so we are missing a lock, and the unlock is unbalanced.
+
+This rectifies it by first locking the regulator device itself before
+using the same loop as before to lock its supplies.
+
+Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Fixes: 716fec9d1965 ("[SUBMITTED] regulator: core: avoid unused variable warning")
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/regulator/core.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/regulator/core.c
++++ b/drivers/regulator/core.c
+@@ -140,7 +140,8 @@ static void regulator_lock_supply(struct
+ {
+ int i;
+
+- for (i = 0; rdev->supply; rdev = rdev->supply->rdev, i++)
++ mutex_lock(&rdev->mutex);
++ for (i = 1; rdev->supply; rdev = rdev->supply->rdev, i++)
+ mutex_lock_nested(&rdev->mutex, i);
+ }
+
--- /dev/null
+From foo@baz Mon May 2 11:14:34 PDT 2016
+Date: Mon, 02 May 2016 11:14:34 -0700
+To: Greg KH <gregkh@linuxfoundation.org>
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Subject: Revert "regulator: core: Fix nested locking of supplies"
+
+This reverts commit b1999fa6e8145305a6c8bda30ea20783717708e6 which was
+commit 70a7fb80e85ae7f78f8e90cec3fbd862ea6a4d4b upstream.
+
+It causes run-time breakage in the 4.4-stable tree and more patches are
+needed to be applied first before this one in order to resolve the
+issue.
+
+Reported-by: Guenter Roeck <linux@roeck-us.net>
+Cc: Mark Brown <broonie@kernel.org>
+Cc: Arnd Bergmann <arnd@arndb.de>
+Cc: Thierry Reding <treding@nvidia.com>
+Cc: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/regulator/core.c | 10 +---------
+ 1 file changed, 1 insertion(+), 9 deletions(-)
+
+--- a/drivers/regulator/core.c
++++ b/drivers/regulator/core.c
+@@ -132,14 +132,6 @@ static bool have_full_constraints(void)
+ return has_full_constraints || of_have_populated_dt();
+ }
+
+-static inline struct regulator_dev *rdev_get_supply(struct regulator_dev *rdev)
+-{
+- if (rdev && rdev->supply)
+- return rdev->supply->rdev;
+-
+- return NULL;
+-}
+-
+ /**
+ * regulator_lock_supply - lock a regulator and its supplies
+ * @rdev: regulator source
+@@ -148,7 +140,7 @@ static void regulator_lock_supply(struct
+ {
+ int i;
+
+- for (i = 0; rdev->supply; rdev = rdev_get_supply(rdev), i++)
++ for (i = 0; rdev->supply; rdev = rdev->supply->rdev, i++)
+ mutex_lock_nested(&rdev->mutex, i);
+ }
+
dmaengine-dw-fix-master-selection.patch
dmaengine-hsu-correct-use-of-channel-status-register.patch
dmaengine-pxa_dma-fix-the-maximum-requestor-line.patch
-mtd-nand-pxa3xx_nand-fix-dmaengine-initialization.patch
sched-cgroup-fix-cleanup-cgroup-teardown-init.patch
arm64-honour-pte_write-in-set_pte_at-for-kernel-mappings.patch
arm64-update-pte_rdonly-in-set_pte_at-for-prot_none-permission.patch
usb-usbip-fix-potential-out-of-bounds-write.patch
videobuf2-core-check-user-space-planes-array-in-dqbuf.patch
videobuf2-v4l2-verify-planes-array-in-buffer-dequeueing.patch
+revert-regulator-core-fix-nested-locking-of-supplies.patch
+regulator-core-fix-regulator_lock_supply-regression.patch
+regulator-core-ensure-we-lock-all-regulators.patch
+regulator-core-fix-nested-locking-of-supplies.patch