rtc: rtc-pm8xxx: remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate
the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: rtc-rx8025: remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate
the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: rtc-sirfsoc: remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate
the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: rtc-lpc32xx: remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate
the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: rtc-spear: remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate
the MM subsystem generic OOM message.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: rtc-coh901331: use devm_ioremap_resource()

Use devm_ioremap_resource() in order to make the code simpler, and
remove redundant return value check of platform_get_resource() because
the value is checked by devm_ioremap_resource().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: rtc-davinci: use devm_ioremap_resource()

Use devm_ioremap_resource() in order to make the code simpler, and
remove redundant return value check of platform_get_resource() because
the value is checked by devm_ioremap_resource().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: rtc-vt8500: use devm_ioremap_resource()

Use devm_ioremap_resource() in order to make the code simpler, and move
'struct resource *res' from 'struct vt8500_rtc' to vt8500_rtc_probe()
because the 'res' variable is used only in vt8500_rtc_probe().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: rtc-jz4740: use devm_ioremap_resource()

Use devm_ioremap_resource() in order to make the code simpler, and move
'struct resource *mem' from 'struct jz4740_rtc' to jz4740_rtc_probe()
because the 'mem' variable is used only in jz4740_rtc_probe().  Also the
redundant return value check of platform_get_resource() is removed,
because the value is checked by devm_ioremap_resource().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-isl12057.c: remove duplicate include

linux/rtc.h was included twice.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-da9052.c: remove redundant private structure field

Remove redundant irq field in private rtc structure.

Signed-off-by: Anthony Olech <anthony.olech.opensource@diasemi.com>
Acked-by: David Dajun Chen <david.chen@diasemi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-sirfsoc.c: fix kernel panic of backing from hibernation

RTC settings will be lost if power supply is cut off after hibernation
finished, but the current "restore" function does not restore RTC related
settings, this causes rtc_read_time failure and kernel panic:

  rtc rtc0: **** DPM device timeout ****
  Stack trace:
    unwind_backtrace+0x0/0xf4
    show_stack+0x10/0x14
    dpm_wd_handler+0x24/0x28
    call_timer_fn.isra.33+0x24/0x88
    run_timer_softirq+0x178/0x1f0
    __do_softirq+0x120/0x200
    do_softirq+0x54/0x5c
    irq_exit+0x9c/0xd0
    handle_IRQ+0x44/0x90
    __irq_svc+0x40/0x70
    _raw_spin_unlock_irqrestore+0x10/0x48
    sirfsoc_rtc_iobrg_readl+0x34/0x3c
    sirfsoc_rtc_read_time+0x24/0x48
    __rtc_read_time.isra.3+0x48/0x5c
    rtc_read_time+0x30/0x44
    rtc_resume.part.9+0x20/0x104
    rtc_resume+0x5c/0x64
    dpm_run_callback.isra.4+0x2c/0x74
    device_resume+0x9c/0x144
    dpm_resume+0x100/0x224
    hibernation_snapshot+0x170/0x398
    hibernate+0x13c/0x1d8
    state_store+0xb4/0xb8
    kobj_attr_store+0x14/0x20
    sysfs_write_file+0x160/0x190
    vfs_write+0xb4/0x194
    SyS_write+0x3c/0x78

this patch uses SIMPLE_DEV_PM_OPS() to make restore() execute the
existing resume() function which will restore the set of RTC.

Signed-off-by: Xianglong Du <Xianglong.Du@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-ds1307.c: fix sysfs wakealarm attribute creation

In order to allow the creation of the sysfs attribute wakealarm, this
patch moves the device_set_wakeup_capable() call above the RTC device
registration.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-ds1307.c: add alarm support for mcp7941x chips

Add alarm support for the Microchip RTC devices MCP794xx.  Note that two
programmable alarms are provided by the chip but only one is used by the
driver.

Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: mc13xxx: remove __exit_p()

Since we no longer allow building without hotplug, the
mc13xxx_rtc_remove() function is always present and we should not use
__exit_p() to refer to it.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: mc13xxx: request IRQs after RTC registration

Interrupts can appear after request_irq and interrupt handlers can use
the RTC device, but currently we register RTC after IRQs.  This patch
changes this order and simplify error path a bit.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: mc13xxx: simplify alarm_irq_enable()

This patch removes excess layer for alarm_irq_enable() function.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: mc13xxx: fix 1Hz interrupt

1Hz interrupt is never unmasked, so no interrupts appears.  This patch
fix this issue.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: mc13xxx: change RTC validation scheme

Datasheet says: "When the VSRTC voltage drops to the range of 0.9 - 0.8V,
the RTCPORB reset signal is generated and the contents of the RTC will
be reset.  <skip>.  To inform the processor that the contents of the RTC
are no longer valid due to the reset, a timer reset interrupt function
is implemented with the RTCRSTI bit." This patch makes the RTC valid by
default until RTCRST interrupt occurs.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
rtc: mc13xxx: make rtc_read_time() more readable

Remove unnecessary locks when reading the time and make the read
operation until the values of day matched between reading the seconds,
it will make the mc13xxx_rtc_read_time() procedure more readable.
Additionally, patch introduced a "seconds in a day" definition.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Sascha Hauer <kernel@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>