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=-4.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 From: Alexey Sheplyakov To: devel-kernel@lists.altlinux.org Date: Wed, 14 Dec 2022 17:18:54 +0400 Message-Id: <20221214131919.681481-7-asheplyakov@basealt.ru> X-Mailer: git-send-email 2.33.5 In-Reply-To: <20221214131919.681481-1-asheplyakov@basealt.ru> References: <20221214131919.681481-1-asheplyakov@basealt.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: =?UTF-8?q?=D0=A0=D0=BE=D0=BC=D0=B0=D0=BD=20=D0=A1=D1=82=D0=B0=D0=B2=D1=86=D0=B5=D0=B2?= , =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C=20=D0=A7=D1=83=D0=B4=D0=BE=D0=B2?= , =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9=20=D0=A1=D0=B8=D0=BD=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2?= , =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=A2=D0=B5=D1=80=D1=91=D1=85=D0=B8=D0=BD?= Subject: [d-kernel] [PATCH 07/32] efi-rtc: avoid calling efi.get_time on Baikal-M SoC X-BeenThere: devel-kernel@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: ALT Linux kernel packages development List-Id: ALT Linux kernel packages development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Dec 2022 13:19:57 -0000 Archived-At: List-Archive: List-Post: 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. Signed-off-by: Alexey Sheplyakov X-DONTUPSTREAM X-legacy X-feature-Baikal-M --- drivers/rtc/rtc-efi.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c index 11850c2880ad..84fcd6ff092e 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,15 @@ 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") || + of_device_is_compatible(of_root, "baikal,bm1000")) { + 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.33.5