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


Groups > linux.kernel > #1413956 > unrolled thread

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

Started byAlexander Graf <agraf@suse.de>
First post2016-06-05 11:40 +0200
Last post2016-06-06 17:10 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [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

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

FromAlexander Graf <agraf@suse.de>
Date2016-06-05 11:40 +0200
Subject[PATCH] rtc: efi: Fail probing if RTC reads don't work
Message-ID<rGCHf-4YO-13@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1414785

FromArd Biesheuvel <ard.biesheuvel@linaro.org>
Date2016-06-06 11:00 +0200
Message-ID<rGYy6-2yM-23@gated-at.bofh.it>
In reply to#1413956
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
>

[toc] | [prev] | [next] | [standalone]


#1415199

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2016-06-06 17:10 +0200
Message-ID<rH4ka-6Am-11@gated-at.bofh.it>
In reply to#1413956
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web