ramips: select kmod-rt2800-soc by default (if available)
[openwrt.git] / target / linux / ramips / patches-3.10 / 0002-reset-Fix-compile-when-reset-RESET_CONTROLLER-is-not.patch
1 From 080f1a0c539180a88066fb004a8c31eefdf74161 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 02/25] 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 --- a/include/linux/reset-controller.h
21 +++ b/include/linux/reset-controller.h
22 @@ -45,7 +45,23 @@ struct reset_controller_dev {
23         unsigned int nr_resets;
24  };
25  
26 +#if defined(CONFIG_RESET_CONTROLLER)
27 +
28  int reset_controller_register(struct reset_controller_dev *rcdev);
29  void reset_controller_unregister(struct reset_controller_dev *rcdev);
30  
31 +#else
32 +
33 +static inline int reset_controller_register(struct reset_controller_dev *rcdev)
34 +{
35 +       return -ENOSYS;
36 +}
37 +
38 +void reset_controller_unregister(struct reset_controller_dev *rcdev)
39 +{
40 +
41 +}
42 +
43 +#endif
44 +
45  #endif
46 --- a/include/linux/reset.h
47 +++ b/include/linux/reset.h
48 @@ -1,9 +1,13 @@
49  #ifndef _LINUX_RESET_H_
50  #define _LINUX_RESET_H_
51  
52 +#include <linux/err.h>
53 +
54  struct device;
55  struct reset_control;
56  
57 +#if defined(CONFIG_RESET_CONTROLLER)
58 +
59  int reset_control_reset(struct reset_control *rstc);
60  int reset_control_assert(struct reset_control *rstc);
61  int reset_control_deassert(struct reset_control *rstc);
62 @@ -14,4 +18,43 @@ struct reset_control *devm_reset_control
63  
64  int device_reset(struct device *dev);
65  
66 +#else /* CONFIG_RESET_CONTROLLER */
67 +
68 +static inline int reset_control_reset(struct reset_control *rstc)
69 +{
70 +       return -ENOSYS;
71 +}
72 +
73 +static inline int reset_control_assert(struct reset_control *rstc)
74 +{
75 +       return -ENOSYS;
76 +}
77 +
78 +static inline int reset_control_deassert(struct reset_control *rstc)
79 +{
80 +       return -ENOSYS;
81 +}
82 +
83 +static inline struct reset_control *reset_control_get(struct device *dev, const char *id)
84 +{
85 +       return ERR_PTR(-ENOSYS);
86 +}
87 +
88 +static inline void reset_control_put(struct reset_control *rstc)
89 +{
90 +
91 +}
92 +
93 +static inline struct reset_control *devm_reset_control_get(struct device *dev, const char *id)
94 +{
95 +       return ERR_PTR(-ENOSYS);
96 +}
97 +
98 +static inline int device_reset(struct device *dev)
99 +{
100 +       return -ENOSYS;
101 +}
102 +
103 +#endif
104 +
105  #endif