From patchwork Fri Sep 29 03:31:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 114488 Delivered-To: patch@linaro.org Received: by 10.140.104.133 with SMTP id a5csp315670qgf; Thu, 28 Sep 2017 20:31:51 -0700 (PDT) X-Google-Smtp-Source: AOwi7QD+MnSF3pqU5dxZfabqvFhRV+bs7wfL0q5C19Jqx5eNniOTH4HVF49lK+fcdC1HR7YLLXH8 X-Received: by 10.80.148.210 with SMTP id t18mr7784038eda.228.1506655911446; Thu, 28 Sep 2017 20:31:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506655911; cv=none; d=google.com; s=arc-20160816; b=WlGogmSiDe8BXhxFlHpre4gUcSSr8bbis/CyTRCp8mc8bIAkwSI/ls5EsrEfY9UFkH ku/lARmPnxPHsDEw5w8hEYaZSBYvZI1KfgPxGP2RaNugSx02xCmkn6KdusI5MU61ae/e TZ5g3fMLtl/Z+uPahoHMARfGaEOv6lxkxJAFac0Bw5syDjyLHWjjxS5rSRY6uvniMQG0 dyFpljIzQlNYpZ8eczn4Hoh3CpcyTvlS1yUxfH5w/VKLKvVJUrJGpikv0qvc3PpD7iWD bhsKC+YsYny/g8JmsRstafFOfylMkoYTkahhx7YWYm67z60ymc3vdmie5edlZU22T4Vp zUAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :dkim-filter:arc-authentication-results; bh=wh4d87pXXik23izhceanhzy0JWN0Y5F4K9G/aHKTDvM=; b=iUa+C6trifjmjRxKon058Ax73n80qYZd5QGodK1c+nl/2T9hxtG/JGAAYvKh80Fkuz 0OIR8jCOsXmx1orCSH0DBGReWK949KguIjSjh9YBRL0BqAk8wUTf2NZhvZ8qWbw4Yyvq 49E7vx5GJW6YEKDtd+A93d7KyLOrcqmqgYNwKAWlDTcZHYQiTZJL2TduGHnNLp7D61KE Mc0GfsEAP+SDv/sigTb5vopa9GEruK1E2LZx8kKtmcZUXSAJfRwGA+iy0nbHT/4pjpv/ px4HKOW/Yo/sdD2CnbzVnD6xkeIIc3ebRdHoRcglO6n/Y/7cGpkaRhAP5vUM65cR5ONP t52Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=UHvkdZgW; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id q7si2559243edk.133.2017.09.28.20.31.51; Thu, 28 Sep 2017 20:31:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=UHvkdZgW; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 0558BC21DE8; Fri, 29 Sep 2017 03:31:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 9E2DAC21C57; Fri, 29 Sep 2017 03:31:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EA822C21C57; Fri, 29 Sep 2017 03:31:44 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id 12079C21C26 for ; Fri, 29 Sep 2017 03:31:41 +0000 (UTC) Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id v8T3VNl2028414; Fri, 29 Sep 2017 12:31:23 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com v8T3VNl2028414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1506655883; bh=YZOnbj3bgZYz8e1O3mHqhFPV6SMy85WSTH32URLpaXs=; h=From:To:Cc:Subject:Date:From; b=UHvkdZgWLDIzbUGWo0LckXC3YkyfFg5I3xw39Ur3t5iWjm1WeVzVVVdF/+C2ySBwR MNgavaR+CUdf9eAt5BMIucmTi1CUnjwlcmgxGxBZ0TGmW95UzqthOa23v4/Eig9WSG w/QGyGXfMFSLkpu85YiB5tZBVbbkCFb6yeac6cteaYjAlu8RlgnXrxmHPDTvSNXmbe ZaWI1vGQWg6IobD1IekATHKF3FUp9N3EJTqFt9P3EgUP0FJMf1Sg8GDyCYxa8Lu0HG h6MHEYV5dG680dRwyX53OyaswgBYYH0Hvi1lVQMRH7faKNDQpf5nZK9AStjzrtyPO5 1dY0ur+6SUsAQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Fri, 29 Sep 2017 12:31:20 +0900 Message-Id: <1506655880-6615-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Subject: [U-Boot] [PATCH] dm: replace dm_dbg() with pr_debug() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" As we discussed before in ML, dm_dbg() causes undefined reference error if #define DEBUG is added to users, but not drivers/core/util.c We do not need this macro because we can use pr_debug() instead, and it is pretty easy to enable it for the DM core by using ccflags-y. Signed-off-by: Masahiro Yamada --- This depends on my http://patchwork.ozlabs.org/patch/814474/ drivers/core/Kconfig | 6 ++++++ drivers/core/Makefile | 2 ++ drivers/core/device.c | 2 +- drivers/core/lists.c | 15 ++++++++------- drivers/core/root.c | 4 ++-- drivers/core/util.c | 11 ----------- include/dm/util.h | 8 -------- 7 files changed, 19 insertions(+), 29 deletions(-) diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig index 7afef1f..e8ba20c 100644 --- a/drivers/core/Kconfig +++ b/drivers/core/Kconfig @@ -45,6 +45,12 @@ config DM_WARN This will cause dm_warn() to be compiled out - it will do nothing when called. +config DM_DEBUG + bool "Enable debug messages in driver model core" + depends on DM + help + Say Y here if you want to compile in debug messages in DM core. + config DM_DEVICE_REMOVE bool "Support device removal" depends on DM diff --git a/drivers/core/Makefile b/drivers/core/Makefile index 3d68c70..a5039c5 100644 --- a/drivers/core/Makefile +++ b/drivers/core/Makefile @@ -16,3 +16,5 @@ ifndef CONFIG_DM_DEV_READ_INLINE obj-$(CONFIG_OF_CONTROL) += read.o endif obj-$(CONFIG_OF_CONTROL) += of_extra.o ofnode.o read_extra.o + +ccflags-$(CONFIG_DM_DEBUG) += -DDEBUG diff --git a/drivers/core/device.c b/drivers/core/device.c index 5463d1f..de63e53 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -161,7 +161,7 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, } if (parent) - dm_dbg("Bound device %s to %s\n", dev->name, parent->name); + pr_debug("Bound device %s to %s\n", dev->name, parent->name); if (devp) *devp = dev; diff --git a/drivers/core/lists.c b/drivers/core/lists.c index 6067914..6fa5d10 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -139,12 +139,13 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp) if (devp) *devp = NULL; name = ofnode_get_name(node); - dm_dbg("bind node %s\n", name); + pr_debug("bind node %s\n", name); compat_list = ofnode_get_property(node, "compatible", &compat_length); if (!compat_list) { if (compat_length == -FDT_ERR_NOTFOUND) { - dm_dbg("Device '%s' has no compatible string\n", name); + pr_debug("Device '%s' has no compatible string\n", + name); return 0; } @@ -159,8 +160,8 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp) */ for (i = 0; i < compat_length; i += strlen(compat) + 1) { compat = compat_list + i; - dm_dbg(" - attempt to match compatible string '%s'\n", - compat); + pr_debug(" - attempt to match compatible string '%s'\n", + compat); for (entry = driver; entry != driver + n_ents; entry++) { ret = driver_check_compatible(entry->of_match, &id, @@ -171,11 +172,11 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp) if (entry == driver + n_ents) continue; - dm_dbg(" - found match at '%s'\n", entry->name); + pr_debug(" - found match at '%s'\n", entry->name); ret = device_bind_with_driver_data(parent, entry, name, id->data, node, &dev); if (ret == -ENODEV) { - dm_dbg("Driver '%s' refuses to bind\n", entry->name); + pr_debug("Driver '%s' refuses to bind\n", entry->name); continue; } if (ret) { @@ -191,7 +192,7 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp) } if (!found && !result && ret != -ENODEV) - dm_dbg("No match for node '%s'\n", name); + pr_debug("No match for node '%s'\n", name); return result; } diff --git a/drivers/core/root.c b/drivers/core/root.c index 757d109..976e2c4 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -227,7 +227,7 @@ static int dm_scan_fdt_live(struct udevice *parent, !of_find_property(np, "u-boot,dm-pre-reloc", NULL)) continue; if (!of_device_is_available(np)) { - dm_dbg(" - ignoring disabled device\n"); + pr_debug(" - ignoring disabled device\n"); continue; } err = lists_bind_fdt(parent, np_to_ofnode(np), NULL); @@ -270,7 +270,7 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob, !dm_fdt_pre_reloc(blob, offset)) continue; if (!fdtdec_get_is_enabled(blob, offset)) { - dm_dbg(" - ignoring disabled device\n"); + pr_debug(" - ignoring disabled device\n"); continue; } err = lists_bind_fdt(parent, offset_to_ofnode(offset), NULL); diff --git a/drivers/core/util.c b/drivers/core/util.c index 2e232d5..aaaed4e 100644 --- a/drivers/core/util.c +++ b/drivers/core/util.c @@ -20,17 +20,6 @@ void dm_warn(const char *fmt, ...) } #endif -#ifdef DEBUG -void dm_dbg(const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - vprintf(fmt, args); - va_end(args); -} -#endif - int list_count_items(struct list_head *head) { struct list_head *node; diff --git a/include/dm/util.h b/include/dm/util.h index 45529ce..0d4ce8f 100644 --- a/include/dm/util.h +++ b/include/dm/util.h @@ -15,14 +15,6 @@ static inline void dm_warn(const char *fmt, ...) } #endif -#ifdef DEBUG -void dm_dbg(const char *fmt, ...); -#else -static inline void dm_dbg(const char *fmt, ...) -{ -} -#endif - struct list_head; /**