diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2014-09-29 09:17:04 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-09-29 09:17:04 -0400 |
commit | ba388294a5e07335a998d64f0b4a05857425a440 (patch) | |
tree | ad3db9dd7a1c9af61630847a15787f0f5489414c | |
parent | cf1fc187628913070c3e418ce0e205732435aa2f (diff) |
pinctrl: nomadik: use util function to reserve maps
Stop brewing our own pin map reservation function and use the
generic code.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/pinctrl/nomadik/pinctrl-nomadik.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index c093d75a022a..9fe31daf9230 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/pinctrl/consumer.h> | 32 | #include <linux/pinctrl/consumer.h> |
33 | #include "pinctrl-nomadik.h" | 33 | #include "pinctrl-nomadik.h" |
34 | #include "../core.h" | 34 | #include "../core.h" |
35 | #include "../pinctrl-utils.h" | ||
35 | 36 | ||
36 | /* | 37 | /* |
37 | * The GPIO module in the Nomadik family of Systems-on-Chip is an | 38 | * The GPIO module in the Nomadik family of Systems-on-Chip is an |
@@ -1349,28 +1350,6 @@ static void nmk_pinctrl_dt_free_map(struct pinctrl_dev *pctldev, | |||
1349 | kfree(map); | 1350 | kfree(map); |
1350 | } | 1351 | } |
1351 | 1352 | ||
1352 | static int nmk_dt_reserve_map(struct pinctrl_map **map, unsigned *reserved_maps, | ||
1353 | unsigned *num_maps, unsigned reserve) | ||
1354 | { | ||
1355 | unsigned old_num = *reserved_maps; | ||
1356 | unsigned new_num = *num_maps + reserve; | ||
1357 | struct pinctrl_map *new_map; | ||
1358 | |||
1359 | if (old_num >= new_num) | ||
1360 | return 0; | ||
1361 | |||
1362 | new_map = krealloc(*map, sizeof(*new_map) * new_num, GFP_KERNEL); | ||
1363 | if (!new_map) | ||
1364 | return -ENOMEM; | ||
1365 | |||
1366 | memset(new_map + old_num, 0, (new_num - old_num) * sizeof(*new_map)); | ||
1367 | |||
1368 | *map = new_map; | ||
1369 | *reserved_maps = new_num; | ||
1370 | |||
1371 | return 0; | ||
1372 | } | ||
1373 | |||
1374 | static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned *reserved_maps, | 1353 | static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned *reserved_maps, |
1375 | unsigned *num_maps, const char *group, | 1354 | unsigned *num_maps, const char *group, |
1376 | const char *function) | 1355 | const char *function) |
@@ -1561,7 +1540,7 @@ static int nmk_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, | |||
1561 | 1540 | ||
1562 | reserve *= ret; | 1541 | reserve *= ret; |
1563 | 1542 | ||
1564 | ret = nmk_dt_reserve_map(map, reserved_maps, num_maps, reserve); | 1543 | ret = pinctrl_utils_reserve_map(pctldev, map, reserved_maps, num_maps, reserve); |
1565 | if (ret < 0) | 1544 | if (ret < 0) |
1566 | goto exit; | 1545 | goto exit; |
1567 | 1546 | ||