From 5e54adc8f53df4b8c8e8b802049964b2054ad829 Mon Sep 17 00:00:00 2001 Message-Id: <5e54adc8f53df4b8c8e8b802049964b2054ad829.1399625721.git.hahn@xxxxxxxxxxxxx> From: Philipp Hahn Date: Fri, 9 May 2014 10:53:57 +0200 Subject: [PATCH] hw/dma: Print error message only once Organization: Univention GmbH, Bremen, Germany To: qemu-devel@xxxxxxxxxx otherwise the message dma: unregistered DMA channel used nchan=0 dma_pos=0 dma_len=1 gets printed every time and fills up the log-file with 50 MiB / minute. Signed-off-by: Philipp Hahn --- hw/dma/i8257.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index 4490372..cd710a9 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -473,8 +473,14 @@ static void dma_reset(void *opaque) static int dma_phony_handler (void *opaque, int nchan, int dma_pos, int dma_len) { - dolog ("unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d\n", - nchan, dma_pos, dma_len); + static int once = 0; + int mask = 1 << nchan; + + if (0 == (once & mask)) { + once |= mask; + dolog ("unregistered DMA channel used nchan=%d dma_pos=%d dma_len=%d\n", + nchan, dma_pos, dma_len); + } return dma_pos; } -- 1.9.1