aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/core.h
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2012-02-22 16:26:01 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-02-24 00:30:50 -0500
commit2304b4737f492b6ee9b714d8129e153af0bef989 (patch)
tree172859048b3a66ac06a80e0c800b4a1ebef7a485 /drivers/pinctrl/core.h
parent02f5b98951c631a3c4b3cc398dd2b14d274a6155 (diff)
pinctrl: remove pin and hogs locks from struct pinctrl_dev
struct pinctrl_dev's pin_desc_tree_lock and pinctrl_hogs_lock aren't useful; the data they protect is read-only except when registering or unregistering a pinctrl_dev, and at those times, it doesn't make sense to protect one part of the structure independently from the rest. Move pinctrl_init_device_debugfs() to the end of pinctrl_register() so that debugfs can't access the struct pinctrl_dev until it's fully initialized, i.e. after the hogs are set up. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/core.h')
-rw-r--r--drivers/pinctrl/core.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index 061c57d0e8f..7551611666f 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -20,7 +20,6 @@ struct pinctrl_gpio_range;
20 * controller 20 * controller
21 * @pin_desc_tree: each pin descriptor for this pin controller is stored in 21 * @pin_desc_tree: each pin descriptor for this pin controller is stored in
22 * this radix tree 22 * this radix tree
23 * @pin_desc_tree_lock: lock for the descriptor tree
24 * @gpio_ranges: a list of GPIO ranges that is handled by this pin controller, 23 * @gpio_ranges: a list of GPIO ranges that is handled by this pin controller,
25 * ranges are added to this list at runtime 24 * ranges are added to this list at runtime
26 * @gpio_ranges_lock: lock for the GPIO ranges list 25 * @gpio_ranges_lock: lock for the GPIO ranges list
@@ -28,7 +27,6 @@ struct pinctrl_gpio_range;
28 * @owner: module providing the pin controller, used for refcounting 27 * @owner: module providing the pin controller, used for refcounting
29 * @driver_data: driver data for drivers registering to the pin controller 28 * @driver_data: driver data for drivers registering to the pin controller
30 * subsystem 29 * subsystem
31 * @pinctrl_hogs_lock: lock for the pin control hog list
32 * @pinctrl_hogs: list of pin control maps hogged by this device 30 * @pinctrl_hogs: list of pin control maps hogged by this device
33 * @device_root: debugfs root for this device 31 * @device_root: debugfs root for this device
34 */ 32 */
@@ -36,13 +34,11 @@ struct pinctrl_dev {
36 struct list_head node; 34 struct list_head node;
37 struct pinctrl_desc *desc; 35 struct pinctrl_desc *desc;
38 struct radix_tree_root pin_desc_tree; 36 struct radix_tree_root pin_desc_tree;
39 spinlock_t pin_desc_tree_lock;
40 struct list_head gpio_ranges; 37 struct list_head gpio_ranges;
41 struct mutex gpio_ranges_lock; 38 struct mutex gpio_ranges_lock;
42 struct device *dev; 39 struct device *dev;
43 struct module *owner; 40 struct module *owner;
44 void *driver_data; 41 void *driver_data;
45 struct mutex pinctrl_hogs_lock;
46 struct list_head pinctrl_hogs; 42 struct list_head pinctrl_hogs;
47#ifdef CONFIG_DEBUG_FS 43#ifdef CONFIG_DEBUG_FS
48 struct dentry *device_root; 44 struct dentry *device_root;
@@ -99,7 +95,12 @@ struct pin_desc {
99}; 95};
100 96
101struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name); 97struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
102struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev, unsigned int pin);
103int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name); 98int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
104int pinctrl_get_group_selector(struct pinctrl_dev *pctldev, 99int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
105 const char *pin_group); 100 const char *pin_group);
101
102static inline struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev,
103 unsigned int pin)
104{
105 return radix_tree_lookup(&pctldev->pin_desc_tree, pin);
106}