* [PATCH] reset: Add non CONFIG_RESET_CONTROLLER routines
@ 2013-10-10 9:14 Ivan T. Ivanov
2013-10-10 9:51 ` Philipp Zabel
0 siblings, 1 reply; 3+ messages in thread
From: Ivan T. Ivanov @ 2013-10-10 9:14 UTC (permalink / raw)
To: p.zabel
Cc: linux-kernel, Ivan T. Ivanov, Pavel Machek, Stephen Warren,
Shawn Guo, Marek Vasut
From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
Make sure client drivers will still build on systems
without reset control support.
Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Stephen Warren <swarren@nvidia.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Marek Vasut <marex@denx.de>
---
include/linux/reset.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 6082247..0df3e30 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -4,6 +4,8 @@
struct device;
struct reset_control;
+#if defined(CONFIG_RESET_CONTROLLER)
+
int reset_control_reset(struct reset_control *rstc);
int reset_control_assert(struct reset_control *rstc);
int reset_control_deassert(struct reset_control *rstc);
@@ -14,4 +16,46 @@ struct reset_control *devm_reset_control_get(struct device *dev, const char *id)
int device_reset(struct device *dev);
+#else /* !CONFIG_RESET_CONTROLLER */
+
+/*
+ * Make sure client drivers will still build on systems without
+ * reset control support.
+ */
+static inline int reset_control_reset(struct reset_control *rstc)
+{
+ return 0;
+}
+
+static inline int reset_control_assert(struct reset_control *rstc)
+{
+ return 0;
+}
+
+static inline int reset_control_deassert(struct reset_control *rstc)
+{
+ return 0;
+}
+
+static inline struct reset_control *
+reset_control_get(struct device *dev, const char *id)
+{
+ return 0;
+}
+
+static inline void reset_control_put(struct reset_control *rstc){}
+
+static inline struct reset_control *
+devm_reset_control_get(struct device *dev, const char *id)
+{
+ return NULL;
+}
+
+static inline int device_reset(struct device *dev)
+{
+ return 0;
+}
+
+#endif
+
#endif
--
1.7.9.5
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] reset: Add non CONFIG_RESET_CONTROLLER routines
2013-10-10 9:14 [PATCH] reset: Add non CONFIG_RESET_CONTROLLER routines Ivan T. Ivanov
@ 2013-10-10 9:51 ` Philipp Zabel
2013-10-10 11:45 ` Ivan T. Ivanov
0 siblings, 1 reply; 3+ messages in thread
From: Philipp Zabel @ 2013-10-10 9:51 UTC (permalink / raw)
To: Ivan T. Ivanov
Cc: linux-kernel, Pavel Machek, Stephen Warren, Shawn Guo, Marek Vasut
Hi Ivan,
Am Donnerstag, den 10.10.2013, 12:14 +0300 schrieb Ivan T. Ivanov:
> From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
>
> Make sure client drivers will still build on systems
> without reset control support.
the stubs should at least return errors, but then this turns a compile
time error into a runtime error for devices that don't work without
being properly reset.
Please also refer to this thread:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-June/174758.html
regards
Philipp
> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Stephen Warren <swarren@nvidia.com>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Marek Vasut <marex@denx.de>
> ---
> include/linux/reset.h | 44 ++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/include/linux/reset.h b/include/linux/reset.h
> index 6082247..0df3e30 100644
> --- a/include/linux/reset.h
> +++ b/include/linux/reset.h
> @@ -4,6 +4,8 @@
> struct device;
> struct reset_control;
>
> +#if defined(CONFIG_RESET_CONTROLLER)
> +
> int reset_control_reset(struct reset_control *rstc);
> int reset_control_assert(struct reset_control *rstc);
> int reset_control_deassert(struct reset_control *rstc);
> @@ -14,4 +16,46 @@ struct reset_control *devm_reset_control_get(struct device *dev, const char *id)
>
> int device_reset(struct device *dev);
>
> +#else /* !CONFIG_RESET_CONTROLLER */
> +
> +/*
> + * Make sure client drivers will still build on systems without
> + * reset control support.
> + */
> +static inline int reset_control_reset(struct reset_control *rstc)
> +{
> + return 0;
> +}
> +
> +static inline int reset_control_assert(struct reset_control *rstc)
> +{
> + return 0;
> +}
> +
> +static inline int reset_control_deassert(struct reset_control *rstc)
> +{
> + return 0;
> +}
> +
> +static inline struct reset_control *
> +reset_control_get(struct device *dev, const char *id)
> +{
> + return 0;
> +}
> +
> +static inline void reset_control_put(struct reset_control *rstc){}
> +
> +static inline struct reset_control *
> +devm_reset_control_get(struct device *dev, const char *id)
> +{
> + return NULL;
> +}
> +
> +static inline int device_reset(struct device *dev)
> +{
> + return 0;
> +}
> +
> +#endif
> +
> #endif
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] reset: Add non CONFIG_RESET_CONTROLLER routines
2013-10-10 9:51 ` Philipp Zabel
@ 2013-10-10 11:45 ` Ivan T. Ivanov
0 siblings, 0 replies; 3+ messages in thread
From: Ivan T. Ivanov @ 2013-10-10 11:45 UTC (permalink / raw)
To: Philipp Zabel
Cc: linux-kernel, Pavel Machek, Stephen Warren, Shawn Guo, Marek Vasut
Hi,
On Thu, 2013-10-10 at 11:51 +0200, Philipp Zabel wrote:
> Hi Ivan,
>
> Am Donnerstag, den 10.10.2013, 12:14 +0300 schrieb Ivan T. Ivanov:
> > From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
> >
> > Make sure client drivers will still build on systems
> > without reset control support.
>
> the stubs should at least return errors, but then this turns a compile
> time error into a runtime error for devices that don't work without
> being properly reset.
>
> Please also refer to this thread:
> http://lists.infradead.org/pipermail/linux-arm-kernel/2013-June/174758.html
>
I have missed this one. Is there conclusion on the topic? I have
followed approach taken by clock and regulator consumer API.
Regards,
Ivan
> regards
> Philipp
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-10 11:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-10 9:14 [PATCH] reset: Add non CONFIG_RESET_CONTROLLER routines Ivan T. Ivanov
2013-10-10 9:51 ` Philipp Zabel
2013-10-10 11:45 ` Ivan T. Ivanov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®