From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752506AbcFFIyw (ORCPT ); Mon, 6 Jun 2016 04:54:52 -0400 Received: from mail-io0-f172.google.com ([209.85.223.172]:36750 "EHLO mail-io0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751598AbcFFIyt (ORCPT ); Mon, 6 Jun 2016 04:54:49 -0400 MIME-Version: 1.0 In-Reply-To: <1465119356-129799-1-git-send-email-agraf@suse.de> References: <1465119356-129799-1-git-send-email-agraf@suse.de> From: Ard Biesheuvel Date: Mon, 6 Jun 2016 10:54:48 +0200 Message-ID: Subject: Re: [PATCH] rtc: efi: Fail probing if RTC reads don't work To: Alexander Graf Cc: rtc-linux@googlegroups.com, Leif Lindholm , "linux-kernel@vger.kernel.org" , Alexandre Belloni , Alessandro Zummo Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5 June 2016 at 11:35, 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 Acked-by: Ard Biesheuvel > --- > 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 >