From patchwork Fri Oct 22 18:24:48 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 275301 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9MIXDYk004182 for ; Fri, 22 Oct 2010 18:33:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758904Ab0JVSZW (ORCPT ); Fri, 22 Oct 2010 14:25:22 -0400 Received: from kroah.org ([198.145.64.141]:37755 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758901Ab0JVSZU (ORCPT ); Fri, 22 Oct 2010 14:25:20 -0400 Received: from localhost (c-24-16-163-131.hsd1.wa.comcast.net [24.16.163.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by coco.kroah.org (Postfix) with ESMTPSA id 11836484C7; Fri, 22 Oct 2010 11:25:20 -0700 (PDT) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Thomas Renninger , linux-acpi@vger.kernel.org, Greg Kroah-Hartman Subject: [PATCH 03/31] Dynamic Debug: Initialize dynamic debug earlier via arch_initcall Date: Fri, 22 Oct 2010 11:24:48 -0700 Message-Id: <1287771916-15016-3-git-send-email-gregkh@suse.de> X-Mailer: git-send-email 1.7.1 In-Reply-To: <20101022175107.GB13489@kroah.com> References: <20101022175107.GB13489@kroah.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 22 Oct 2010 18:33:39 +0000 (UTC) diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 44ce66b..a687d90 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -748,13 +748,14 @@ static void ddebug_remove_all_tables(void) mutex_unlock(&ddebug_lock); } -static int __init dynamic_debug_init(void) +static __initdata int ddebug_init_success; + +static int __init dynamic_debug_init_debugfs(void) { struct dentry *dir, *file; - struct _ddebug *iter, *iter_start; - const char *modname = NULL; - int ret = 0; - int n = 0; + + if (!ddebug_init_success) + return -ENODEV; dir = debugfs_create_dir("dynamic_debug", NULL); if (!dir) @@ -765,6 +766,16 @@ static int __init dynamic_debug_init(void) debugfs_remove(dir); return -ENOMEM; } + return 0; +} + +static int __init dynamic_debug_init(void) +{ + struct _ddebug *iter, *iter_start; + const char *modname = NULL; + int ret = 0; + int n = 0; + if (__start___verbose != __stop___verbose) { iter = __start___verbose; modname = iter->modname; @@ -795,11 +806,13 @@ static int __init dynamic_debug_init(void) } out_free: - if (ret) { + if (ret) ddebug_remove_all_tables(); - debugfs_remove(dir); - debugfs_remove(file); - } + else + ddebug_init_success = 1; return 0; } -module_init(dynamic_debug_init); +/* Allow early initialization for boot messages via boot param */ +arch_initcall(dynamic_debug_init); +/* Debugfs setup must be done later */ +module_init(dynamic_debug_init_debugfs);