04 Jan, 2012

2 commits

  • This reverts commit 93b2ec0128c431148b216b8f7337c1a52131ef03.

    The call to "schedule_work()" in rtc_initialize_alarm() happens too
    early, and can cause oopses at bootup

    Neil Brown explains why we do it:

    "If you set an alarm in the future, then shutdown and boot again after
    that time, then you will end up with a timer_queue node which is in
    the past.

    When this happens the queue gets stuck. That entry-in-the-past won't
    get removed until and interrupt happens and an interrupt won't happen
    because the RTC only triggers an interrupt when the alarm is "now".

    So you'll find that e.g. "hwclock" will always tell you that
    'select' timed out.

    So we force the interrupt work to happen at the start just in case."

    and has a patch that convert it to do things in-process rather than with
    the worker thread, but right now it's too late to play around with this,
    so we just revert the patch that caused problems for now.

    Reported-by: Sander Eikelenboom
    Requested-by: Konrad Rzeszutek Wilk
    Requested-by: John Stultz
    Cc: Neil Brown
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     
  • This reverts commit c0afabd3d553c521e003779c127143ffde55a16f.

    It causes failures on Toshiba laptops - instead of disabling the alarm,
    it actually seems to enable it on the affected laptops, resulting in
    (for example) the laptop powering on automatically five minutes after
    shutdown.

    There's a patch for it that appears to work for at least some people,
    but it's too late to play around with this, so revert for now and try
    again in the next merge window.

    See for example

    http://bugs.debian.org/652869

    Reported-and-bisected-by: Andreas Friedrich (Toshiba Tecra)
    Reported-by: Antonio-M. Corbi Bellot (Toshiba Portege R500)
    Reported-by: Marco Santos (Toshiba Portege Z830)
    Reported-by: Christophe Vu-Brugier (Toshiba Portege R830)
    Cc: Jonathan Nieder
    Requested-by: John Stultz
    Cc: stable@kernel.org # for the versions that applied this
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

21 Dec, 2011

1 commit


14 Dec, 2011

2 commits

  • The m41t80 driver can read and set the alarm, but it doesn't
    seem to have a functional alarm irq.

    This causes failures when the generic core sees alarm functions,
    but then cannot use them properly for things like UIE mode.

    Disabling the alarm functions allows proper error reporting,
    and possible fallback to emulated modes. Once someone fixes
    the alarm irq functionality, this can be restored.

    CC: stable@kernel.org
    CC: Matt Turner
    CC: Nico Macrionitis
    CC: Atsushi Nemoto
    Reported-by: Matt Turner
    Reported-by: Nico Macrionitis
    Tested-by: Nico Macrionitis
    Signed-off-by: John Stultz

    John Stultz
     
  • If the alarm time programming in the rtc is ever in the past, it won't fire,
    and any other alarm will be queued after it so they won't fire either.

    So any time that the alarm might be in the past, we need to trigger
    the irq handler to ensure the old alarm is cleared and the timer queue
    is fully in the future.

    This can happen:
    - when we first initialise the alarm
    - when we set the time in the rtc.

    so follow both of these by scheduling the timer work function.

    CC: stable@kernel.org
    Signed-off-by: NeilBrown
    [Also catch set_mmss case -jstultz]
    Signed-off-by: John Stultz

    NeilBrown
     

09 Dec, 2011

1 commit


06 Dec, 2011

1 commit


23 Nov, 2011

2 commits

  • The current code checks if abs(delta_delta.tv_sec) is greater or
    equal to two before it discards the old delta value, but this can
    trigger at close to -1 seconds since -1.000000001 seconds is stored
    as tv_sec -2 and tv_nsec 999999999 in a normalized timespec.

    rtc_resume had an early return check if the rtc value had not changed
    since rtc_suspend. This effectivly stops time for the duration of the
    short sleep. Check if sleep_time is positive after all the adjustments
    have been applied instead since this allows the old_system adjustment
    in rtc_suspend to have an effect even for short sleep cycles.

    CC: stable@kernel.org
    Signed-off-by: Arve Hjønnevåg
    Signed-off-by: John Stultz

    Arve Hjønnevåg
     
  • Currently, the RTC code does not disable the alarm in the hardware.

    This means that after a sequence such as the one below (the files are in the
    RTC sysfs), the box will boot up after 2 minutes even though we've
    asked for the alarm to be turned off.

    # echo $((`cat since_epoch`)+120) > wakealarm
    # echo 0 > wakealarm
    # poweroff

    Fix this by disabling the alarm when there are no timers to run.

    Cc: stable@kernel.org
    Cc: John Stultz
    Signed-off-by: Rabin Vincent
    Signed-off-by: John Stultz

    Rabin Vincent
     

15 Nov, 2011

1 commit


12 Nov, 2011

1 commit

  • Real world year equals the value in vrtc YEAR register plus an offset.
    We used 1960 as the offset to make leap year consistent, but for a
    device's first use, its YEAR register is 0 and the system year will
    be parsed as 1960 which is not a valid UNIX time and will cause many
    applications to fail mysteriously. So we use 1972 instead to fix this
    issue.

    Updated patch which adds a sanity check suggested by Mathias

    This isn't a change in behaviour for systems, because 1972 is the one we
    actually use. It's the old version in upstream which is out of sync with
    all devices.

    Signed-off-by: Feng Tang
    Signed-off-by: Alan Cox
    Signed-off-by: Linus Torvalds

    Feng Tang
     

07 Nov, 2011

1 commit

  • * 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits)
    Revert "tracing: Include module.h in define_trace.h"
    irq: don't put module.h into irq.h for tracking irqgen modules.
    bluetooth: macroize two small inlines to avoid module.h
    ip_vs.h: fix implicit use of module_get/module_put from module.h
    nf_conntrack.h: fix up fallout from implicit moduleparam.h presence
    include: replace linux/module.h with "struct module" wherever possible
    include: convert various register fcns to macros to avoid include chaining
    crypto.h: remove unused crypto_tfm_alg_modname() inline
    uwb.h: fix implicit use of asm/page.h for PAGE_SIZE
    pm_runtime.h: explicitly requires notifier.h
    linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h
    miscdevice.h: fix up implicit use of lists and types
    stop_machine.h: fix implicit use of smp.h for smp_processor_id
    of: fix implicit use of errno.h in include/linux/of.h
    of_platform.h: delete needless include
    acpi: remove module.h include from platform/aclinux.h
    miscdevice.h: delete unnecessary inclusion of module.h
    device_cgroup.h: delete needless include
    net: sch_generic remove redundant use of
    net: inet_timewait_sock doesnt need
    ...

    Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in
    - drivers/media/dvb/frontends/dibx000_common.c
    - drivers/media/video/{mt9m111.c,ov6650.c}
    - drivers/mfd/ab3550-core.c
    - include/linux/dmaengine.h

    Linus Torvalds
     

03 Nov, 2011

4 commits

  • Says Andrew:

    "60 patches. That's good enough for -rc1 I guess. I have quite a lot
    of detritus to be rechecked, work through maintainers, etc.

    - most of the remains of MM
    - rtc
    - various misc
    - cgroups
    - memcg
    - cpusets
    - procfs
    - ipc
    - rapidio
    - sysctl
    - pps
    - w1
    - drivers/misc
    - aio"

    * akpm: (60 commits)
    memcg: replace ss->id_lock with a rwlock
    aio: allocate kiocbs in batches
    drivers/misc/vmw_balloon.c: fix typo in code comment
    drivers/misc/vmw_balloon.c: determine page allocation flag can_sleep outside loop
    w1: disable irqs in critical section
    drivers/w1/w1_int.c: multiple masters used same init_name
    drivers/power/ds2780_battery.c: fix deadlock upon insertion and removal
    drivers/power/ds2780_battery.c: add a nolock function to w1 interface
    drivers/power/ds2780_battery.c: create central point for calling w1 interface
    w1: ds2760 and ds2780, use ida for id and ida_simple_get() to get it
    pps gpio client: add missing dependency
    pps: new client driver using GPIO
    pps: default echo function
    include/linux/dma-mapping.h: add dma_zalloc_coherent()
    sysctl: make CONFIG_SYSCTL_SYSCALL default to n
    sysctl: add support for poll()
    RapidIO: documentation update
    drivers/net/rionet.c: fix ethernet address macros for LE platforms
    RapidIO: fix potential null deref in rio_setup_device()
    RapidIO: add mport driver for Tsi721 bridge
    ...

    Linus Torvalds
     
  • The driver is added using platform_driver_probe(), so the callbacks can be
    discarded more aggessively.

    Signed-off-by: Uwe Kleine-König
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     
  • Add initial support for the microchip mcp7941x series of real time clocks.

    The mcp7941x series is generally compatible with the ds1307 and ds1337 rtc
    devices from dallas semiconductor. minor differences include a backup
    battery enable bit, and the polarity of the oscillator enable bit.

    Signed-off-by: David Anders
    Cc: Alessandro Zummo
    Reviewed-by: Wolfram Sang
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Anders
     
  • This is the one use of an ida that doesn't retry on receiving -EAGAIN.
    I'm assuming do so will cause no harm and may help on a rare occasion.

    Signed-off-by: Jonathan Cameron
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jonathan Cameron
     

02 Nov, 2011

1 commit


01 Nov, 2011

1 commit


15 Sep, 2011

2 commits

  • The driver does not generate an alarm interrupt even though a time for
    an alarm is set.

    This results from disabling rtc_clk after setting the alarm time.

    To generate an alarm interrupt the driver should maintain its enabled
    state for rtc_clk the until alarm interrupt occurs. This patch permits
    generation of an alarm interrupt.

    [akpm@linux-foundation.org: make s3c_rtc_alarm_clk_lock local to s3c_rtc_alarm_clk_enable()]
    Signed-off-by: Donggeun Kim
    Signed-off-by: MyungJoo Ham
    Signed-off-by: Kyungmin Park
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Donggeun Kim
     
  • Include linux/sched.h to fix below build error.

    CC drivers/rtc/rtc-imxdi.o
    drivers/rtc/rtc-imxdi.c: In function 'di_write_wait':
    drivers/rtc/rtc-imxdi.c:168: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)
    drivers/rtc/rtc-imxdi.c:168: error: (Each undeclared identifier is reported only once
    drivers/rtc/rtc-imxdi.c:168: error: for each function it appears in.)
    drivers/rtc/rtc-imxdi.c:168: error: implicit declaration of function 'signal_pending'
    drivers/rtc/rtc-imxdi.c:168: error: implicit declaration of function 'schedule_timeout'
    drivers/rtc/rtc-imxdi.c: In function 'dryice_norm_irq':
    drivers/rtc/rtc-imxdi.c:329: error: 'TASK_INTERRUPTIBLE' undeclared (first use in this function)

    Signed-off-by: Axel Lin
    Cc: Baruch Siach
    Cc: Wan ZongShun
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Axel Lin
     

08 Sep, 2011

1 commit

  • * 'timers-fixes-for-linus' of git://tesla.tglx.de/git/linux-2.6-tip:
    rtc: twl: Fix registration vs. init order
    rtc: Initialized rtc_time->tm_isdst
    rtc: Fix RTC PIE frequency limit
    rtc: rtc-twl: Remove lockdep related local_irq_enable()
    rtc: rtc-twl: Switch to using threaded irq
    rtc: ep93xx: Fix 'rtc' may be used uninitialized warning
    alarmtimers: Avoid possible denial of service with high freq periodic timers
    alarmtimers: Memset itimerspec passed into alarm_timer_get
    alarmtimers: Avoid possible null pointer traversal

    Linus Torvalds
     

27 Aug, 2011

2 commits

  • Only register as an RTC device after the hardware has been
    successfully initialized. The RTC class driver will call
    back to this driver to read a pending alarm, and other
    drivers watching for new devices on the RTC class may
    read the RTC time upon registration. Such access might
    occur while the RTC is stopped, prior to clearing
    pending alarms, etc.

    The new ordering also avoids leaving the platform
    device drvdata set to an unregistered struct rtc_device *
    on probe errors.

    Signed-off-by: Todd Poynor
    Signed-off-by: John Stultz

    Todd Poynor
     
  • Even though the Linux kernel does not use the tm_isdst field, it is
    exposed as part of the ABI. This field can accidentally be left
    initialized, which is why we currently memset buffers returned to
    userland in rtc_read_time.

    There is a case however where the field can return garbage from the
    stack though when using the RTC_ALM_READ ioctl on the rtc device. This
    ioctl invokes rtc_read_alarm, which is careful to memset the rtc_wkalrm
    buffer that is copied to userland, but it then uses a struct copy to
    assign to alarm->time given the return value from rtc_ktime_to_tm().

    rtc_ktime_to_tm() is implemented by calling rtc_time_to_tm using a
    derivative seconds counds from ktime, but rtc_time_to_tm does not assign
    a value to ->tm_isdst. This results in garbage from rtc_ktime_to_tm()'s
    frame ending up being copied out to userland as part of the returned
    rtc_wkalrm.

    Fix this by initializing rtc_time->tm_isdst to 0 in rtc_time_to_tm.

    Signed-off-by: Mike Waychison
    Signed-off-by: John Stultz

    Mike Waychison
     

26 Aug, 2011

2 commits

  • The previous rtc-s3c had two issues related with its IRQ.

    1. Users cannot open rtc multiple times because an open operation
    calls request_irq on the same IRQ. (e.g., two user processes wants to
    open and read RTC time from rtc-s3c at the same time)

    2. If alarm is set and no one has the rtc opened with filesystem
    (either the alarm is set by kernel/boot-loader or user set an alarm and
    closed rtc dev file), the pending bit is not cleared and no further
    interrupt is invoked. When the alarm is used by the system itself such
    as a resume from suspend-to-RAM or other Low-power modes/idle, this is
    a critical issue.

    This patch mitigates these issues by calling request_irq at probe and
    free_irq at remove.

    Signed-off-by: MyungJoo Ham
    Signed-off-by: Kyungmin Park
    Acked-by: Kukjin Kim
    Cc: Alessandro Zummo
    Cc: Changhwan Youn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    MyungJoo Ham
     
  • RTC-S3C used to print out debug messages incorrectly. This patch
    corrects incorrect outputs. (undecoded bcd numbers, incorrectly decoded
    register values)

    This patch affects the pr-debug messages only.

    Signed-off-by: MyungJoo Ham
    Signed-off-by: Kyungmin Park
    Acked-by: Kukjin Kim
    Cc: Alessandro Zummo
    Cc: Changhwan Youn
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    MyungJoo Ham
     

18 Aug, 2011

1 commit


11 Aug, 2011

4 commits

  • Thomas earlier submitted a fix to limit the RTC PIE freq, but
    picked 5000Hz out of the air. Willy noticed that we should
    instead use the 8192Hz max from the rtc man documentation.

    Cc: Willy Tarreau
    Cc: stable@kernel.org
    Cc: Thomas Gleixner
    Signed-off-by: John Stultz

    John Stultz
     
  • Now that the irq is properly threaded (due to it needing i2c access)
    we should also remove the local_irq_enable() call in twl_rtc_interrupt.
    Testing this with Pandaboard, the RTC is still working.

    [Reworked commit message -jstultz]
    Signed-off-by: John Stultz

    Sebastian Reichel
     
  • The driver is accessing to i2c bus in interrupt handler.
    Therefore, it should use threaded irq.

    Signed-off-by: Ilkka Koskinen
    Acked-by: Balaji T K
    Signed-off-by: John Stultz

    Ilkka Koskinen
     
  • commit 92d921c5d "rtc: ep93xx: Initialize drvdata before registering device"
    ensures the drvdata is initialized prior to registering the rtc device.
    But it set the drvdata to an uninitialized pointer.
    Thus calling platform_get_drvdata in ep93xx_rtc_remove does not get correct address.

    This patch fixes below warning by adding struct rtc_device *rtc to struct ep93xx_rtc.
    Then set platform drvdata to ep93xx_rtc instead of rtc.

    CC drivers/rtc/rtc-ep93xx.o
    drivers/rtc/rtc-ep93xx.c: In function 'ep93xx_rtc_probe':
    drivers/rtc/rtc-ep93xx.c:154: warning: 'rtc' may be used uninitialized in this function

    Signed-off-by: Axel Lin
    Signed-off-by: John Stultz

    Axel Lin
     

04 Aug, 2011

1 commit

  • As the comment explains, the intention of the code is to clear the
    OMAP_RTC_CTRL_MODE_12_24 bit, but instead it only clears the
    OMAP_RTC_CTRL_SPLIT and OMAP_RTC_CTRL_AUTO_COMP bits, which should be
    kept. OMAP_RTC_CTRL_DISABLE, OMAP_RTC_CTRL_SET_32_COUNTER,
    OMAP_RTC_CTRL_TEST, and OMAP_RTC_CTRL_ROUND_30S are also better off
    being cleared.

    Signed-off-by: Daniel Glöckner
    Cc: Alessandro Zummo
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Daniel Glöckner
     

27 Jul, 2011

6 commits

  • Ben reported a lockup related to rtc. The lockup happens due to:

    CPU0 CPU1

    rtc_irq_set_state() __run_hrtimer()
    spin_lock_irqsave(&rtc->irq_task_lock) rtc_handle_legacy_irq();
    spin_lock(&rtc->irq_task_lock);
    hrtimer_cancel()
    while (callback_running);

    So the running callback never finishes as it's blocked on
    rtc->irq_task_lock.

    Use hrtimer_try_to_cancel() instead and drop rtc->irq_task_lock while
    waiting for the callback. Fix this for both rtc_irq_set_state() and
    rtc_irq_set_freq().

    Signed-off-by: Thomas Gleixner
    Reported-by: Ben Greear
    Cc: John Stultz
    Cc: Ingo Molnar
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     
  • Due to the hrtimer self rearming mode a user can DoS the machine simply
    because it's starved by hrtimer events.

    The RTC hrtimer is self rearming. We really need to limit the frequency
    to something sensible.

    Signed-off-by: Thomas Gleixner
    Cc: John Stultz
    Cc: Ingo Molnar
    Cc: Ben Greear
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     
  • The code checks the correctness of the parameters, but unconditionally
    arms/disarms the hrtimer.

    The result is that a random task might arm/disarm rtc timer and surprise
    the real owner by either generating events or by stopping them.

    Signed-off-by: Thomas Gleixner
    Cc: John Stultz
    Cc: Ingo Molnar
    Cc: Ben Greear
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Gleixner
     
  • The RTC pie hrtimer is self rearming. We really need to limit the
    frequency to something sensible. Thus limit it to the 8192Hz max
    value from the rtc man documentation

    Cc: Willy Tarreau
    Cc: stable@kernel.org
    Signed-off-by: Thomas Gleixner
    [jstultz: slightly reworked to use RTC_MAX_FREQ value]
    Signed-off-by: John Stultz

    Thomas Gleixner
     
  • Ben reported a lockup related to rtc. The lockup happens due to:

    CPU0 CPU1

    rtc_irq_set_state() __run_hrtimer()
    spin_lock_irqsave(&rtc->irq_task_lock) rtc_handle_legacy_irq();
    spin_lock(&rtc->irq_task_lock);
    hrtimer_cancel()
    while (callback_running);

    So the running callback never finishes as it's blocked on
    rtc->irq_task_lock.

    Use hrtimer_try_to_cancel() instead and drop rtc->irq_task_lock while
    waiting for the callback. Fix this for both rtc_irq_set_state() and
    rtc_irq_set_freq().

    Cc: stable@kernel.org
    Reported-by: Ben Greear
    Signed-off-by: Thomas Gleixner
    Signed-off-by: John Stultz

    Thomas Gleixner
     
  • In rtc_irq_set_state, the code checks the correctness of the parameters,
    but then goes on to unconditionally arms/disarms the hrtimer. Thus a
    random task might arm/disarm rtc timer and surprise the real owner by
    either generating events or by stopping them.

    Cc: stable@kernel.org
    Signed-off-by: Thomas Gleixner
    Signed-off-by: John Stultz

    Thomas Gleixner
     

26 Jul, 2011

3 commits

  • * Merge akpm patch series: (122 commits)
    drivers/connector/cn_proc.c: remove unused local
    Documentation/SubmitChecklist: add RCU debug config options
    reiserfs: use hweight_long()
    reiserfs: use proper little-endian bitops
    pnpacpi: register disabled resources
    drivers/rtc/rtc-tegra.c: properly initialize spinlock
    drivers/rtc/rtc-twl.c: check return value of twl_rtc_write_u8() in twl_rtc_set_time()
    drivers/rtc: add support for Qualcomm PMIC8xxx RTC
    drivers/rtc/rtc-s3c.c: support clock gating
    drivers/rtc/rtc-mpc5121.c: add support for RTC on MPC5200
    init: skip calibration delay if previously done
    misc/eeprom: add eeprom access driver for digsy_mtc board
    misc/eeprom: add driver for microwire 93xx46 EEPROMs
    checkpatch.pl: update $logFunctions
    checkpatch: make utf-8 test --strict
    checkpatch.pl: add ability to ignore various messages
    checkpatch: add a "prefer __aligned" check
    checkpatch: validate signature styles and To: and Cc: lines
    checkpatch: add __rcu as a sparse modifier
    checkpatch: suggest using min_t or max_t
    ...

    Did this as a merge because of (trivial) conflicts in
    - Documentation/feature-removal-schedule.txt
    - arch/xtensa/include/asm/uaccess.h
    that were just easier to fix up in the merge than in the patch series.

    Linus Torvalds
     
  • Using __SPIN_LOCK_UNLOCKED for a dynamically allocated lock is wrong and
    breaks the build with PREEMPT_RT_FULL.

    Signed-off-by: Uwe Kleine-König
    Cc: Andrew Chew
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Uwe Kleine-König
     
  • We forget to save the return value of the call to
    twl_rtc_write_u8(save_control, REG_RTC_CTRL_REG); in 'ret', making the
    test of 'ret < 0' dead code since 'ret' then couldn't possibly have
    changed since the last test just a few lines above. It also makes us not
    detect failures from that specific twl_rtc_write_u8() call.

    Signed-off-by: Jesper Juhl
    Cc: Alessandro Zummo
    Cc: Alexandre Rusev
    Cc: "George G. Davis"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jesper Juhl