1. 03 9月, 2008 1 次提交
    • J
      rtc_time_to_tm: fix signed/unsigned arithmetic · 73442daf
      Jan Altenberg 提交于
      commit 945185a6 ("rtc: rtc_time_to_tm: use
      unsigned arithmetic") changed the some types in rtc_time_to_tm() to
      unsigned:
      
       void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
       {
      -       register int days, month, year;
      +       unsigned int days, month, year;
      
      This doesn't work for all cases, because days is checked for < 0 later
      on:
      
      if (days < 0) {
      	year -= 1;
      	days += 365 + LEAP_YEAR(year);
      }
      
      I think the correct fix would be to keep days signed and do an appropriate
      cast later on.
      Signed-off-by: NJan Altenberg <jan.altenberg@linutronix.de>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: Alessandro Zummo <a.zummo@towertech.it>
      Cc: David Brownell <david-b@pacbell.net>
      Cc: Dmitri Vorobiev <dmitri.vorobiev@gmail.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      73442daf
  2. 24 8月, 2008 1 次提交
  3. 21 8月, 2008 6 次提交
  4. 13 8月, 2008 2 次提交
  5. 07 8月, 2008 2 次提交
  6. 06 8月, 2008 8 次提交
  7. 31 7月, 2008 2 次提交
  8. 25 7月, 2008 14 次提交
  9. 22 7月, 2008 1 次提交
  10. 13 7月, 2008 2 次提交
  11. 05 7月, 2008 1 次提交
    • M
      rtc-x1205: Fix alarm set · 471d47e3
      Michael Hamel 提交于
      I have discovered that the current version of rtc-x1205.c does not work
      correctly when asked to set the alarm time by the RTC_WKALM_SET ioctl()
      call.  This happens because the alarm registers do not behave like the
      current-time registers.  They are non-volatile.  Two things go wrong:
      
      - the X1205 requires a 10 msec delay after any attempt to write to the
        non-volatile registers.  The x1205_set_datetime() routine does the write
        as 8 single-byte writes without any delay.  Only the first write
        succeeds.  The second is NAKed because the chip is busy.
      
      - the X1205 resets the RWEL bit after any write to the non-volatile
        registers.  This would lock out any further writes after the first even
        with a 10msec delay.
      
      I fix this by doing a single 8-byte write and then waiting 10msec for the
      chip to be ready.  A side effect of this change is that it will speed up
      x1205_rtc_set_time() which uses the same code.
      
      I have also implemented the 'enable' bit in the rtc_wkalm structure, which
      the existing driver does not attempt to do.  I have modified both
      x1205_rtc_set_alarm() to set the AL0E bit, and x1205_rtc_read_alarm() to
      return it.
      
      I have tested this patch on a LinkSys NSLU2 under OpenWRT, but on no other
      hardware.  On the NSLU2 the X1205 correctly asserts its IRQ pin when the
      alarm time matches the current time.
      
      [akpm@linux-foundation.org: clean up over-parenthesisation]
      Signed-off-by: NMichael Hamel <mhamel@adi.co.nz>
      Signed-off-by: NAlessandro Zummo <a.zummo@towertech.it>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      471d47e3