From patchwork Sat Oct 24 20:15:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Christophe Dubois X-Patchwork-Id: 535453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7E57D14131F for ; Sun, 25 Oct 2015 07:16:10 +1100 (AEDT) Received: from localhost ([::1]:45529 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zq5EW-0006up-Ar for incoming@patchwork.ozlabs.org; Sat, 24 Oct 2015 16:16:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zq5E0-0005vk-55 for qemu-devel@nongnu.org; Sat, 24 Oct 2015 16:15:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zq5Dv-0001QN-Lv for qemu-devel@nongnu.org; Sat, 24 Oct 2015 16:15:36 -0400 Received: from zose-mta03.web4all.fr ([185.49.20.44]:58275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zq5Dv-0001QJ-CJ for qemu-devel@nongnu.org; Sat, 24 Oct 2015 16:15:31 -0400 Received: from localhost (localhost [127.0.0.1]) by zose-mta03.web4all.fr (Postfix) with ESMTP id C340D4219F; Sat, 24 Oct 2015 22:15:30 +0200 (CEST) Received: from zose-mta03.web4all.fr ([127.0.0.1]) by localhost (zose-mta03.web4all.fr [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id xCGLhgXUxE_9; Sat, 24 Oct 2015 22:15:30 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zose-mta03.web4all.fr (Postfix) with ESMTP id 690B5421B1; Sat, 24 Oct 2015 22:15:30 +0200 (CEST) X-Virus-Scanned: amavisd-new at zose-mta-03.w4a.fr Received: from zose-mta03.web4all.fr ([127.0.0.1]) by localhost (zose-mta03.web4all.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id JfotEx0MEo66; Sat, 24 Oct 2015 22:15:30 +0200 (CEST) Received: from localhost.localdomain (smm49-1-78-235-240-156.fbx.proxad.net [78.235.240.156]) by zose-mta03.web4all.fr (Postfix) with ESMTPSA id 1A84B4219F; Sat, 24 Oct 2015 22:15:30 +0200 (CEST) From: Jean-Christophe Dubois To: qemu-devel@nongnu.org, peter.maydell@linaro.org, crosthwaite.peter@gmail.com Date: Sat, 24 Oct 2015 22:15:28 +0200 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.49.20.44 Cc: Jean-Christophe Dubois Subject: [Qemu-devel] [PATCH v3 2/8] i.MX: Standardize i.MX GPIO debug X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The goal is to have debug code always compiled during build. We standardize all debug output on the following format: [QOM_TYPE_NAME]reporting_function: debug message We also replace IPRINTF with qemu_log_mask(). The qemu_log_mask() output is following the same format as the above debug. Signed-off-by: Jean-Christophe Dubois Reviewed-by: Peter Crosthwaite --- Changes since v1: * use HWADDR_PRIx for address formating * standardize qemu_log_mask on same model. Changes since v2: * None hw/gpio/imx_gpio.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/hw/gpio/imx_gpio.c b/hw/gpio/imx_gpio.c index d56ffcd..3170585 100644 --- a/hw/gpio/imx_gpio.c +++ b/hw/gpio/imx_gpio.c @@ -29,11 +29,12 @@ typedef enum IMXGPIOLevel { } IMXGPIOLevel; #define DPRINTF(fmt, args...) \ - do { \ - if (DEBUG_IMX_GPIO) { \ - fprintf(stderr, "%s: " fmt , __func__, ##args); \ - } \ - } while (0) + do { \ + if (DEBUG_IMX_GPIO) { \ + fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX_GPIO, \ + __func__, ##args); \ + } \ + } while (0) static const char *imx_gpio_reg_name(uint32_t reg) { @@ -176,19 +177,19 @@ static uint64_t imx_gpio_read(void *opaque, hwaddr offset, unsigned size) if (s->has_edge_sel) { reg_value = s->edge_sel; } else { - qemu_log_mask(LOG_GUEST_ERROR, "%s[%s]: EDGE_SEL register not " + qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: EDGE_SEL register not " "present on this version of GPIO device\n", TYPE_IMX_GPIO, __func__); } break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s[%s]: Bad register at offset %d\n", - TYPE_IMX_GPIO, __func__, (int)offset); + qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%" + HWADDR_PRIx "\n", TYPE_IMX_GPIO, __func__, offset); break; } - DPRINTF("(%s) = 0x%"PRIx32"\n", imx_gpio_reg_name(offset), reg_value); + DPRINTF("(%s) = 0x%" PRIx32 "\n", imx_gpio_reg_name(offset), reg_value); return reg_value; } @@ -198,7 +199,7 @@ static void imx_gpio_write(void *opaque, hwaddr offset, uint64_t value, { IMXGPIOState *s = IMX_GPIO(opaque); - DPRINTF("(%s, value = 0x%"PRIx32")\n", imx_gpio_reg_name(offset), + DPRINTF("(%s, value = 0x%" PRIx32 ")\n", imx_gpio_reg_name(offset), (uint32_t)value); switch (offset) { @@ -238,15 +239,15 @@ static void imx_gpio_write(void *opaque, hwaddr offset, uint64_t value, s->edge_sel = value; imx_gpio_set_all_int_lines(s); } else { - qemu_log_mask(LOG_GUEST_ERROR, "%s[%s]: EDGE_SEL register not " + qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: EDGE_SEL register not " "present on this version of GPIO device\n", TYPE_IMX_GPIO, __func__); } break; default: - qemu_log_mask(LOG_GUEST_ERROR, "%s[%s]: Bad register at offset %d\n", - TYPE_IMX_GPIO, __func__, (int)offset); + qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%" + HWADDR_PRIx "\n", TYPE_IMX_GPIO, __func__, offset); break; }