Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=644923d4a5f117d437aefd47688d1141cc8361ed
Commit:     644923d4a5f117d437aefd47688d1141cc8361ed
Parent:     d62c6f093a1ef8fa5f8951e8da93c8ddd3ce193a
Author:     Tony Breeds <[EMAIL PROTECTED]>
AuthorDate: Wed Mar 28 19:10:12 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Thu Apr 26 01:54:20 2007 -0700

    [SPARC64]: Small cleanups time.c
    
    - Removes days_in_mo[], as it's almost identical to month_days[]
    - Use the leapyear() macro
    - Line length wrapping.
    
    Signed-off-by: Tony Breeds <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 arch/sparc64/kernel/time.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 0eb8465..3cb761e 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -1177,10 +1177,6 @@ static int set_rtc_mmss(unsigned long nowtime)
 #define RTC_IS_OPEN            0x01    /* means /dev/rtc is in use     */
 static unsigned char mini_rtc_status;  /* bitmapped status byte.       */
 
-/* months start at 0 now */
-static unsigned char days_in_mo[] =
-{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
 #define FEBRUARY       2
 #define        STARTOFTIME     1970
 #define SECDAY         86400L
@@ -1329,8 +1325,7 @@ static int mini_rtc_ioctl(struct inode *inode, struct 
file *file,
 
        case RTC_SET_TIME:      /* Set the RTC */
            {
-               int year;
-               unsigned char leap_yr;
+               int year, days;
 
                if (!capable(CAP_SYS_TIME))
                        return -EACCES;
@@ -1339,14 +1334,14 @@ static int mini_rtc_ioctl(struct inode *inode, struct 
file *file,
                        return -EFAULT;
 
                year = wtime.tm_year + 1900;
-               leap_yr = ((!(year % 4) && (year % 100)) ||
-                          !(year % 400));
+               days = month_days[wtime.tm_mon] +
+                      ((wtime.tm_mon == 1) && leapyear(year));
 
-               if ((wtime.tm_mon < 0 || wtime.tm_mon > 11) || (wtime.tm_mday < 
1))
+               if ((wtime.tm_mon < 0 || wtime.tm_mon > 11) ||
+                   (wtime.tm_mday < 1))
                        return -EINVAL;
 
-               if (wtime.tm_mday < 0 || wtime.tm_mday >
-                   (days_in_mo[wtime.tm_mon] + ((wtime.tm_mon == 1) && 
leap_yr)))
+               if (wtime.tm_mday < 0 || wtime.tm_mday > days)
                        return -EINVAL;
 
                if (wtime.tm_hour < 0 || wtime.tm_hour >= 24 ||
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to