linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/9] efi: register EFI rtc platform device only when available
       [not found] <20200219171907.11894-1-ardb@kernel.org>
@ 2020-02-19 17:19 ` Ard Biesheuvel
  2020-02-19 22:11   ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Ard Biesheuvel @ 2020-02-19 17:19 UTC (permalink / raw)
  To: linux-efi
  Cc: Ard Biesheuvel, Leif Lindholm, Peter Jones, Alexander Graf,
	Heinrich Schuchardt, Jeff Brasen, Atish Patra, x86,
	Alessandro Zummo, Alexandre Belloni, linux-rtc

Drop the separate driver that registers the EFI rtc on all EFI
systems that have runtime services available, and instead, move
the registration into the core EFI code, and make it conditional
on whether the actual time related services are available.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-rtc@vger.kernel.org
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
 drivers/firmware/efi/efi.c     |  3 ++
 drivers/rtc/Makefile           |  4 ---
 drivers/rtc/rtc-efi-platform.c | 35 --------------------
 3 files changed, 3 insertions(+), 39 deletions(-)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index abf4c02e0201..69a585106d30 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -321,6 +321,9 @@ static int __init efisubsys_init(void)
 		}
 	}
 
+	if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES))
+		platform_device_register_simple("rtc-efi", 0, NULL, 0);
+
 	/* We register the efi directory at /sys/firmware/efi */
 	efi_kobj = kobject_create_and_add("efi", firmware_kobj);
 	if (!efi_kobj) {
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 4ac8f19fb631..24c7dfa1bd7d 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -12,10 +12,6 @@ obj-$(CONFIG_RTC_CLASS)		+= rtc-core.o
 obj-$(CONFIG_RTC_MC146818_LIB)	+= rtc-mc146818-lib.o
 rtc-core-y			:= class.o interface.o
 
-ifdef CONFIG_RTC_DRV_EFI
-rtc-core-y			+= rtc-efi-platform.o
-endif
-
 rtc-core-$(CONFIG_RTC_NVMEM)		+= nvmem.o
 rtc-core-$(CONFIG_RTC_INTF_DEV)		+= dev.o
 rtc-core-$(CONFIG_RTC_INTF_PROC)	+= proc.o
diff --git a/drivers/rtc/rtc-efi-platform.c b/drivers/rtc/rtc-efi-platform.c
deleted file mode 100644
index 6c037dc4e3dc..000000000000
--- a/drivers/rtc/rtc-efi-platform.c
+++ /dev/null
@@ -1,35 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Moved from arch/ia64/kernel/time.c
- *
- * Copyright (C) 1998-2003 Hewlett-Packard Co
- *	Stephane Eranian <eranian@hpl.hp.com>
- *	David Mosberger <davidm@hpl.hp.com>
- * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
- * Copyright (C) 1999-2000 VA Linux Systems
- * Copyright (C) 1999-2000 Walt Drummond <drummond@valinux.com>
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/efi.h>
-#include <linux/platform_device.h>
-
-static struct platform_device rtc_efi_dev = {
-	.name = "rtc-efi",
-	.id = -1,
-};
-
-static int __init rtc_init(void)
-{
-	if (efi_enabled(EFI_RUNTIME_SERVICES))
-		if (platform_device_register(&rtc_efi_dev) < 0)
-			pr_err("unable to register rtc device...\n");
-
-	/* not necessarily an error */
-	return 0;
-}
-module_init(rtc_init);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 4/9] efi: register EFI rtc platform device only when available
  2020-02-19 17:19 ` [PATCH 4/9] efi: register EFI rtc platform device only when available Ard Biesheuvel
@ 2020-02-19 22:11   ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2020-02-19 22:11 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-efi, Leif Lindholm, Peter Jones, Heinrich Schuchardt,
	Jeff Brasen, Atish Patra, x86, Alessandro Zummo, linux-rtc

On 19/02/2020 18:19:02+0100, Ard Biesheuvel wrote:
> Drop the separate driver that registers the EFI rtc on all EFI
> systems that have runtime services available, and instead, move
> the registration into the core EFI code, and make it conditional
> on whether the actual time related services are available.
> 
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
> Cc: linux-rtc@vger.kernel.org
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/firmware/efi/efi.c     |  3 ++
>  drivers/rtc/Makefile           |  4 ---
>  drivers/rtc/rtc-efi-platform.c | 35 --------------------
>  3 files changed, 3 insertions(+), 39 deletions(-)
> 
> diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
> index abf4c02e0201..69a585106d30 100644
> --- a/drivers/firmware/efi/efi.c
> +++ b/drivers/firmware/efi/efi.c
> @@ -321,6 +321,9 @@ static int __init efisubsys_init(void)
>  		}
>  	}
>  
> +	if (efi_rt_services_supported(EFI_RT_SUPPORTED_TIME_SERVICES))
> +		platform_device_register_simple("rtc-efi", 0, NULL, 0);
> +
>  	/* We register the efi directory at /sys/firmware/efi */
>  	efi_kobj = kobject_create_and_add("efi", firmware_kobj);
>  	if (!efi_kobj) {
> diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
> index 4ac8f19fb631..24c7dfa1bd7d 100644
> --- a/drivers/rtc/Makefile
> +++ b/drivers/rtc/Makefile
> @@ -12,10 +12,6 @@ obj-$(CONFIG_RTC_CLASS)		+= rtc-core.o
>  obj-$(CONFIG_RTC_MC146818_LIB)	+= rtc-mc146818-lib.o
>  rtc-core-y			:= class.o interface.o
>  
> -ifdef CONFIG_RTC_DRV_EFI
> -rtc-core-y			+= rtc-efi-platform.o
> -endif
> -
>  rtc-core-$(CONFIG_RTC_NVMEM)		+= nvmem.o
>  rtc-core-$(CONFIG_RTC_INTF_DEV)		+= dev.o
>  rtc-core-$(CONFIG_RTC_INTF_PROC)	+= proc.o
> diff --git a/drivers/rtc/rtc-efi-platform.c b/drivers/rtc/rtc-efi-platform.c
> deleted file mode 100644
> index 6c037dc4e3dc..000000000000
> --- a/drivers/rtc/rtc-efi-platform.c
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -/*
> - * Moved from arch/ia64/kernel/time.c
> - *
> - * Copyright (C) 1998-2003 Hewlett-Packard Co
> - *	Stephane Eranian <eranian@hpl.hp.com>
> - *	David Mosberger <davidm@hpl.hp.com>
> - * Copyright (C) 1999 Don Dugger <don.dugger@intel.com>
> - * Copyright (C) 1999-2000 VA Linux Systems
> - * Copyright (C) 1999-2000 Walt Drummond <drummond@valinux.com>
> - */
> -
> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> -
> -#include <linux/init.h>
> -#include <linux/kernel.h>
> -#include <linux/module.h>
> -#include <linux/efi.h>
> -#include <linux/platform_device.h>
> -
> -static struct platform_device rtc_efi_dev = {
> -	.name = "rtc-efi",
> -	.id = -1,
> -};
> -
> -static int __init rtc_init(void)
> -{
> -	if (efi_enabled(EFI_RUNTIME_SERVICES))
> -		if (platform_device_register(&rtc_efi_dev) < 0)
> -			pr_err("unable to register rtc device...\n");
> -
> -	/* not necessarily an error */
> -	return 0;
> -}
> -module_init(rtc_init);
> -- 
> 2.17.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-19 22:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20200219171907.11894-1-ardb@kernel.org>
2020-02-19 17:19 ` [PATCH 4/9] efi: register EFI rtc platform device only when available Ard Biesheuvel
2020-02-19 22:11   ` 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).