Skip to content

Commit

Permalink
rtc: efi: Fail probing if RTC reads don't work
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Signed-off-by: Alexandre Belloni <[email protected]>
  • Loading branch information
agraf authored and alexandrebelloni committed Jun 6, 2016
1 parent 06776c8 commit 7368c69
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/rtc/rtc-efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7368c69

Please sign in to comment.