pinctrl: stricten up generic group code
authorLinus Walleij <linus.walleij@linaro.org>
Fri, 30 Dec 2016 14:04:43 +0000 (15:04 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 3 Jan 2017 08:26:18 +0000 (09:26 +0100)
Rename the symbol PINCTRL_GENERIC to PINCTRL_GENERIC_GROUPS since
it all pertains to groups. Replace everywhere.

ifdef out the radix tree and the struct when not using the
generic groups.

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

index b986998409d195f32a78de6bc7fc7ef556effaf2..add257f80d76a7d86575758cd63494800a0ad879 100644 (file)
@@ -8,7 +8,7 @@ config PINCTRL
 menu "Pin controllers"
        depends on PINCTRL
 
-config GENERIC_PINCTRL
+config GENERIC_PINCTRL_GROUPS
        bool
 
 config PINMUX
index 7b7d706f869cd7a015a55811d423a26a692de2df..736149d3a33d5963cbb598cf7ae8525c197f417e 100644 (file)
@@ -540,7 +540,7 @@ void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev,
 }
 EXPORT_SYMBOL_GPL(pinctrl_remove_gpio_range);
 
-#ifdef CONFIG_GENERIC_PINCTRL
+#ifdef CONFIG_GENERIC_PINCTRL_GROUPS
 
 /**
  * pinctrl_generic_get_group_count() - returns the number of pin groups
@@ -714,7 +714,7 @@ static void pinctrl_generic_free_groups(struct pinctrl_dev *pctldev)
 static inline void pinctrl_generic_free_groups(struct pinctrl_dev *pctldev)
 {
 }
-#endif /* CONFIG_GENERIC_PINCTRL */
+#endif /* CONFIG_GENERIC_PINCTRL_GROUPS */
 
 /**
  * pinctrl_get_group_selector() - returns the group selector for a group
@@ -1993,7 +1993,9 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
        pctldev->desc = pctldesc;
        pctldev->driver_data = driver_data;
        INIT_RADIX_TREE(&pctldev->pin_desc_tree, GFP_KERNEL);
+#ifdef CONFIG_GENERIC_PINCTRL_GROUPS
        INIT_RADIX_TREE(&pctldev->pin_group_tree, GFP_KERNEL);
+#endif
        INIT_LIST_HEAD(&pctldev->gpio_ranges);
        INIT_DELAYED_WORK(&pctldev->late_init, pinctrl_late_init);
        pctldev->dev = dev;
index af98b63139020cc0fa10ee14790e8a48bb9eb488..b04c59bf97016d09f8a9ad7915ad60747a2500b8 100644 (file)
@@ -43,8 +43,10 @@ struct pinctrl_dev {
        struct list_head node;
        struct pinctrl_desc *desc;
        struct radix_tree_root pin_desc_tree;
+#ifdef CONFIG_GENERIC_PINCTRL_GROUPS
        struct radix_tree_root pin_group_tree;
        unsigned int num_groups;
+#endif
        struct list_head gpio_ranges;
        struct device *dev;
        struct module *owner;
@@ -165,6 +167,20 @@ struct pin_desc {
 #endif
 };
 
+/**
+ * struct pinctrl_maps - a list item containing part of the mapping table
+ * @node: mapping table list node
+ * @maps: array of mapping table entries
+ * @num_maps: the number of entries in @maps
+ */
+struct pinctrl_maps {
+       struct list_head node;
+       struct pinctrl_map const *maps;
+       unsigned num_maps;
+};
+
+#ifdef CONFIG_GENERIC_PINCTRL_GROUPS
+
 /**
  * struct group_desc - generic pin group descriptor
  * @name: name of the pin group
@@ -179,20 +195,6 @@ struct group_desc {
        void *data;
 };
 
-/**
- * struct pinctrl_maps - a list item containing part of the mapping table
- * @node: mapping table list node
- * @maps: array of mapping table entries
- * @num_maps: the number of entries in @maps
- */
-struct pinctrl_maps {
-       struct list_head node;
-       struct pinctrl_map const *maps;
-       unsigned num_maps;
-};
-
-#ifdef CONFIG_GENERIC_PINCTRL
-
 int pinctrl_generic_get_group_count(struct pinctrl_dev *pctldev);
 
 const char *pinctrl_generic_get_group_name(struct pinctrl_dev *pctldev,
@@ -218,7 +220,7 @@ pinctrl_generic_remove_last_group(struct pinctrl_dev *pctldev)
        return pinctrl_generic_remove_group(pctldev, pctldev->num_groups - 1);
 }
 
-#endif /* CONFIG_GENERIC_PINCTRL */
+#endif /* CONFIG_GENERIC_PINCTRL_GROUPS */
 
 struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
 struct pinctrl_dev *get_pinctrl_dev_from_of_node(struct device_node *np);