Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH][1/2][MIPS] remove irqsave/irqrestore from spinlock for GT641xx clockevent
@ 2007-10-23  9:19 Yoichi Yuasa
  2007-10-23  9:22 ` [PATCH][2/2][MIPS] move clockevent_set_clock() before clockevent_delta2ns() Yoichi Yuasa
  2007-10-23 10:42 ` [PATCH][1/2][MIPS] remove irqsave/irqrestore from spinlock for GT641xx clockevent Ralf Baechle
  0 siblings, 2 replies; 4+ messages in thread
From: Yoichi Yuasa @ 2007-10-23  9:19 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: yoichi_yuasa, linux-mips


set_next_event() and set_mode() are always called with interrupt disabled.
irqsave and irqrestore are not necessary for spinlock.
Pointed out by Atsushi Nemoto.

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/kernel/cevt-gt641xx.c mips/arch/mips/kernel/cevt-gt641xx.c
--- mips-orig/arch/mips/kernel/cevt-gt641xx.c	2007-10-23 15:24:41.135068000 +0900
+++ mips/arch/mips/kernel/cevt-gt641xx.c	2007-10-23 16:15:57.040970000 +0900
@@ -49,10 +49,9 @@ int gt641xx_timer0_state(void)
 static int gt641xx_timer0_set_next_event(unsigned long delta,
 					 struct clock_event_device *evt)
 {
-	unsigned long flags;
 	u32 ctrl;
 
-	spin_lock_irqsave(&gt641xx_timer_lock, flags);
+	spin_lock(&gt641xx_timer_lock);
 
 	ctrl = GT_READ(GT_TC_CONTROL_OFS);
 	ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK);
@@ -61,7 +60,7 @@ static int gt641xx_timer0_set_next_event
 	GT_WRITE(GT_TC0_OFS, delta);
 	GT_WRITE(GT_TC_CONTROL_OFS, ctrl);
 
-	spin_unlock_irqrestore(&gt641xx_timer_lock, flags);
+	spin_unlock(&gt641xx_timer_lock);
 
 	return 0;
 }
@@ -69,10 +68,9 @@ static int gt641xx_timer0_set_next_event
 static void gt641xx_timer0_set_mode(enum clock_event_mode mode,
 				    struct clock_event_device *evt)
 {
-	unsigned long flags;
 	u32 ctrl;
 
-	spin_lock_irqsave(&gt641xx_timer_lock, flags);
+	spin_lock(&gt641xx_timer_lock);
 
 	ctrl = GT_READ(GT_TC_CONTROL_OFS);
 	ctrl &= ~(GT_TC_CONTROL_ENTC0_MSK | GT_TC_CONTROL_SELTC0_MSK);
@@ -90,7 +88,7 @@ static void gt641xx_timer0_set_mode(enum
 
 	GT_WRITE(GT_TC_CONTROL_OFS, ctrl);
 
-	spin_unlock_irqrestore(&gt641xx_timer_lock, flags);
+	spin_unlock(&gt641xx_timer_lock);
 }
 
 static void gt641xx_timer0_event_handler(struct clock_event_device *dev)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH][2/2][MIPS] move clockevent_set_clock() before clockevent_delta2ns()
  2007-10-23  9:19 [PATCH][1/2][MIPS] remove irqsave/irqrestore from spinlock for GT641xx clockevent Yoichi Yuasa
@ 2007-10-23  9:22 ` Yoichi Yuasa
  2007-10-23 10:42   ` Ralf Baechle
  2007-10-23 10:42 ` [PATCH][1/2][MIPS] remove irqsave/irqrestore from spinlock for GT641xx clockevent Ralf Baechle
  1 sibling, 1 reply; 4+ messages in thread
From: Yoichi Yuasa @ 2007-10-23  9:22 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: yoichi_yuasa, linux-mips


clockevent_delta2ns() use shift and mult value.
It should call clockevent_set_clock() first.
Pointed out by Atsushi Nemoto.

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/kernel/cevt-gt641xx.c mips/arch/mips/kernel/cevt-gt641xx.c
--- mips-orig/arch/mips/kernel/cevt-gt641xx.c	2007-10-23 16:29:19.831141250 +0900
+++ mips/arch/mips/kernel/cevt-gt641xx.c	2007-10-23 16:29:09.702508250 +0900
@@ -131,9 +131,9 @@ static int __init gt641xx_timer0_clockev
 
 	cd = &gt641xx_timer0_clockevent;
 	cd->rating = 200 + gt641xx_base_clock / 10000000;
+	clockevent_set_clock(cd, gt641xx_base_clock);
 	cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
 	cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
-	clockevent_set_clock(cd, gt641xx_base_clock);
 
 	clockevents_register_device(&gt641xx_timer0_clockevent);
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][1/2][MIPS] remove irqsave/irqrestore from spinlock for GT641xx clockevent
  2007-10-23  9:19 [PATCH][1/2][MIPS] remove irqsave/irqrestore from spinlock for GT641xx clockevent Yoichi Yuasa
  2007-10-23  9:22 ` [PATCH][2/2][MIPS] move clockevent_set_clock() before clockevent_delta2ns() Yoichi Yuasa
@ 2007-10-23 10:42 ` Ralf Baechle
  1 sibling, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2007-10-23 10:42 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: linux-mips

On Tue, Oct 23, 2007 at 06:19:13PM +0900, Yoichi Yuasa wrote:

> set_next_event() and set_mode() are always called with interrupt disabled.
> irqsave and irqrestore are not necessary for spinlock.
> Pointed out by Atsushi Nemoto.

Applied, thanks.

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][2/2][MIPS] move clockevent_set_clock() before clockevent_delta2ns()
  2007-10-23  9:22 ` [PATCH][2/2][MIPS] move clockevent_set_clock() before clockevent_delta2ns() Yoichi Yuasa
@ 2007-10-23 10:42   ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2007-10-23 10:42 UTC (permalink / raw)
  To: Yoichi Yuasa; +Cc: linux-mips

On Tue, Oct 23, 2007 at 06:22:50PM +0900, Yoichi Yuasa wrote:

Applied, thanks.

  Ralf

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-23 10:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-23  9:19 [PATCH][1/2][MIPS] remove irqsave/irqrestore from spinlock for GT641xx clockevent Yoichi Yuasa
2007-10-23  9:22 ` [PATCH][2/2][MIPS] move clockevent_set_clock() before clockevent_delta2ns() Yoichi Yuasa
2007-10-23 10:42   ` Ralf Baechle
2007-10-23 10:42 ` [PATCH][1/2][MIPS] remove irqsave/irqrestore from spinlock for GT641xx clockevent Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox