* [PATCH] rtc: efi: Fail probing if RTC reads don't work
@ 2016-06-05 9:35 Alexander Graf
2016-06-06 8:54 ` Ard Biesheuvel
2016-06-06 15:08 ` Alexandre Belloni
0 siblings, 2 replies; 3+ messages in thread
From: Alexander Graf @ 2016-06-05 9:35 UTC (permalink / raw)
To: rtc-linux
Cc: leif.lindholm, linux-kernel, Alexandre Belloni, Alessandro Zummo,
Ard Biesheuvel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: efi: Fail probing if RTC reads don't work
2016-06-05 9:35 [PATCH] rtc: efi: Fail probing if RTC reads don't work Alexander Graf
@ 2016-06-06 8:54 ` Ard Biesheuvel
2016-06-06 15:08 ` Alexandre Belloni
1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2016-06-06 8:54 UTC (permalink / raw)
To: Alexander Graf
Cc: rtc-linux, Leif Lindholm, linux-kernel, Alexandre Belloni,
Alessandro Zummo
On 5 June 2016 at 11:35, Alexander Graf <agraf@suse.de> wrote:
> 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>
> ---
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rtc: efi: Fail probing if RTC reads don't work
2016-06-05 9:35 [PATCH] rtc: efi: Fail probing if RTC reads don't work Alexander Graf
2016-06-06 8:54 ` Ard Biesheuvel
@ 2016-06-06 15:08 ` Alexandre Belloni
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2016-06-06 15:08 UTC (permalink / raw)
To: Alexander Graf
Cc: rtc-linux, leif.lindholm, linux-kernel, Alessandro Zummo, Ard Biesheuvel
On 05/06/2016 at 11:35:56 +0200, Alexander Graf wrote :
> 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(+)
Applied, thanks.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-06 15:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-05 9:35 [PATCH] rtc: efi: Fail probing if RTC reads don't work Alexander Graf
2016-06-06 8:54 ` Ard Biesheuvel
2016-06-06 15:08 ` Alexandre Belloni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).