diff options
author | Alexander Graf <agraf@suse.de> | 2016-06-05 05:35:56 -0400 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@free-electrons.com> | 2016-06-06 11:07:33 -0400 |
commit | 7368c69c033ff29e8e766f481748113c7adc1d1b (patch) | |
tree | 4ff05dc68c6c84fc66b02854d9ac12ea6ccd852c /drivers/rtc | |
parent | 06776c89214a14735fed5519340e2cea88b5b91f (diff) |
rtc: efi: Fail probing if RTC reads don't work
While the EFI spec mandates an RTC, not every implementation actually adheres
to that rule (or can adhere to it - some systems just don't have an RTC).
For those, we really don't want to probe the EFI RTC driver at all, because if
we do we'd get a non-functional driver that does nothing useful but only spills
our kernel log with warnings.
Signed-off-by: Alexander Graf <agraf@suse.de>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-efi.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 96d38609d803..0130afd7fe88 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c | |||
@@ -259,6 +259,12 @@ static const struct rtc_class_ops efi_rtc_ops = { | |||
259 | static int __init efi_rtc_probe(struct platform_device *dev) | 259 | static int __init efi_rtc_probe(struct platform_device *dev) |
260 | { | 260 | { |
261 | struct rtc_device *rtc; | 261 | struct rtc_device *rtc; |
262 | efi_time_t eft; | ||
263 | efi_time_cap_t cap; | ||
264 | |||
265 | /* First check if the RTC is usable */ | ||
266 | if (efi.get_time(&eft, &cap) != EFI_SUCCESS) | ||
267 | return -ENODEV; | ||
262 | 268 | ||
263 | rtc = devm_rtc_device_register(&dev->dev, "rtc-efi", &efi_rtc_ops, | 269 | rtc = devm_rtc_device_register(&dev->dev, "rtc-efi", &efi_rtc_ops, |
264 | THIS_MODULE); | 270 | THIS_MODULE); |