* [PATCH] gpio: xtensa: fix build when XCHAL_HAVE_CP is 0
@ 2014-01-23 6:50 Baruch Siach
2014-01-23 8:46 ` Linus Walleij
0 siblings, 1 reply; 3+ messages in thread
From: Baruch Siach @ 2014-01-23 6:50 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-xtensa, Baruch Siach
In xtensa coprocessors may exist without coprocessor context, i.e. they cannot
be disabled/enabled. In this case the RSR_CPENABLE/WSR_CPENABLE are undefined,
thus breaking the build. Fix the build by adding dummy versions of
enable_cp/disable_cp in this case.
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
drivers/gpio/gpio-xtensa.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/gpio/gpio-xtensa.c b/drivers/gpio/gpio-xtensa.c
index 1d136eceda62..7081304d6797 100644
--- a/drivers/gpio/gpio-xtensa.c
+++ b/drivers/gpio/gpio-xtensa.c
@@ -40,6 +40,8 @@
#error GPIO32 option is not enabled for your xtensa core variant
#endif
+#if XCHAL_HAVE_CP
+
static inline unsigned long enable_cp(unsigned long *cpenable)
{
unsigned long flags;
@@ -57,6 +59,20 @@ static inline void disable_cp(unsigned long flags, unsigned long cpenable)
local_irq_restore(flags);
}
+#else
+
+static inline unsigned long enable_cp(unsigned long *cpenable)
+{
+ *cpenable = 0; /* avoid uninitialized value warning */
+ return 0;
+}
+
+static inline void disable_cp(unsigned long flags, unsigned long cpenable)
+{
+}
+
+#endif /* XCHAL_HAVE_CP */
+
static int xtensa_impwire_get_direction(struct gpio_chip *gc, unsigned offset)
{
return 1; /* input only */
--
1.8.5.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: xtensa: fix build when XCHAL_HAVE_CP is 0
2014-01-23 6:50 [PATCH] gpio: xtensa: fix build when XCHAL_HAVE_CP is 0 Baruch Siach
@ 2014-01-23 8:46 ` Linus Walleij
2014-01-23 8:59 ` Baruch Siach
0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2014-01-23 8:46 UTC (permalink / raw)
To: Baruch Siach; +Cc: linux-gpio@vger.kernel.org, linux-xtensa
On Thu, Jan 23, 2014 at 7:50 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> In xtensa coprocessors may exist without coprocessor context, i.e. they cannot
> be disabled/enabled. In this case the RSR_CPENABLE/WSR_CPENABLE are undefined,
> thus breaking the build. Fix the build by adding dummy versions of
> enable_cp/disable_cp in this case.
>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Patch applied for fixes, but I really don't like this compile-time
thing. It'd be better if your Xtensa code would adjust to different
hardware at runtime rather than compile time. This is the overall
kernel design pattern these days AFICT.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio: xtensa: fix build when XCHAL_HAVE_CP is 0
2014-01-23 8:46 ` Linus Walleij
@ 2014-01-23 8:59 ` Baruch Siach
0 siblings, 0 replies; 3+ messages in thread
From: Baruch Siach @ 2014-01-23 8:59 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio@vger.kernel.org, linux-xtensa
Hi Linus,
On Thu, Jan 23, 2014 at 09:46:42AM +0100, Linus Walleij wrote:
> On Thu, Jan 23, 2014 at 7:50 AM, Baruch Siach <baruch@tkos.co.il> wrote:
> > In xtensa coprocessors may exist without coprocessor context, i.e. they
> > cannot
> > be disabled/enabled. In this case the RSR_CPENABLE/WSR_CPENABLE are undefined,
> > thus breaking the build. Fix the build by adding dummy versions of
> > enable_cp/disable_cp in this case.
> >
> > Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> > Signed-off-by: Baruch Siach <baruch@tkos.co.il>
>
> Patch applied for fixes, but I really don't like this compile-time
> thing. It'd be better if your Xtensa code would adjust to different
> hardware at runtime rather than compile time. This is the overall
> kernel design pattern these days AFICT.
We are talking about Xtensa here, not ARM. Different Xtensa variants are
binary incompatible from each other is some very fundamental ways. In most
cases you even need a different toolchain for each variant. Given that, I'm
not sure that runtime hardware check is worth it, or even possible is some
cases.
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-23 9:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23 6:50 [PATCH] gpio: xtensa: fix build when XCHAL_HAVE_CP is 0 Baruch Siach
2014-01-23 8:46 ` Linus Walleij
2014-01-23 8:59 ` Baruch Siach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).