diff mbox

[12/12] time/jiffies: bring back unconditional LATCH definition

Message ID 1348868177-21205-13-git-send-email-arnd@arndb.de (mailing list archive)
State New, archived
Headers show

Commit Message

Arnd Bergmann Sept. 28, 2012, 9:36 p.m. UTC
Patch a7ea3bbf5d "time/jiffies: Allow CLOCK_TICK_RATE to be undefined"
breaks the compilation of targets that rely on the LATCH definition,
because of recursive header file inclusion not defining CLOCK_TICK_RATE
before it is checked here.

This fixes the problem by moving LATCH back to where it was, but it
seems that there are still cases where SHIFTED_HZ is defined incorrectly
because of the same problem. Need to investigate further.

Without this patch, building h7201_defconfig results in:

arch/arm/mach-h720x/common.c: In function 'h720x_gettimeoffset':
arch/arm/mach-h720x/common.c:50:73: error: 'LATCH' undeclared (first use in this function)
arch/arm/mach-h720x/common.c:50:73: note: each undeclared identifier is reported only once for each function it appears in
arch/arm/mach-h720x/common.c:51:1: warning: control reaches end of non-void function [-Wreturn-type]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Ingo Molnar <mingo@kernel.org>
---
 include/linux/jiffies.h |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

John Stultz Sept. 28, 2012, 9:55 p.m. UTC | #1
On 09/28/2012 02:36 PM, Arnd Bergmann wrote:
> Patch a7ea3bbf5d "time/jiffies: Allow CLOCK_TICK_RATE to be undefined"
> breaks the compilation of targets that rely on the LATCH definition,
> because of recursive header file inclusion not defining CLOCK_TICK_RATE
> before it is checked here.
>
> This fixes the problem by moving LATCH back to where it was, but it
> seems that there are still cases where SHIFTED_HZ is defined incorrectly
> because of the same problem. Need to investigate further.
>
> Without this patch, building h7201_defconfig results in:
>
> arch/arm/mach-h720x/common.c: In function 'h720x_gettimeoffset':
> arch/arm/mach-h720x/common.c:50:73: error: 'LATCH' undeclared (first use in this function)
> arch/arm/mach-h720x/common.c:50:73: note: each undeclared identifier is reported only once for each function it appears in
> arch/arm/mach-h720x/common.c:51:1: warning: control reaches end of non-void function [-Wreturn-type]

Hrrm. Ok. I had a patch for 3.7 that tried to get rid of the generic 
CLOCK_TICK_RATE derived users, but that may not fly if there's still 
LATCH users around.  I guess I'll tweak it so we keep LATCH around, 
probably by mering your change into my tree.

I suspect the long term fix is to push the LATCH definition up into arch 
specific code that is using it, so it can be made dynamic instead of a 
compile time constant. Otherwise it might be hard to get a unified 
zImage working.  But for now I guess your current fix is good short-term.

thanks
-john
diff mbox

Patch

diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index 05e3c2c7..d229ada 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -51,9 +51,10 @@ 
 #define SH_DIV(NOM,DEN,LSH) (   (((NOM) / (DEN)) << (LSH))              \
                              + ((((NOM) % (DEN)) << (LSH)) + (DEN) / 2) / (DEN))
 
-#ifdef CLOCK_TICK_RATE
 /* LATCH is used in the interval timer and ftape setup. */
-# define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ)	/* For divider */
+#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ)	/* For divider */
+
+#ifdef CLOCK_TICK_RATE
 
 /*
  * HZ is the requested value. However the CLOCK_TICK_RATE may not allow