From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa.local.altlinux.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.1 X-Yandex-Fwd: 2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1653064202; bh=edwh3wpyJLy/MOyZEK8/4l4Eg+ssB02aZDSCRlBq5TI=; h=Reply-To:In-Reply-To:References:Date:Subject:Cc:To:From: Message-Id; b=gWQLCq7AaPQO7vzN6m+WXbY8Uh4KOfJonU8Q48ZBQ0xVgSBHyG/ZFd9kIhAMCSe5O 1cSFyZ5Za0+RI3PIPfPlU6yRWyfIkQcD2sKARsQ0zALsJGhc5CGVOYb3sgKPtrowHp qf6eax8D/efGTT0vyXXlQelSf7ssp+npEgEu+kE8= Authentication-Results: sas1-c701ea5c66a2.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru From: asheplyakov@yandex.ru To: devel@lists.altlinux.org Date: Fri, 20 May 2022 20:28:37 +0400 Message-Id: <20220520162849.1554351-24-asheplyakov@yandex.ru> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220520162849.1554351-1-asheplyakov@yandex.ru> References: <20220520162849.1554351-1-asheplyakov@yandex.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: Vitaly Chikunov , Igor Chudov , Alexey Sheplyakov , Evgeny Sinelnikov Subject: [devel] [PATCH 23/35] efi-rtc: avoid calling efi.get_time on Baikal-M SoC X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 May 2022 16:30:17 -0000 Archived-At: List-Archive: List-Post: From: Alexey Sheplyakov Old versions of Baikal-M UEFI (before SDK-M 4.4) do NOT provide get_time at the runtime (not even as a stub), hence calling it results in an Oops. X-DONTUPSTREAM X-legacy X-feature-Baikal-M --- drivers/rtc/rtc-efi.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 138c5e0046c8..af232802278f 100644 --- a/drivers/rtc/rtc-efi.c +++ b/drivers/rtc/rtc-efi.c @@ -17,6 +17,7 @@ #include #include #include +#include #define EFI_ISDST (EFI_TIME_ADJUST_DAYLIGHT|EFI_TIME_IN_DAYLIGHT) @@ -257,6 +258,14 @@ static int __init efi_rtc_probe(struct platform_device *dev) efi_time_t eft; efi_time_cap_t cap; +#ifdef CONFIG_OF + /* efi.get_time is not always safe to call since some UEFI + * implementations do not privde get_time at runtime. */ + if (of_device_is_compatible(of_root, "baikal,baikal-m")) { + dev_err(&dev->dev, "Baikal-M UEFI has no get_time\n"); + return -ENODEV; + } +#endif /* First check if the RTC is usable */ if (efi.get_time(&eft, &cap) != EFI_SUCCESS) return -ENODEV; -- 2.32.0