aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/reset.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/reset.h')
-rw-r--r--include/linux/reset.h50
1 files changed, 16 insertions, 34 deletions
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 4c7871ddf3c6..09732c36f351 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -2,8 +2,10 @@
2#ifndef _LINUX_RESET_H_ 2#ifndef _LINUX_RESET_H_
3#define _LINUX_RESET_H_ 3#define _LINUX_RESET_H_
4 4
5#include <linux/device.h> 5#include <linux/types.h>
6 6
7struct device;
8struct device_node;
7struct reset_control; 9struct reset_control;
8 10
9#ifdef CONFIG_RESET_CONTROLLER 11#ifdef CONFIG_RESET_CONTROLLER
@@ -20,22 +22,16 @@ struct reset_control *__reset_control_get(struct device *dev, const char *id,
20 int index, bool shared, 22 int index, bool shared,
21 bool optional); 23 bool optional);
22void reset_control_put(struct reset_control *rstc); 24void reset_control_put(struct reset_control *rstc);
25int __device_reset(struct device *dev, bool optional);
23struct reset_control *__devm_reset_control_get(struct device *dev, 26struct reset_control *__devm_reset_control_get(struct device *dev,
24 const char *id, int index, bool shared, 27 const char *id, int index, bool shared,
25 bool optional); 28 bool optional);
26 29
27int __must_check device_reset(struct device *dev);
28
29struct reset_control *devm_reset_control_array_get(struct device *dev, 30struct reset_control *devm_reset_control_array_get(struct device *dev,
30 bool shared, bool optional); 31 bool shared, bool optional);
31struct reset_control *of_reset_control_array_get(struct device_node *np, 32struct reset_control *of_reset_control_array_get(struct device_node *np,
32 bool shared, bool optional); 33 bool shared, bool optional);
33 34
34static inline int device_reset_optional(struct device *dev)
35{
36 return device_reset(dev);
37}
38
39#else 35#else
40 36
41static inline int reset_control_reset(struct reset_control *rstc) 37static inline int reset_control_reset(struct reset_control *rstc)
@@ -62,15 +58,9 @@ static inline void reset_control_put(struct reset_control *rstc)
62{ 58{
63} 59}
64 60
65static inline int __must_check device_reset(struct device *dev) 61static inline int __device_reset(struct device *dev, bool optional)
66{
67 WARN_ON(1);
68 return -ENOTSUPP;
69}
70
71static inline int device_reset_optional(struct device *dev)
72{ 62{
73 return -ENOTSUPP; 63 return optional ? 0 : -ENOTSUPP;
74} 64}
75 65
76static inline struct reset_control *__of_reset_control_get( 66static inline struct reset_control *__of_reset_control_get(
@@ -109,6 +99,16 @@ of_reset_control_array_get(struct device_node *np, bool shared, bool optional)
109 99
110#endif /* CONFIG_RESET_CONTROLLER */ 100#endif /* CONFIG_RESET_CONTROLLER */
111 101
102static inline int __must_check device_reset(struct device *dev)
103{
104 return __device_reset(dev, false);
105}
106
107static inline int device_reset_optional(struct device *dev)
108{
109 return __device_reset(dev, true);
110}
111
112/** 112/**
113 * reset_control_get_exclusive - Lookup and obtain an exclusive reference 113 * reset_control_get_exclusive - Lookup and obtain an exclusive reference
114 * to a reset controller. 114 * to a reset controller.
@@ -127,9 +127,6 @@ of_reset_control_array_get(struct device_node *np, bool shared, bool optional)
127static inline struct reset_control * 127static inline struct reset_control *
128__must_check reset_control_get_exclusive(struct device *dev, const char *id) 128__must_check reset_control_get_exclusive(struct device *dev, const char *id)
129{ 129{
130#ifndef CONFIG_RESET_CONTROLLER
131 WARN_ON(1);
132#endif
133 return __reset_control_get(dev, id, 0, false, false); 130 return __reset_control_get(dev, id, 0, false, false);
134} 131}
135 132
@@ -275,9 +272,6 @@ static inline struct reset_control *
275__must_check devm_reset_control_get_exclusive(struct device *dev, 272__must_check devm_reset_control_get_exclusive(struct device *dev,
276 const char *id) 273 const char *id)
277{ 274{
278#ifndef CONFIG_RESET_CONTROLLER
279 WARN_ON(1);
280#endif
281 return __devm_reset_control_get(dev, id, 0, false, false); 275 return __devm_reset_control_get(dev, id, 0, false, false);
282} 276}
283 277
@@ -350,18 +344,6 @@ devm_reset_control_get_shared_by_index(struct device *dev, int index)
350 * These inline function calls will be removed once all consumers 344 * These inline function calls will be removed once all consumers
351 * have been moved over to the new explicit API. 345 * have been moved over to the new explicit API.
352 */ 346 */
353static inline struct reset_control *reset_control_get(
354 struct device *dev, const char *id)
355{
356 return reset_control_get_exclusive(dev, id);
357}
358
359static inline struct reset_control *reset_control_get_optional(
360 struct device *dev, const char *id)
361{
362 return reset_control_get_optional_exclusive(dev, id);
363}
364
365static inline struct reset_control *of_reset_control_get( 347static inline struct reset_control *of_reset_control_get(
366 struct device_node *node, const char *id) 348 struct device_node *node, const char *id)
367{ 349{