All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] remove mips_rtc_lock
@ 2005-11-02 16:02 Atsushi Nemoto
  2005-11-03 11:05 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2005-11-02 16:02 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

The mips_rtc_lock is no longer needed because RTC operations should be
protected already by other mechanism. (rtc_lock, local_irq_save, etc.)

Also, locking whole rtc_get_time/rtc_set_time should be avoided while
some RTC routines might take very long time (a few seconds).

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h
--- a/include/asm-mips/rtc.h
+++ b/include/asm-mips/rtc.h
@@ -14,7 +14,6 @@
 
 #ifdef __KERNEL__
 
-#include <linux/spinlock.h>
 #include <linux/rtc.h>
 #include <asm/time.h>
 
@@ -29,17 +28,13 @@
 #define RTC_24H 0x02            /* 24 hour mode - else hours bit 7 means pm */
 #define RTC_DST_EN 0x01         /* auto switch DST - works f. USA only */
 
-static DEFINE_SPINLOCK(mips_rtc_lock);
-
 static inline unsigned int get_rtc_time(struct rtc_time *time)
 {
 	unsigned long nowtime;
 
-	spin_lock(&mips_rtc_lock);
 	nowtime = rtc_get_time();
 	to_tm(nowtime, time);
 	time->tm_year -= 1900;
-	spin_unlock(&mips_rtc_lock);
 
 	return RTC_24H;
 }
@@ -49,12 +44,10 @@ static inline int set_rtc_time(struct rt
 	unsigned long nowtime;
 	int ret;
 
-	spin_lock(&mips_rtc_lock);
 	nowtime = mktime(time->tm_year+1900, time->tm_mon+1,
 			time->tm_mday, time->tm_hour, time->tm_min,
 			time->tm_sec);
 	ret = rtc_set_time(nowtime);
-	spin_unlock(&mips_rtc_lock);
 
 	return ret;
 }

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

* Re: [PATCH] remove mips_rtc_lock
  2005-11-02 16:02 [PATCH] remove mips_rtc_lock Atsushi Nemoto
@ 2005-11-03 11:05 ` Ralf Baechle
  2005-11-03 14:12   ` Atsushi Nemoto
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2005-11-03 11:05 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Thu, Nov 03, 2005 at 01:02:40AM +0900, Atsushi Nemoto wrote:

> The mips_rtc_lock is no longer needed because RTC operations should be
> protected already by other mechanism. (rtc_lock, local_irq_save, etc.)
> 
> Also, locking whole rtc_get_time/rtc_set_time should be avoided while
> some RTC routines might take very long time (a few seconds).
> 
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

Applied.  Thanks alot for the janitor work.

And also the function names are clear as mud:

[...]
static inline unsigned int get_rtc_time(struct rtc_time *time)
{
        unsigned long nowtime;

        nowtime = rtc_get_time();
[...]
static inline int set_rtc_time(struct rtc_time *time)
{
        unsigned long nowtime;
        int ret;

        nowtime = mktime(time->tm_year+1900, time->tm_mon+1,
                        time->tm_mday, time->tm_hour, time->tm_min,
                        time->tm_sec);
        ret = rtc_set_time(nowtime);
[...]

The difference between and get_rtc_time and rtc_get_time is less than
obvious.  Same for set_rtc_time and rtc_set_time ...

   Ralf

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

* Re: [PATCH] remove mips_rtc_lock
  2005-11-03 11:05 ` Ralf Baechle
@ 2005-11-03 14:12   ` Atsushi Nemoto
  2005-11-03 14:26     ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Atsushi Nemoto @ 2005-11-03 14:12 UTC (permalink / raw)
  To: ralf; +Cc: linux-mips

>>>>> On Thu, 3 Nov 2005 11:05:53 +0000, Ralf Baechle <ralf@linux-mips.org> said:

ralf> The difference between and get_rtc_time and rtc_get_time is less
ralf> than obvious.  Same for set_rtc_time and rtc_set_time ...

Sure.  Also I suppose majority of RTC prefer struct rtc_time than
unsigned long.  Is it time for redesign the mips RTC interface? ;-)

---
Atsushi Nemoto

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

* Re: [PATCH] remove mips_rtc_lock
  2005-11-03 14:12   ` Atsushi Nemoto
@ 2005-11-03 14:26     ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2005-11-03 14:26 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: linux-mips

On Thu, Nov 03, 2005 at 11:12:50PM +0900, Atsushi Nemoto wrote:

> >>>>> On Thu, 3 Nov 2005 11:05:53 +0000, Ralf Baechle <ralf@linux-mips.org> said:
> 
> ralf> The difference between and get_rtc_time and rtc_get_time is less
> ralf> than obvious.  Same for set_rtc_time and rtc_set_time ...
> 
> Sure.  Also I suppose majority of RTC prefer struct rtc_time than
> unsigned long.  Is it time for redesign the mips RTC interface? ;-)

More than that, the whole MIPS time code while functional is such a
beauty it could make a grown man cry ...

  Ralf

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

end of thread, other threads:[~2005-11-03 14:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-02 16:02 [PATCH] remove mips_rtc_lock Atsushi Nemoto
2005-11-03 11:05 ` Ralf Baechle
2005-11-03 14:12   ` Atsushi Nemoto
2005-11-03 14:26     ` Ralf Baechle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.