pinctrl: core: Make dt_free_map optional
authorTony Lindgren <tony@atomide.com>
Fri, 30 Dec 2016 18:37:31 +0000 (10:37 -0800)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 9 Jan 2017 18:41:07 +0000 (19:41 +0100)
If the pin controller driver is using devm_kzalloc, there may not be
anything to do for dt_free_map. Let's make it optional to avoid
unncessary boilerplate code.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/core.c
drivers/pinctrl/devicetree.c

index 9f305ac06275d6f45adb05ff1c7567b71f0c6bde..5b1ab06d92c2dd1dc9e00cff083ed85191b4a04d 100644 (file)
@@ -1913,9 +1913,6 @@ static int pinctrl_check_ops(struct pinctrl_dev *pctldev)
            !ops->get_group_name)
                return -EINVAL;
 
-       if (ops->dt_node_to_map && !ops->dt_free_map)
-               return -EINVAL;
-
        return 0;
 }
 
index e082bddad83a0e08797e17d74991adf34404e48e..0e5c9f14a706e6f25cceeccecc0e67527e7051aa 100644 (file)
@@ -42,7 +42,8 @@ static void dt_free_map(struct pinctrl_dev *pctldev,
 {
        if (pctldev) {
                const struct pinctrl_ops *ops = pctldev->desc->pctlops;
-               ops->dt_free_map(pctldev, map, num_maps);
+               if (ops->dt_free_map)
+                       ops->dt_free_map(pctldev, map, num_maps);
        } else {
                /* There is no pctldev for PIN_MAP_TYPE_DUMMY_STATE */
                kfree(map);