Received: from eggs.gnu.org ([208.118.235.92]:57866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfqbC-0001ld-S9 for qemu-devel@nongnu.org; Fri, 24 May 2013 07:55:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UfqbB-0006TC-9Y for qemu-devel@nongnu.org; Fri, 24 May 2013 07:55:54 -0400 Message-ID: <519F5545.2070906@suse.de> Date: Fri, 24 May 2013 13:55:49 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1369363654-7063-1-git-send-email-lig.fnst@cn.fujitsu.com> <1369363654-7063-5-git-send-email-lig.fnst@cn.fujitsu.com> In-Reply-To: <1369363654-7063-5-git-send-email-lig.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 4/4] debugcon: use fprintf(stderr...) instead of printf List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liguang Cc: qemu-trivial@nongnu.org, Paolo Bonzini , Anthony Liguori , qemu-devel@nongnu.org, Gerd Hoffmann Am 24.05.2013 04:47, schrieb liguang: > suggested by Andreas F=C3=A4rber >=20 > Signed-off-by: liguang > --- > hw/char/debugcon.c | 5 +++-- > 1 files changed, 3 insertions(+), 2 deletions(-) >=20 > diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c > index 3b0637d..be20ede 100644 > --- a/hw/char/debugcon.c > +++ b/hw/char/debugcon.c > @@ -55,7 +55,8 @@ static void debugcon_ioport_write(void *opaque, hwadd= r addr, uint64_t val, > unsigned char ch =3D val; > =20 > #ifdef DEBUG_DEBUGCON > - printf(" [debugcon: write addr=3D0x%04" HWADDR_PRIx " val=3D0x%02"= PRIx64 "]\n", addr, val); > + fprintf(stderr, " [debugcon: write addr=3D0x%04" HWADDR_PRIx > + " val=3D0x%02" PRIx64 "]\n", addr, val); > #endif > =20 > qemu_chr_fe_write(s->chr, &ch, 1); > @@ -67,7 +68,7 @@ static uint64_t debugcon_ioport_read(void *opaque, hw= addr addr, unsigned width) > DebugconState *s =3D opaque; > =20 > #ifdef DEBUG_DEBUGCON > - printf("debugcon: read addr=3D0x%04" HWADDR_PRIx "\n", addr); > + fprintf(stderr, "debugcon: read addr=3D0x%04" HWADDR_PRIx "\n", ad= dr); > #endif > =20 > return s->readback; >=20 Actually my suggestion was to make this a two-patch series: 1/2 debugcon: Fix debug format specifiers 2/2 debugcon: Separate debug console output from device debug output The former would do both HWADDR_PRIx and PRIx64 in one go and not do a lengthy example or "Oh, that's wrong" in the commit message. The latter would change where/how the debug output is written, without changing to " [...]". Thinking more about this, I think it would be best to turn this into a DPRINTF() macro or so, then the change can be made in one central location and the inline #ifdefs can be dropped. Bonus points if the macro were designed in such a way that even if DEBUG_DEBUGCON is not defined the (f)printfs get tested, to avoid regressions. :) Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg