rtc: efi: Fail probing if RTC reads don't work
PATCH 1/1 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.
--- drivers/rtc/rtc-efi.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/rtc/rtc-efi.c +6 -0
@@ -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 );
Signature · 11 lines
1.8.5.6 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
Quoted 8 lines · Alexander Graf
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]>
Quoted 24 lines
--- drivers/rtc/rtc-efi.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/rtc/rtc-efi.c +6
-1@@ -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
Signature · 8 lines
You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
Alexandre Belloni
AppliedQuoted 11 lines · Alexander Graf
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]>--- drivers/rtc/rtc-efi.c | 6 ++++++ 1 file changed, 6 insertions(+)
Applied, thanks.
Signature · 13 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.