Re: [PATCH V2 2/11] time: convert arch_gettimeoffset to a pointer

From: John Stultz
Date: Mon Nov 12 2012 - 16:36:27 EST


On 11/12/2012 12:51 PM, Stephen Warren wrote:
From: Stephen Warren <swarren@xxxxxxxxxx>

Currently, whenever CONFIG_ARCH_USES_GETTIMEOFFSET is enabled, each
arch core provides a single implementation of arch_gettimeoffset(). In
many cases, different sub-architectures, different machines, or
different timer providers exist, and so the arch ends up implementing
arch_gettimeoffset() as a call-through-pointer anyway. Examples are
ARM, Cris, M68K, and it's arguable that the remaining architectures,
M32R and Blackfin, should be doing this anyway.

Modify arch_gettimeoffset so that it itself is a function pointer, which
the arch initializes. This will allow later changes to move the
initialization of this function into individual machine support or timer
drivers. This is particularly useful for code in drivers/clocksource
which should rely on an arch-independant mechanism to register their
implementation of arch_gettimeoffset().

This patch also converts the Cris architecture to set arch_gettimeoffset
directly to the final implementation in time_init(), because Cris already
had separate time_init() functions per sub-architecture. M68K and ARM
are converted to set arch_gettimeoffset the final implementation in later
patches, because they already have function pointers in place for this
purpose.

Cc: Russell King <linux@xxxxxxxxxxxxxxxx>
Cc: Mike Frysinger <vapier@xxxxxxxxxx>
Cc: Mikael Starvik <starvik@xxxxxxxx>
Cc: Hirokazu Takata <takata@xxxxxxxxxxxxxx>
Cc: John Stultz <johnstul@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Acked-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx>
Acked-by: Jesper Nilsson <jesper.nilsson@xxxxxxxx>
Signed-off-by: Stephen Warren <swarren@xxxxxxxxxx>
---
v2:
* s/gettimeoffset/get_arch_timeoffset/ to make the name less generic
and more arch-specific.

(Note: I've only reposted patch 2/11 this time around, and I still hope
to take it through the arm-soc tree due to dependencies, so I'm not
requesting this be applied by the timekeeping maintainers)

One last thing to watch out for: If you're trying to build a kernel that mixes clocksource support with get_arch_timeoffset, you'll need to rework the #ifdef in update_wall_time(), since we currently assume with get_arch_timeoffset() that you're using tick + interpolation, so every call to update_wall_time() only moves time forward by one jiffy.

Otherwise, thanks for the name tweak. Going through the arm-soc tree is fine with me.

Acked-by: John Stultz <johnstul@xxxxxxxxxx>

thanks
-john

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/