• Andrew Morton's avatar
    [PATCH] CLOCK_TICK_RATE: introduce asm-*/8253pit.h, #define PIT_TICK_RATE constant. · 80c44e42
    Andrew Morton authored
    From: Thorsten Kranzkowski <dl8bcu@dl8bcu.de>
    
    The calculation of the counter values in drivers/input/misc/pcspkr.c is
    incorrectly based on CLOCK_TICK_RATE.  This goes unnoticed in i386 because
    there the system clock is driven by the same Programmable Interval Timer chip
    as the speaker.  But this doesn't hold true on other archs, e.g.  Alpha.
    
    To solve this problem I made these patches:
    
    1/3:    introduce asm-*/8253pit.h, #define PIT_TICK_RATE constant.
            It seems this is not always the same value.
    2/3:    use PIT_TICK_RATE in *spkr.c
    3/3:    use CLOCK_TICK_RATE where 1193180 was used in general timing
            calculations. (optional)
    
    There are still some places where the magic number is used instead of the
    #define (vt_ioctl.c, gameport.c) but I left them as-is.  I got some responses
    from arch maintainers to specifically not touch their respective architectures
    so changing these places would mean breakage for them.
    
    Tested on Alpha and i386, ack'ed by Ralf Baechle for MIPS.
    
    
    This patch:
    
    introduce asm-*/8253pit.h, #define PIT_TICK_RATE constant.
    80c44e42
time.c 16.5 KB