Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1413956

[PATCH] rtc: efi: Fail probing if RTC reads don't work

From Alexander Graf <agraf@suse.de>
Newsgroups linux.kernel
Subject [PATCH] rtc: efi: Fail probing if RTC reads don't work
Date 2016-06-05 11:40 +0200
Message-ID <rGCHf-4YO-13@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/rtc/rtc-efi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c
index 96d3860..0130afd 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 = {
 static int __init efi_rtc_probe(struct platform_device *dev)
 {
 	struct rtc_device *rtc;
+	efi_time_t eft;
+	efi_time_cap_t cap;
+
+	/* First check if the RTC is usable */
+	if (efi.get_time(&eft, &cap) != EFI_SUCCESS)
+		return -ENODEV;
 
 	rtc = devm_rtc_device_register(&dev->dev, "rtc-efi", &efi_rtc_ops,
 					THIS_MODULE);
-- 
1.8.5.6

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] rtc: efi: Fail probing if RTC reads don't work Alexander Graf <agraf@suse.de> - 2016-06-05 11:40 +0200
  Re: [PATCH] rtc: efi: Fail probing if RTC reads don't work Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2016-06-06 11:00 +0200
  Re: [PATCH] rtc: efi: Fail probing if RTC reads don't work Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-06 17:10 +0200

csiph-web