linux/drivers/char
Clemens Ladisch 96e9694df4 hpet: fix unwanted interrupt due to stale irq status bit
Jaswinder Singh Rajput wrote:
> By executing Documentation/timers/hpet_example.c
>
> for polling, I requested for 3 iterations but it seems iteration work
> for only 2 as first expired time is always very small.
>
> # ./hpet_example poll /dev/hpet 10 3
> -hpet: executing poll
> hpet_poll: info.hi_flags 0x0
> hpet_poll: expired time = 0x13
> hpet_poll: revents = 0x1
> hpet_poll: data 0x1
> hpet_poll: expired time = 0x1868c
> hpet_poll: revents = 0x1
> hpet_poll: data 0x1
> hpet_poll: expired time = 0x18645
> hpet_poll: revents = 0x1
> hpet_poll: data 0x1

Clearing the HPET interrupt enable bit disables interrupt generation
but does not disable the timer, so the interrupt status bit will still
be set when the timer elapses.  If another interrupt arrives before
the timer has been correctly programmed (due to some other device on
the same interrupt line, or CONFIG_DEBUG_SHIRQ), this results in an
extra unwanted interrupt event because the status bit is likely to be
set from comparator matches that happened before the device was opened.

Therefore, we have to ensure that the interrupt status bit is and
stays cleared until we actually program the timer.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Reported-by: Jaswinder Singh Rajput <jaswinderlinux@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Bob Picco <bpicco@redhat.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-10-26 16:52:11 -07:00
..
agp Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-10-24 13:41:39 -07:00
hw_random llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
ip2 Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6 2010-10-22 19:59:04 -07:00
ipmi ipmi: proper spinlock initialization 2010-10-26 16:52:04 -07:00
mwave Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
pcmcia Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-10-24 13:41:39 -07:00
rio Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
tpm Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-10-24 13:41:39 -07:00
xilinx_hwicap Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
.gitignore
Kconfig add ttyprintk driver 2010-10-22 10:20:02 -07:00
Makefile add ttyprintk driver 2010-10-22 10:20:02 -07:00
amiserial.c tty: icount changeover for other main devices 2010-10-22 10:20:05 -07:00
apm-emulation.c Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-10-24 13:41:39 -07:00
applicom.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
applicom.h
bfin-otp.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
bfin_jtag_comm.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
briq_panel.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
bsr.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
cd1865.h
consolemap.c
cp437.uni
cs5535_gpio.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
cyclades.c tty: icount changeover for other main devices 2010-10-22 10:20:05 -07:00
defkeymap.c_shipped
defkeymap.map
digi1.h
digiFep1.h
digiPCI.h
ds1302.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
ds1620.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
dsp56k.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
dtlk.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
efirtc.c efirtc: explicitly set llseek to no_llseek 2009-12-16 07:19:59 -08:00
epca.c epca: Kill the big kernel lock 2010-08-10 13:47:40 -07:00
epca.h
epcaconfig.h
generic_nvram.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
generic_serial.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
genrtc.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
hangcheck-timer.c Input: sysrq - drop tty argument form handle_sysrq() 2010-08-21 00:34:45 -07:00
hpet.c hpet: fix unwanted interrupt due to stale irq status bit 2010-10-26 16:52:11 -07:00
hvc_beat.c Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6 2010-02-25 15:38:37 -08:00
hvc_console.c Input: sysrq - drop tty argument form handle_sysrq() 2010-08-21 00:34:45 -07:00
hvc_console.h hvc_console: make the ops pointer const. 2010-02-24 14:22:32 +10:30
hvc_irq.c
hvc_iseries.c Merge branch 'for-next' into for-linus 2010-03-08 16:55:37 +01:00
hvc_iucv.c [S390] hvc_iucv: do not call iucv_unregister if iucv_register failed 2010-10-25 16:10:17 +02:00
hvc_rtas.c hvc_console: make the ops pointer const. 2010-02-24 14:22:32 +10:30
hvc_tile.c arch/tile: catch up on various minor cleanups. 2010-07-06 13:42:15 -04:00
hvc_udbg.c hvc_console: make the ops pointer const. 2010-02-24 14:22:32 +10:30
hvc_vio.c hvc_console: make the ops pointer const. 2010-02-24 14:22:32 +10:30
hvc_xen.c hvc_console: make the ops pointer const. 2010-02-24 14:22:32 +10:30
hvcs.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
hvsi.c Input: sysrq - drop tty argument form handle_sysrq() 2010-08-21 00:34:45 -07:00
i8k.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
isicom.c isicom: kill off the BKL 2010-08-10 13:47:40 -07:00
istallion.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
keyboard.c Input: add support for large scancodes 2010-09-09 22:00:50 -07:00
lp.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
mbcs.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
mbcs.h
mem.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
misc.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
mmtimer.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
moxa.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
moxa.h
mspec.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
mxser.c tty: icount changeover for other main devices 2010-10-22 10:20:05 -07:00
mxser.h
n_gsm.c drivers/char/n_gsm.c: add missing spin_unlock_irqrestore 2010-08-11 08:59:20 -07:00
n_hdlc.c tty: replace BKL with a new tty_lock 2010-08-10 13:47:43 -07:00
n_r3964.c Update broken web addresses in the kernel. 2010-10-18 11:03:14 +02:00
n_tty.c tty: Add EXTPROC support for LINEMODE 2010-08-10 13:47:39 -07:00
nozomi.c tty: icount changeover for other main devices 2010-10-22 10:20:05 -07:00
nsc_gpio.c
nvram.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
nwbutton.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
nwbutton.h
nwflash.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
pc8736x_gpio.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
ppdev.c drivers: autoconvert trivial BKL users to private mutex 2010-10-05 15:01:04 +02:00
ps3flash.c drop unused dentry argument to ->fsync 2010-05-27 22:05:02 -04:00
pty.c tty: Remove __GFP_NOFAIL from tty_add_file() 2010-10-22 10:19:58 -07:00
ramoops.c char drivers: RAM oops/panic logger 2010-05-27 09:12:50 -07:00
random.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
raw.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
riscom8.c riscom8: kill use of lock_kernel 2010-08-10 13:47:40 -07:00
riscom8.h
riscom8_reg.h
rocket.c rocket: add a mutex_unlock() 2010-08-23 18:17:21 -07:00
rocket.h
rocket_int.h
rtc.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
scc.h
scx200_gpio.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
selection.c tty: remove tty_lock_nested 2010-08-10 13:47:44 -07:00
ser_a2232.c headers: remove sched.h from interrupt.h 2009-10-11 11:20:58 -07:00
ser_a2232.h
ser_a2232fw.ax
ser_a2232fw.h
serial167.c tty: release BTM while sleeping in block_til_ready 2010-08-10 13:47:44 -07:00
snsc.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
snsc.h
snsc_event.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
sonypi.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
specialix.c tty: release BTM while sleeping in block_til_ready 2010-08-10 13:47:44 -07:00
specialix_io8.h
stallion.c Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2010-10-24 13:41:39 -07:00
sx.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
sx.h
sxboards.h
sxwindow.h
synclink.c tty: icount changeover for other main devices 2010-10-22 10:20:05 -07:00
synclink_gt.c tty: icount changeover for other main devices 2010-10-22 10:20:05 -07:00
synclinkmp.c tty: icount changeover for other main devices 2010-10-22 10:20:05 -07:00
sysrq.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2010-10-25 07:59:01 -07:00
tb0219.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
tlclk.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
toshiba.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
tty_audit.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
tty_buffer.c tty: fix obsolete comment on tty_insert_flip_string_fixed_flag 2010-05-21 09:34:30 -07:00
tty_io.c tty: Make tiocgicount a handler 2010-10-22 10:20:04 -07:00
tty_ioctl.c tty: Add EXTPROC support for LINEMODE 2010-08-10 13:47:39 -07:00
tty_ldisc.c tty: remove tty_lock_nested 2010-08-10 13:47:44 -07:00
tty_mutex.c tty: implement BTM as mutex instead of BKL 2010-08-10 13:47:44 -07:00
tty_port.c tty: release BTM while sleeping in block_til_ready 2010-08-10 13:47:44 -07:00
ttyprintk.c add ttyprintk driver 2010-10-22 10:20:02 -07:00
uv_mmtimer.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
vc_screen.c vcs: invoke the vt update callback when /dev/vcs* is written to 2010-10-22 10:20:06 -07:00
viotape.c Merge branch 'llseek' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/bkl 2010-10-22 10:52:56 -07:00
virtio_console.c virtio: console: Disable lseek(2) for port file operations 2010-10-21 17:44:04 +10:30
vme_scc.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
vt.c vcs: invoke the vt update callback when /dev/vcs* is written to 2010-10-22 10:20:06 -07:00
vt_ioctl.c Input: use PIT_TICK_RATE in vt beep ioctl 2010-08-28 21:39:09 -07:00