lkml.org 
[lkml]   [2011]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 19/25] pnp: if CONFIG_DYNAMIC_DEBUG, use pnp.ddebug instead of pnp.debug
Date
From: Jim Cromie <jim.cromie@gmail.com>

resubmit of https://lkml.org/lkml/2010/9/15/398

This allows usage of generic pnp.ddebug debug parameter instead of
pnp.debug PNP specific parameter.

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>
---
drivers/pnp/base.h | 8 ++++++--
drivers/pnp/core.c | 13 +++++++++++++
2 files changed, 19 insertions(+), 2 deletions(-)
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..332010a 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -219,6 +219,19 @@ subsys_initcall(pnp_init);

int pnp_debug;

+#if defined(CONFIG_DYNAMIC_DEBUG)
+static int __init pnp_debug_setup(char *__unused)
+{
+ printk(KERN_INFO "DYNAMIC_DEBUG enabled use pnp.ddebug instead of "
+ "pnp.debug boot param\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.3


\
 
 \ /
  Last update: 2011-11-30 21:07    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site