mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
clocksource: arch_timer: Make register accessors less error-prone
Using an enum for the register we wish to access allows newer compilers to determine if we've forgotten a case in our switch statement. This allows us to remove the BUILD_BUG() instances in the arm64 port, avoiding problems where optimizations may not happen. To try and force better code generation we're currently marking the accessor functions as inline, but newer compilers can ignore the inline keyword unless it's marked __always_inline. Luckily on arm and arm64 inline is __always_inline, but let's make everything __always_inline to be explicit. Suggested-by: Thomas Gleixner <tglx@linutronix.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Marc Zyngier <Marc.Zyngier@arm.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Acked-by: Mark Rutland <mark.rutland@arm.com>
This commit is contained in:
parent
766acb88a7
commit
e09f3cc018
4 changed files with 22 additions and 27 deletions
|
@ -43,7 +43,7 @@ static bool arch_timer_use_virtual = true;
|
|||
* Architected system timer support.
|
||||
*/
|
||||
|
||||
static inline irqreturn_t timer_handler(const int access,
|
||||
static __always_inline irqreturn_t timer_handler(const int access,
|
||||
struct clock_event_device *evt)
|
||||
{
|
||||
unsigned long ctrl;
|
||||
|
@ -72,7 +72,7 @@ static irqreturn_t arch_timer_handler_phys(int irq, void *dev_id)
|
|||
return timer_handler(ARCH_TIMER_PHYS_ACCESS, evt);
|
||||
}
|
||||
|
||||
static inline void timer_set_mode(const int access, int mode)
|
||||
static __always_inline void timer_set_mode(const int access, int mode)
|
||||
{
|
||||
unsigned long ctrl;
|
||||
switch (mode) {
|
||||
|
@ -99,7 +99,7 @@ static void arch_timer_set_mode_phys(enum clock_event_mode mode,
|
|||
timer_set_mode(ARCH_TIMER_PHYS_ACCESS, mode);
|
||||
}
|
||||
|
||||
static inline void set_next_event(const int access, unsigned long evt)
|
||||
static __always_inline void set_next_event(const int access, unsigned long evt)
|
||||
{
|
||||
unsigned long ctrl;
|
||||
ctrl = arch_timer_reg_read(access, ARCH_TIMER_REG_CTRL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue