9589baa1697e5b7b2bc71d01f270f66af0756977
[openwrt.git] / target / linux / lantiq / patches-3.14 / 0034-reset-Fix-compile-when-reset-RESET_CONTROLLER-is-not.patch
1 From b1b9fca8c317afc3f2b78bb54f877e8a830a819d Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Fri, 9 Aug 2013 18:47:27 +0200
4 Subject: [PATCH 34/36] reset: Fix compile when reset RESET_CONTROLLER is not
5  selected
6
7 Drivers need to protect their reset api calls with #ifdef to avoid compile
8 errors.
9
10 This patch adds dummy wrappers in the same way that linux/of.h does it.
11
12 Cc: linux-kernel@vger.kernel.org
13 Cc: Philipp Zabel <p.zabel@pengutronix.de>
14 Cc: Gabor Juhos <juhosg@openwrt.org>
15 ---
16  include/linux/reset-controller.h |   16 ++++++++++++++
17  include/linux/reset.h            |   43 ++++++++++++++++++++++++++++++++++++++
18  2 files changed, 59 insertions(+)
19
20 diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
21 index 41a4695..f38f530 100644
22 --- a/include/linux/reset-controller.h
23 +++ b/include/linux/reset-controller.h
24 @@ -46,7 +46,23 @@ struct reset_controller_dev {
25         unsigned int nr_resets;
26  };
27  
28 +#if defined(CONFIG_RESET_CONTROLLER)
29 +
30  int reset_controller_register(struct reset_controller_dev *rcdev);
31  void reset_controller_unregister(struct reset_controller_dev *rcdev);
32  
33 +#else
34 +
35 +static inline int reset_controller_register(struct reset_controller_dev *rcdev)
36 +{
37 +       return -ENOSYS;
38 +}
39 +
40 +void reset_controller_unregister(struct reset_controller_dev *rcdev)
41 +{
42 +
43 +}
44 +
45 +#endif
46 +
47  #endif
48 diff --git a/include/linux/reset.h b/include/linux/reset.h
49 index 6082247..1b36c9e 100644
50 --- a/include/linux/reset.h
51 +++ b/include/linux/reset.h
52 @@ -1,9 +1,13 @@
53  #ifndef _LINUX_RESET_H_
54  #define _LINUX_RESET_H_
55  
56 +#include <linux/err.h>
57 +
58  struct device;
59  struct reset_control;
60  
61 +#if defined(CONFIG_RESET_CONTROLLER)
62 +
63  int reset_control_reset(struct reset_control *rstc);
64  int reset_control_assert(struct reset_control *rstc);
65  int reset_control_deassert(struct reset_control *rstc);
66 @@ -14,4 +18,43 @@ struct reset_control *devm_reset_control_get(struct device *dev, const char *id)
67  
68  int device_reset(struct device *dev);
69  
70 +#else /* CONFIG_RESET_CONTROLLER */
71 +
72 +static inline int reset_control_reset(struct reset_control *rstc)
73 +{
74 +       return -ENOSYS;
75 +}
76 +
77 +static inline int reset_control_assert(struct reset_control *rstc)
78 +{
79 +       return -ENOSYS;
80 +}
81 +
82 +static inline int reset_control_deassert(struct reset_control *rstc)
83 +{
84 +       return -ENOSYS;
85 +}
86 +
87 +static inline struct reset_control *reset_control_get(struct device *dev, const char *id)
88 +{
89 +       return ERR_PTR(-ENOSYS);
90 +}
91 +
92 +static inline void reset_control_put(struct reset_control *rstc)
93 +{
94 +
95 +}
96 +
97 +static inline struct reset_control *devm_reset_control_get(struct device *dev, const char *id)
98 +{
99 +       return ERR_PTR(-ENOSYS);
100 +}
101 +
102 +static inline int device_reset(struct device *dev)
103 +{
104 +       return -ENOSYS;
105 +}
106 +
107 +#endif
108 +
109  #endif
110 -- 
111 1.7.10.4
112