rtc: s3c: Rewrite clock handling
authorMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 21 Jan 2019 11:09:30 +0000 (12:09 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 22 Jan 2019 17:34:42 +0000 (18:34 +0100)
commit5a5b614ba61cc2a89ad0dffc63d913a1a6ba1f9f
treef8be6feae309e045dcda0bb8c8be81ed82a1c07e
parentf724c6bee162be3a9cd3b9168414ca106e0cdfe2
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>
drivers/rtc/rtc-s3c.c