aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/sunxi/patches-4.9/0036-pinctrl-sunxi-Free-configs-in-pinctrl_map-only-if-it.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2017-07-15 22:50:41 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2017-09-18 20:34:55 +0200
commit34a422794ddab738408edc7e3980ccbc14f28af4 (patch)
tree06f99aeb1acab719dea0a5743d44c2026613edbb /target/linux/sunxi/patches-4.9/0036-pinctrl-sunxi-Free-configs-in-pinctrl_map-only-if-it.patch
parente080a7ce07ee8cd63c71e1469853a233d9bc7a4c (diff)
downloadupstream-34a422794ddab738408edc7e3980ccbc14f28af4.tar.gz
upstream-34a422794ddab738408edc7e3980ccbc14f28af4.tar.bz2
upstream-34a422794ddab738408edc7e3980ccbc14f28af4.zip
sunxi: Backport patches needed for A64
This backports multiple patches from kernel 4.10 which are adding missing support for the A64 and the pine64 board. These are the device tree files, the pinctlk and the clock driver. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target/linux/sunxi/patches-4.9/0036-pinctrl-sunxi-Free-configs-in-pinctrl_map-only-if-it.patch')
-rw-r--r--target/linux/sunxi/patches-4.9/0036-pinctrl-sunxi-Free-configs-in-pinctrl_map-only-if-it.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/target/linux/sunxi/patches-4.9/0036-pinctrl-sunxi-Free-configs-in-pinctrl_map-only-if-it.patch b/target/linux/sunxi/patches-4.9/0036-pinctrl-sunxi-Free-configs-in-pinctrl_map-only-if-it.patch
new file mode 100644
index 0000000000..02c5f568c8
--- /dev/null
+++ b/target/linux/sunxi/patches-4.9/0036-pinctrl-sunxi-Free-configs-in-pinctrl_map-only-if-it.patch
@@ -0,0 +1,51 @@
+From 88f01a1bd0e0dbd01b65907023dbe53cf524ea2a Mon Sep 17 00:00:00 2001
+From: Chen-Yu Tsai <wens@csie.org>
+Date: Fri, 11 Nov 2016 10:35:10 +0800
+Subject: pinctrl: sunxi: Free configs in pinctrl_map only if it is a config
+ map
+
+In the recently refactored sunxi pinctrl library, we are only allocating
+one set of pin configs for each pinmux setting node. When the pinctrl_map
+structure is freed, the pin configs should also be freed. However the
+code assumed the first map would contain the configs, which actually
+never happens, as the mux function map gets added first.
+
+The proper way to do this is to look through all the maps and free the
+first one whose type is actually PIN_MAP_TYPE_CONFIGS_GROUP.
+
+Also slightly expand the comment explaining this.
+
+Fixes: f233dbca6227 ("pinctrl: sunxi: Rework the pin config building code")
+Signed-off-by: Chen-Yu Tsai <wens@csie.org>
+Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
+Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
+---
+ drivers/pinctrl/sunxi/pinctrl-sunxi.c | 17 +++++++++++++++--
+ 1 file changed, 15 insertions(+), 2 deletions(-)
+
+--- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c
++++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c
+@@ -408,8 +408,21 @@ static void sunxi_pctrl_dt_free_map(stru
+ struct pinctrl_map *map,
+ unsigned num_maps)
+ {
+- /* All the maps have the same pin config, free only the first one */
+- kfree(map[0].data.configs.configs);
++ int i;
++
++ /* pin config is never in the first map */
++ for (i = 1; i < num_maps; i++) {
++ if (map[i].type != PIN_MAP_TYPE_CONFIGS_GROUP)
++ continue;
++
++ /*
++ * All the maps share the same pin config,
++ * free only the first one we find.
++ */
++ kfree(map[i].data.configs.configs);
++ break;
++ }
++
+ kfree(map);
+ }
+