From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42586 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ov83l-0000aO-0o for qemu-devel@nongnu.org; Mon, 13 Sep 2010 08:23:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ov83j-0001ZA-Jb for qemu-devel@nongnu.org; Mon, 13 Sep 2010 08:22:56 -0400 Received: from mail-fx0-f45.google.com ([209.85.161.45]:59666) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ov83j-0001Yy-F0 for qemu-devel@nongnu.org; Mon, 13 Sep 2010 08:22:55 -0400 Received: by fxm7 with SMTP id 7so3351209fxm.4 for ; Mon, 13 Sep 2010 05:22:54 -0700 (PDT) Date: Mon, 13 Sep 2010 14:07:59 +0200 From: "Edgar E. Iglesias" Subject: Re: [Qemu-devel] [PATCH] Introduce DPRINTF() macro and convert serial printf() calls to DPRINTF()'s Message-ID: <20100913120759.GA28319@edde.se.axis.com> References: <4C8E0883.3060405@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C8E0883.3060405@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michal Novotny Cc: "qemu-devel@nongnu.org" On Mon, Sep 13, 2010 at 01:18:27PM +0200, Michal Novotny wrote: > Hi, > this is the patch to introduce DPRINTF() macro as used in the rest of the > qemu source files for printing debug messages when the debugging macro is > set (i.e. the debugging is enabled) - e.g. as used in LSI SCSI controller > implementation. Hi, This patch seems to be corrupt, can you please resubmit with git send-email? Thanks, Edgar > > Signed-off-by: Michal Novotny > --- > diff --git a/hw/serial.c b/hw/serial.c > index b66d13a..49431b2 100644 > --- a/hw/serial.c > +++ b/hw/serial.c > @@ -99,6 +99,14 @@ > #define RECV_FIFO 1 > #define MAX_XMIT_RETRY 4 > > +#ifdef DEBUG_SERIAL > +#define DPRINTF(fmt, ...) \ > +do { fprintf(stderr, "serial: " fmt , ## __VA_ARGS__); } while (0); > +#else > +#define DPRINTF(fmt, ...) \ > +do {} while(0); > +#endif > + > typedef struct SerialFIFO { > uint8_t data[UART_FIFO_LENGTH]; > uint8_t count; > @@ -267,10 +275,9 @@ static void serial_update_parameters(SerialState *s) > ssp.stop_bits = stop_bits; > s->char_transmit_time = (get_ticks_per_sec() / speed) * frame_size; > qemu_chr_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp); > -#if 0 > - printf("speed=%d parity=%c data=%d stop=%d\n", > + > + DPRINTF("speed=%d parity=%c data=%d stop=%d\n", > speed, parity, data_bits, stop_bits); > -#endif > } > > static void serial_update_msl(SerialState *s) > @@ -360,9 +367,7 @@ static void serial_ioport_write(void *opaque, > uint32_t addr, uint32_t val) > SerialState *s = opaque; > > addr &= 7; > -#ifdef DEBUG_SERIAL > - printf("serial: write addr=0x%02x val=0x%02x\n", addr, val); > -#endif > + DPRINTF("write addr=0x%02x val=0x%02x\n", addr, val); > switch(addr) { > default: > case 0: > @@ -583,9 +588,7 @@ static uint32_t serial_ioport_read(void *opaque, > uint32_t addr) > ret = s->scr; > break; > } > -#ifdef DEBUG_SERIAL > - printf("serial: read addr=0x%02x val=0x%02x\n", addr, ret); > -#endif > + DPRINTF("read addr=0x%02x val=0x%02x\n", addr, ret); > return ret; > } > > @@ -651,9 +654,7 @@ static void serial_receive1(void *opaque, const > uint8_t *buf, int size) > static void serial_event(void *opaque, int event) > { > SerialState *s = opaque; > -#ifdef DEBUG_SERIAL > - printf("serial: event %x\n", event); > -#endif > + DPRINTF("event %x\n", event); > if (event == CHR_EVENT_BREAK) > serial_receive_break(s); > } > > -- > Michal Novotny, RHCE > Virtualization Team (xen userspace), Red Hat > >