diff mbox series

[10/24] timekeeping: Define a struct type for tk_core to make it reusable

Message ID 20240911-devel-anna-maria-b4-timers-ptp-timekeeping-v1-10-f7cae09e25d6@linutronix.de (mailing list archive)
State Not Applicable
Headers show
Series timekeeping: Rework to prepare support of indenpendent PTP clocks | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Anna-Maria Behnsen Sept. 11, 2024, 1:29 p.m. UTC
The struct tk_core uses is not reusable. As long as there is only a single
timekeeper, this is not a problem. But when the timekeeper infrastructure
will be reused for per ptp clock timekeepers, an explicit struct type is
required.

Define struct tk_data as explicit struct type for tk_core.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
---
 kernel/time/timekeeping.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Simon Horman Sept. 12, 2024, 7:38 a.m. UTC | #1
On Wed, Sep 11, 2024 at 03:29:54PM +0200, Anna-Maria Behnsen wrote:
> The struct tk_core uses is not reusable. As long as there is only a single
> timekeeper, this is not a problem. But when the timekeeper infrastructure
> will be reused for per ptp clock timekeepers, an explicit struct type is
> required.
> 
> Define struct tk_data as explicit struct type for tk_core.
> 
> Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>

...

Hi Anna-Maria,

I wonder if the order of this and the previous patch should
be reversed, or the two patches should be squashed together.

I am seeing a build failure with only patches 01-09/24 of this series
applied, which seem to be resolved by applying this patch.

.../timekeeping.c:1735:43: warning: declaration of 'struct tk_data' will not be visible outside of this function [-Wvisibility]
 1735 | static __init void tkd_basic_setup(struct tk_data *tkd)
...
Anna-Maria Behnsen Sept. 13, 2024, 9:16 a.m. UTC | #2
Simon Horman <horms@kernel.org> writes:

> On Wed, Sep 11, 2024 at 03:29:54PM +0200, Anna-Maria Behnsen wrote:
>> The struct tk_core uses is not reusable. As long as there is only a single
>> timekeeper, this is not a problem. But when the timekeeper infrastructure
>> will be reused for per ptp clock timekeepers, an explicit struct type is
>> required.
>> 
>> Define struct tk_data as explicit struct type for tk_core.
>> 
>> Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
>
> ...
>
> Hi Anna-Maria,
>
> I wonder if the order of this and the previous patch should
> be reversed, or the two patches should be squashed together.
>
> I am seeing a build failure with only patches 01-09/24 of this series
> applied, which seem to be resolved by applying this patch.
>
> .../timekeeping.c:1735:43: warning: declaration of 'struct tk_data' will not be visible outside of this function [-Wvisibility]
>  1735 | static __init void tkd_basic_setup(struct tk_data *tkd)
> ...

Oh, I'm sorry. I mixed something up. Thanks for letting me know, I'll
have a look at it and fix it!

	Anna-Maria
diff mbox series

Patch

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index f8ffab5bb790..be939ce3bcfc 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -45,12 +45,14 @@  enum timekeeping_adv_mode {
  * The most important data for readout fits into a single 64 byte
  * cache line.
  */
-static struct {
+struct tk_data {
 	seqcount_raw_spinlock_t	seq;
 	struct timekeeper	timekeeper;
 	struct timekeeper	shadow_timekeeper;
 	raw_spinlock_t		lock;
-} tk_core ____cacheline_aligned;
+} ____cacheline_aligned;
+
+static struct tk_data tk_core;
 
 /* flag for if timekeeping is suspended */
 int __read_mostly timekeeping_suspended;