mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Magnus Damm" <magnus.damm@gmail.com>
To: "Andrew Morton" <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH] clocksource: pass clocksource to read() callback
Date: Fri, 19 Dec 2008 19:02:46 +0900	[thread overview]
Message-ID: <aec7e5c30812190202g44020d6ao910f93264e7ccaaa@mail.gmail.com> (raw)
In-Reply-To: <20081219001121.bf985802.akpm@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 1007 bytes --]

On Fri, Dec 19, 2008 at 5:11 PM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> It still blows up though.  Any call to get_cycles() goes:
>
> crypto/tcrypt.c: In function `test_cipher_cycles':
> crypto/tcrypt.c:107: error: too few arguments to function
> crypto/tcrypt.c:112: error: too few arguments to function
> crypto/tcrypt.c: In function `test_hash_cycles_digest':
> crypto/tcrypt.c:305: error: too few arguments to function
> crypto/tcrypt.c:311: error: too few arguments to function
> crypto/tcrypt.c: In function `test_hash_cycles':
> crypto/tcrypt.c:361: error: too few arguments to function
> crypto/tcrypt.c:375: error: too few arguments to function
>
> because this:
>
> arch/sparc/include/asm/timex_64.h:#define get_cycles()  tick_ops->get_tick()
>
> needs help.

Thanks for your help. I've now managed to build a sparc64 compiler and
make a fix. If it's ok with Dave then I think reverting the old
sparc64 hunks and go with a simple wrapper is the best, see the
attached patch.

/ magnus

[-- Attachment #2: clocksource-pass-clocksource-to-read-callback-sparc64-fix-replacement.patch --]
[-- Type: application/octet-stream, Size: 3022 bytes --]

From: Magnus Damm <damm@igel.co.jp>

This unbreaks clocksource read(cs) on sparc64. The old sparc64 code gets
reverted and a simple wrapper function is used instead.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 arch/sparc/include/asm/timer_64.h |    3 +--
 arch/sparc/kernel/time_64.c       |   21 +++++++++++++--------
 2 files changed, 14 insertions(+), 10 deletions(-)

--- 0002/arch/sparc/include/asm/timer_64.h
+++ work/arch/sparc/include/asm/timer_64.h	2008-12-19 18:54:58.000000000 +0900
@@ -8,10 +8,9 @@
 
 #include <linux/types.h>
 #include <linux/init.h>
-#include <linux/clocksource.h>
 
 struct sparc64_tick_ops {
-	unsigned long (*get_tick)(struct clocksource *cs);
+	unsigned long (*get_tick)(void);
 	int (*add_compare)(unsigned long);
 	unsigned long softint_mask;
 	void (*disable_irq)(void);
--- 0002/arch/sparc/kernel/time_64.c
+++ work/arch/sparc/kernel/time_64.c	2008-12-19 18:54:58.000000000 +0900
@@ -106,7 +106,7 @@ static void tick_init_tick(void)
 	tick_disable_irq();
 }
 
-static unsigned long tick_get_tick(struct clocksource *cs)
+static unsigned long tick_get_tick(void)
 {
 	unsigned long ret;
 
@@ -208,7 +208,7 @@ static void stick_init_tick(void)
 	stick_disable_irq();
 }
 
-static unsigned long stick_get_tick(struct clocksource *cs)
+static unsigned long stick_get_tick(void)
 {
 	unsigned long ret;
 
@@ -352,7 +352,7 @@ static void hbtick_init_tick(void)
 	hbtick_disable_irq();
 }
 
-static unsigned long hbtick_get_tick(struct clocksource *cs)
+static unsigned long hbtick_get_tick(void)
 {
 	return __hbird_read_stick() & ~TICK_PRIV_BIT;
 }
@@ -799,9 +799,9 @@ void __delay(unsigned long loops)
 {
 	unsigned long bclock, now;
 
-	bclock = tick_ops->get_tick(&clocksource_tick);
+	bclock = tick_ops->get_tick();
 	do {
-		now = tick_ops->get_tick(&clocksource_tick);
+		now = tick_ops->get_tick();
 	} while ((now-bclock) < loops);
 }
 EXPORT_SYMBOL(__delay);
@@ -812,6 +812,11 @@ void udelay(unsigned long usecs)
 }
 EXPORT_SYMBOL(udelay);
 
+static cycle_t clocksource_tick_read(struct clocksource *cs)
+{
+	return tick_ops->get_tick();
+}
+
 void __init time_init(void)
 {
 	unsigned long freq = sparc64_init_timers();
@@ -825,7 +830,7 @@ void __init time_init(void)
 	clocksource_tick.mult =
 		clocksource_hz2mult(freq,
 				    clocksource_tick.shift);
-	clocksource_tick.read = tick_ops->get_tick;
+	clocksource_tick.read = clocksource_tick_read;
 
 	printk("clocksource: mult[%x] shift[%d]\n",
 	       clocksource_tick.mult, clocksource_tick.shift);
@@ -849,7 +854,7 @@ void __init time_init(void)
 
 unsigned long long sched_clock(void)
 {
-	unsigned long ticks = tick_ops->get_tick(&clocksource_tick);
+	unsigned long ticks = tick_ops->get_tick();
 
 	return (ticks * timer_ticks_per_nsec_quotient)
 		>> SPARC64_NSEC_PER_CYC_SHIFT;
@@ -857,6 +862,6 @@ unsigned long long sched_clock(void)
 
 int __devinit read_current_timer(unsigned long *timer_val)
 {
-	*timer_val = tick_ops->get_tick(&clocksource_tick);
+	*timer_val = tick_ops->get_tick();
 	return 0;
 }

      reply	other threads:[~2008-12-19 10:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-11 11:48 Magnus Damm
2008-12-11 17:01 ` John Stultz
2008-12-12  9:57   ` Magnus Damm
2008-12-18  1:56 ` Andrew Morton
2008-12-19  7:30   ` Magnus Damm
2008-12-19  7:47     ` Andrew Morton
2008-12-19  8:11       ` Andrew Morton
2008-12-19 10:02         ` Magnus Damm [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aec7e5c30812190202g44020d6ao910f93264e7ccaaa@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®