From patchwork Fri Aug 6 14:11:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Renninger X-Patchwork-Id: 117815 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o76EBjdY002212 for ; Fri, 6 Aug 2010 14:11:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756881Ab0HFOLo (ORCPT ); Fri, 6 Aug 2010 10:11:44 -0400 Received: from cantor.suse.de ([195.135.220.2]:55013 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756861Ab0HFOLo (ORCPT ); Fri, 6 Aug 2010 10:11:44 -0400 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 4E5D994109; Fri, 6 Aug 2010 16:11:43 +0200 (CEST) From: Thomas Renninger To: penberg@cs.helsinki.fi, jbaron@redhat.com, greg@kroah.com Cc: trenn@suse.de, linux-acpi@vger.kernel.org, greg@kroah.com Subject: [PATCH 3/4] Dynamic Debug: Initialize dynamic debug earlier via arch_initcall Date: Fri, 6 Aug 2010 16:11:03 +0200 Message-Id: <1281103864-18860-4-git-send-email-trenn@suse.de> X-Mailer: git-send-email 1.6.3 In-Reply-To: <1281103864-18860-1-git-send-email-trenn@suse.de> References: <1281103864-18860-1-git-send-email-trenn@suse.de> 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 (demeter.kernel.org [140.211.167.41]); Fri, 06 Aug 2010 14:11:45 +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);