Make get/set_rtc_noop() to be public so that they can be used
in other modules as well.
Co-developed-by: Tianyu Lan <[email protected]>
Signed-off-by: Tianyu Lan <[email protected]>
Signed-off-by: Saurabh Sengar <[email protected]>
Reviewed-by: Wei Liu <[email protected]>
Reviewed-by: Michael Kelley <[email protected]>
---
arch/x86/include/asm/x86_init.h | 2 ++
arch/x86/kernel/x86_init.c | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index acc20ae4079d..88085f369ff6 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -330,5 +330,7 @@ extern void x86_init_uint_noop(unsigned int unused);
extern bool bool_x86_init_noop(void);
extern void x86_op_int_noop(int cpu);
extern bool x86_pnpbios_disabled(void);
+extern int set_rtc_noop(const struct timespec64 *now);
+extern void get_rtc_noop(struct timespec64 *now);
#endif
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index 95be3831df73..d82f4fa2f1bf 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -33,8 +33,8 @@ static int __init iommu_init_noop(void) { return 0; }
static void iommu_shutdown_noop(void) { }
bool __init bool_x86_init_noop(void) { return false; }
void x86_op_int_noop(int cpu) { }
-static __init int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
-static __init void get_rtc_noop(struct timespec64 *now) { }
+int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
+void get_rtc_noop(struct timespec64 *now) { }
static __initconst const struct of_device_id of_cmos_match[] = {
{ .compatible = "motorola,mc146818" },
--
2.34.1
On Tue, Apr 04, 2023 at 02:01:00AM -0700, Saurabh Sengar wrote:
> Make get/set_rtc_noop() to be public so that they can be used
> in other modules as well.
>
> Co-developed-by: Tianyu Lan <[email protected]>
> Signed-off-by: Tianyu Lan <[email protected]>
> Signed-off-by: Saurabh Sengar <[email protected]>
> Reviewed-by: Wei Liu <[email protected]>
> Reviewed-by: Michael Kelley <[email protected]>
> ---
> arch/x86/include/asm/x86_init.h | 2 ++
> arch/x86/kernel/x86_init.c | 4 ++--
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
> index acc20ae4079d..88085f369ff6 100644
> --- a/arch/x86/include/asm/x86_init.h
> +++ b/arch/x86/include/asm/x86_init.h
> @@ -330,5 +330,7 @@ extern void x86_init_uint_noop(unsigned int unused);
> extern bool bool_x86_init_noop(void);
> extern void x86_op_int_noop(int cpu);
> extern bool x86_pnpbios_disabled(void);
> +extern int set_rtc_noop(const struct timespec64 *now);
> +extern void get_rtc_noop(struct timespec64 *now);
>
> #endif
> diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
> index 95be3831df73..d82f4fa2f1bf 100644
> --- a/arch/x86/kernel/x86_init.c
> +++ b/arch/x86/kernel/x86_init.c
> @@ -33,8 +33,8 @@ static int __init iommu_init_noop(void) { return 0; }
> static void iommu_shutdown_noop(void) { }
> bool __init bool_x86_init_noop(void) { return false; }
> void x86_op_int_noop(int cpu) { }
> -static __init int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
> -static __init void get_rtc_noop(struct timespec64 *now) { }
> +int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
> +void get_rtc_noop(struct timespec64 *now) { }
I just had a second thought on this -- do you really need to drop the
__init annotation for these two functions?
Thanks,
Wei.
>
> static __initconst const struct of_device_id of_cmos_match[] = {
> { .compatible = "motorola,mc146818" },
> --
> 2.34.1
>
From: Wei Liu <[email protected]> Sent: Friday, April 7, 2023 10:26 AM
>
> On Tue, Apr 04, 2023 at 02:01:00AM -0700, Saurabh Sengar wrote:
> > Make get/set_rtc_noop() to be public so that they can be used
> > in other modules as well.
> >
> > Co-developed-by: Tianyu Lan <[email protected]>
> > Signed-off-by: Tianyu Lan <[email protected]>
> > Signed-off-by: Saurabh Sengar <[email protected]>
> > Reviewed-by: Wei Liu <[email protected]>
> > Reviewed-by: Michael Kelley <[email protected]>
> > ---
> > arch/x86/include/asm/x86_init.h | 2 ++
> > arch/x86/kernel/x86_init.c | 4 ++--
> > 2 files changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
> > index acc20ae4079d..88085f369ff6 100644
> > --- a/arch/x86/include/asm/x86_init.h
> > +++ b/arch/x86/include/asm/x86_init.h
> > @@ -330,5 +330,7 @@ extern void x86_init_uint_noop(unsigned int unused);
> > extern bool bool_x86_init_noop(void);
> > extern void x86_op_int_noop(int cpu);
> > extern bool x86_pnpbios_disabled(void);
> > +extern int set_rtc_noop(const struct timespec64 *now);
> > +extern void get_rtc_noop(struct timespec64 *now);
> >
> > #endif
> > diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
> > index 95be3831df73..d82f4fa2f1bf 100644
> > --- a/arch/x86/kernel/x86_init.c
> > +++ b/arch/x86/kernel/x86_init.c
> > @@ -33,8 +33,8 @@ static int __init iommu_init_noop(void) { return 0; }
> > static void iommu_shutdown_noop(void) { }
> > bool __init bool_x86_init_noop(void) { return false; }
> > void x86_op_int_noop(int cpu) { }
> > -static __init int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
> > -static __init void get_rtc_noop(struct timespec64 *now) { }
> > +int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
> > +void get_rtc_noop(struct timespec64 *now) { }
>
> I just had a second thought on this -- do you really need to drop the
> __init annotation for these two functions?
>
> Thanks,
> Wei.
I think "yes". In Patch 5 of the series, these are plugged into
x86_platform.get_wallclock() and set_wallclock(). The
x86_platform.get_wallclock() function can be called by
read_persistent_clock64(), which is not a __init function and
that may be called during resume from hibernation.
x86_platform.set_wallclock() is also called by a non __init function
update_persistent_clock64(), which is called by sync_hw_clock().
Michael
>
> >
> > static __initconst const struct of_device_id of_cmos_match[] = {
> > { .compatible = "motorola,mc146818" },
> > --
> > 2.34.1
> >
On Tue, Apr 04, 2023 at 02:01:00AM -0700, Saurabh Sengar wrote:
> Make get/set_rtc_noop() to be public so that they can be used
> in other modules as well.
>
> Co-developed-by: Tianyu Lan <[email protected]>
> Signed-off-by: Tianyu Lan <[email protected]>
> Signed-off-by: Saurabh Sengar <[email protected]>
> Reviewed-by: Wei Liu <[email protected]>
> Reviewed-by: Michael Kelley <[email protected]>
> ---
> arch/x86/include/asm/x86_init.h | 2 ++
> arch/x86/kernel/x86_init.c | 4 ++--
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
> index acc20ae4079d..88085f369ff6 100644
> --- a/arch/x86/include/asm/x86_init.h
> +++ b/arch/x86/include/asm/x86_init.h
> @@ -330,5 +330,7 @@ extern void x86_init_uint_noop(unsigned int unused);
> extern bool bool_x86_init_noop(void);
> extern void x86_op_int_noop(int cpu);
> extern bool x86_pnpbios_disabled(void);
> +extern int set_rtc_noop(const struct timespec64 *now);
> +extern void get_rtc_noop(struct timespec64 *now);
>
> #endif
> diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
> index 95be3831df73..d82f4fa2f1bf 100644
> --- a/arch/x86/kernel/x86_init.c
> +++ b/arch/x86/kernel/x86_init.c
> @@ -33,8 +33,8 @@ static int __init iommu_init_noop(void) { return 0; }
> static void iommu_shutdown_noop(void) { }
> bool __init bool_x86_init_noop(void) { return false; }
> void x86_op_int_noop(int cpu) { }
> -static __init int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
> -static __init void get_rtc_noop(struct timespec64 *now) { }
> +int set_rtc_noop(const struct timespec64 *now) { return -EINVAL; }
> +void get_rtc_noop(struct timespec64 *now) { }
>
These functions are just empty place holders.
What is the value in having then exported at all?
Also, if you do want to use exactly there functions, a better option
would be to move them to the header file as "static inline" ones.
> static __initconst const struct of_device_id of_cmos_match[] = {
> { .compatible = "motorola,mc146818" },
> --
> 2.34.1