lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1331766126-11674-9-git-send-email-jim.cromie@gmail.com>
Date:	Wed, 14 Mar 2012 17:02:03 -0600
From:	jim.cromie@...il.com
To:	jbaron@...hat.com, rusty@...tcorp.com.au
Cc:	linux-kernel@...r.kernel.org, Jim Cromie <jim.cromie@...il.com>,
	Thomas Renninger <trenn@...e.de>,
	Bjorn Helgaas <bhelgaas@...gle.com>
Subject: [PATCH 08/11] pnp: if CONFIG_DYNAMIC_DEBUG, use pnp.dyndbg instead of pnp.debug

From: Jim Cromie <jim.cromie@...il.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@...il.com>
CC: Thomas Renninger <trenn@...e.de>
CC: Bjorn Helgaas <bhelgaas@...gle.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 82aa8ba..eb7d6c3 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -2194,12 +2194,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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ