mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: jim.cromie@gmail.com
To: jbaron@redhat.com
Cc: linux-kernel@vger.kernel.org, Jim Cromie <jim.cromie@gmail.com>,
	Thomas Renninger <trenn@suse.de>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH 12/16] pnp: if CONFIG_DYNAMIC_DEBUG, use pnp.dyndbg instead of pnp.debug
Date: Sun, 25 Mar 2012 17:25:50 -0600	[thread overview]
Message-ID: <1332717954-5775-13-git-send-email-jim.cromie@gmail.com> (raw)
In-Reply-To: <1332717954-5775-1-git-send-email-jim.cromie@gmail.com>

From: Jim Cromie <jim.cromie@gmail.com>

based upon https://lkml.org/lkml/2010/9/15/398

This patch splits control of pnp debug messages for 2 configs:

CONFIG_DYNAMIC_DEBUG:
  use pnp.dyndbg, using pnp.debug will warn
!CONFIG_DYNAMIC_DEBUG:
  use pnp.debug, using pnp.dyndbg will warn

2 separate boot options is perhaps suboptimal, but dyndbg is a 'fake'
parameter, and is special enough that adapting one to another is both
more suboptimal and harder to explain succinctly.

Thomas' original comments, still pertinent:

I wonder whether CONFIG_PNP_DEBUG_MESSAGES can vanish totally with
this or at some time. Only advantage having it is: If you are
restricted and your kernel must not exceed X bytes, you cannot compile
in PNP debug messages only, but you have to compile in all debug
messages.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
CC: Thomas Renninger <trenn@suse.de>
CC: Bjorn Helgaas <bhelgaas@google.com>
---
 Documentation/kernel-parameters.txt |   14 ++++++++------
 drivers/pnp/base.h                  |    8 ++++++--
 drivers/pnp/core.c                  |   12 ++++++++++++
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index f44d4bd..00338a2 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2215,12 +2215,14 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 			Override pmtimer IOPort with a hex value.
 			e.g. pmtmr=0x508
 
-	pnp.debug=1	[PNP]
-			Enable PNP debug messages (depends on the
-			CONFIG_PNP_DEBUG_MESSAGES option).  Change at run-time
-			via /sys/module/pnp/parameters/debug.  We always show
-			current resource usage; turning this on also shows
-			possible settings and some assignment information.
+	pnp.debug=1	[PNP] Enable PNP debug messages
+		        (depends on CONFIG_PNP_DEBUG_MESSAGES and
+			!CONFIG_DYNAMIC_DEBUG options.  If latter, use
+			pnp.dyndbg instead).  Change at run-time via
+			/sys/module/pnp/parameters/debug.  We always
+			show current resource usage; turning this on
+			also shows possible settings and some
+			assignment information.
 
 	pnpacpi=	[ACPI]
 			{ off }
diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index fa4e0a5..28e98aa 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -173,12 +173,16 @@ struct pnp_resource *pnp_add_bus_resource(struct pnp_dev *dev,
 					  resource_size_t start,
 					  resource_size_t end);
 
-extern int pnp_debug;
-
+#if defined(CONFIG_DYNAMIC_DEBUG)
+#define pnp_dbg(dev, format, arg...)					\
+	({ dev_dbg(dev, format, ## arg); 0; })
+#else
 #if defined(CONFIG_PNP_DEBUG_MESSAGES)
+extern int pnp_debug;
 #define pnp_dbg(dev, format, arg...)					\
 	({ if (pnp_debug) dev_printk(KERN_DEBUG, dev, format, ## arg); 0; })
 #else
 #define pnp_dbg(dev, format, arg...)					\
 	({ if (0) dev_printk(KERN_DEBUG, dev, format, ## arg); 0; })
 #endif
+#endif
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index cb6ce42..838d82c 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -219,6 +219,18 @@ subsys_initcall(pnp_init);
 
 int pnp_debug;
 
+#if defined(CONFIG_DYNAMIC_DEBUG)
+static int __init pnp_debug_setup(char *__unused)
+{
+	pr_info("DYNAMIC_DEBUG enabled, use pnp.dyndbg instead\n");
+	return 1;
+}
+__setup("pnp.debug", pnp_debug_setup);
+
+#else
+
 #if defined(CONFIG_PNP_DEBUG_MESSAGES)
 module_param_named(debug, pnp_debug, int, 0644);
 #endif
+
+#endif
-- 
1.7.7.6


  parent reply	other threads:[~2012-03-25 23:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-25 23:25 [00/16] enable pr_debug during module initialization jim.cromie
2012-03-25 23:25 ` [PATCH 01/16] init: trivial tweaks to initcall_levels jim.cromie
2012-03-25 23:25 ` [PATCH 02/16] dynamic_debug: fix leading spaces jim.cromie
2012-03-25 23:25 ` [PATCH 03/16] dynamic_debug: replace if (verbose) pr_info with macro vpr_info jim.cromie
2012-03-25 23:25 ` [PATCH 04/16] dynamic_debug: change ddebug_query core param to dyndbg jim.cromie
2012-03-25 23:25 ` [PATCH 05/16] params: add param-name to parse_one's pr_debug() jim.cromie
2012-03-25 23:25 ` [PATCH 06/16] params: add 3rd arg to option handler callback signature jim.cromie
2012-03-25 23:25 ` [PATCH 07/16] dynamic_debug: make dynamic-debug work for module initialization jim.cromie
2012-03-25 23:25 ` [PATCH 08/16] dynamic_debug: deprecate ddebug_query, suggest dyndbg instead jim.cromie
2012-03-25 23:25 ` [PATCH 09/16] dynamic_debug: combine parse_args callbacks together jim.cromie
2012-03-25 23:25 ` [PATCH 10/16] dynamic_debug: simplify dynamic_debug_init error exit jim.cromie
2012-03-25 23:25 ` [PATCH 11/16] dynamic_debug: print ram usage by ddebug tables if verbose jim.cromie
2012-03-25 23:25 ` jim.cromie [this message]
2012-03-25 23:25 ` [PATCH 13/16] dynamic_debug: add modname arg to exec_query callchain jim.cromie
2012-03-25 23:25 ` [PATCH 14/16] dynamic_debug: update Documentation/*, Kconfig.debug jim.cromie
2012-03-25 23:25 ` [PATCH 15/16] dynamic_debug: init with early_initcall, not arch_initcall jim.cromie
2012-03-25 23:25 ` [PATCH 16/16] dynamic_debug: drop deprecated ddebug_query param, code jim.cromie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332717954-5775-13-git-send-email-jim.cromie@gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=trenn@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome