Commit Graph

13 Commits

Author SHA1 Message Date
Stephen Boyd faac910201 rtc: Remove dev_err() usage after platform_get_irq()
We don't need dev_err() messages when platform_get_irq() fails now that
platform_get_irq() prints an error message itself when something goes
wrong. Let's remove these prints with a simple semantic patch.

// <smpl>
@@
expression ret;
struct platform_device *E;
@@

ret =
(
platform_get_irq(E, ...)
|
platform_get_irq_byname(E, ...)
);

if ( \( ret < 0 \| ret <= 0 \) )
{
(
-if (ret != -EPROBE_DEFER)
-{ ...
-dev_err(...);
-... }
|
...
-dev_err(...);
)
...
}
// </smpl>

While we're here, remove braces on if statements that only have one
statement (manually).

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-rtc@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20190730181557.90391-40-swboyd@chromium.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-08-13 10:53:10 +02:00
Alexandre Belloni 58f889150a rtc: xgene: use .set_time
Use .set_time instead of the deprecated .set_mmss.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni 43f327fa48 rtc: xgene: switch to rtc_time64_to_tm/rtc_tm_to_time64
Call the 64bit versions of rtc_tm time conversion as the range is enforced
by the core.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni 9a842a7ebb rtc: xgene: stop caching alarm_time
There is no point in caching alarm_time for .read_alarm because
.read_alarm is only called at boo time and thus alarm_time is always 0.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni db7853414b rtc: xgene: correct checkpatch issues
Correct trivial whitespace issues. Also sort the headers.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni 3a205b9dc8 rtc: xgene: convert to SPDX identifier
Use SPDX-License-Identifier instead of a verbose license text.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni 490595abfd rtc: xgene: set range
CCVR is a 32bit second counter.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni a652e00ee1 rtc: xgene: fix possible race condition
The IRQ is requested before the struct rtc is allocated and registered, but
this struct is used in the IRQ handler. This may lead to a NULL pointer
dereference.

Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc
struct before requesting the IRQ.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-04 10:07:08 +02:00
Alexandre Belloni ab62670e57 rtc: stop validating rtc_time after rtc_time_to_tm
rtc_time_to_tm never generates an invalid tm. It is not necessary to
validate it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-03-01 10:49:41 +01:00
Arnd Bergmann 573e2bf054 rtc: xgene: mark PM functions as __maybe_unused
The new xgene_rtc_alarm_irq_enabled() function is only accessed
from PM code, which is inside of an #ifdef; this causes a harmless
build warning when CONFIG_PM is disabled:

drivers/rtc/rtc-xgene.c:108:12: error: 'xgene_rtc_alarm_irq_enabled' defined but not used [-Werror=unused-function]

Just remove the #ifdef and use __maybe_unused annotations instead,
to make the code more robust here.

Fixes: d0bcd82b13 ("rtc: xgene: Fix suspend/resume")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Loc Ho <lho@apm.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-09 01:25:47 +01:00
Loc Ho d0bcd82b13 rtc: xgene: Fix suspend/resume
This patch fixes suspend/resume functions properly for the APM X-Gene
SoC RTC driver.

Signed-off-by: Loc Ho <lho@apm.com>
Reviewed-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-11-09 01:16:36 +01:00
Wolfram Sang 0929ae376e rtc: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:21:31 +02:00
Loc Ho f12d869538 drivers/rtc: add APM X-Gene SoC RTC driver
Add support for the APM X-Gene SoC RTC driver.

Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com>
Signed-off-by: Loc Ho <lho@apm.com>
Cc: Jon Masters <jcm@redhat.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-06-06 16:08:06 -07:00