rtc: s3c: Rewrite clock handling 79/199779/2
authorMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 21 Jan 2019 11:09:30 +0000 (12:09 +0100)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 18 Feb 2019 04:54:02 +0000 (04:54 +0000)
commit09631c84ac395e8da3c4d45722da7c9e7eb1062c
treefdc96b078da7c9cf82558ae7b6230db2d3d92063
parent1a85c9feaca04868826e2e49326e3e8cf4e900c4
rtc: s3c: Rewrite clock handling

s3c_rtc_enable/disable_clk() functions were designed to be called multiple
times without reference counting, because they were initially only used in
alarm setting/clearing functions, which can be called both when alarm is
already set or not. Later however, calls to those functions have been added to
other places in the driver - like time and /proc reading callbacks, what
results in broken alarm if any of such events happens after the alarm has
been set. Fix this by simplifying s3c_rtc_enable/disable_clk() functions
to rely on proper reference counting in clock core and move alarm enable
counter to s3c_rtc_setaie() function.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
[backport of mainline commit 5a5b614ba61cc2a89ad0dffc63d913a1a6ba1f9f]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ib72a76ea0567ece0b7b5b706f2ee3b6cca850150
drivers/rtc/rtc-s3c.c