101-clocksource-mips-gic-timer-fix-clocksource-counter-w.patch 874 B

1234567891011121314151617181920212223
  1. From: Felix Fietkau <[email protected]>
  2. Date: Wed, 21 Feb 2018 13:40:12 +0100
  3. Subject: [PATCH] clocksource: mips-gic-timer: fix clocksource counter width
  4. This code needs to use ffs instead of fls on the mask to determine the
  5. shift for reading the GIC_CONFIG_COUNTBITS field.
  6. Fixes: e07127a077c7 ("clocksource: mips-gic-timer: Use new GIC accessor functions")
  7. Cc: Paul Burton <[email protected]>
  8. Signed-off-by: Felix Fietkau <[email protected]>
  9. ---
  10. --- a/drivers/clocksource/mips-gic-timer.c
  11. +++ b/drivers/clocksource/mips-gic-timer.c
  12. @@ -164,7 +164,7 @@ static int __init __gic_clocksource_init
  13. /* Set clocksource mask. */
  14. count_width = read_gic_config() & GIC_CONFIG_COUNTBITS;
  15. - count_width >>= __fls(GIC_CONFIG_COUNTBITS);
  16. + count_width >>= __ffs(GIC_CONFIG_COUNTBITS);
  17. count_width *= 4;
  18. count_width += 32;
  19. gic_clocksource.mask = CLOCKSOURCE_MASK(count_width);