[PATCH 3/4] PNP: Use dev_dbg instead of dev_printk(KERN_DEBUG.. if DYNAMIC_DEBUG is compiled in

From: Thomas Renninger
Date: Fri Sep 24 2010 - 08:29:08 EST


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: Thomas Renninger <trenn@xxxxxxx>
CC: Bjorn Helgaas <bjorn.helgaas@xxxxxx>
CC: Jason Baron <jbaron@xxxxxxxxxx>
CC: Greg KH <gregkh@xxxxxxx>
CC: lkml <linux-kernel@xxxxxxxxxxxxxxx>
---
drivers/pnp/base.h | 8 ++++++--
drivers/pnp/core.c | 16 +++++++++++++++-
2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index 0bab84e..1f7f9bd 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -170,12 +170,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 88b3cde..fe834ac 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -215,9 +215,21 @@ static int __init pnp_init(void)

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)
+
+int pnp_debug;
+
static int __init pnp_debug_setup(char *__unused)
{
pnp_debug = 1;
@@ -225,3 +237,5 @@ static int __init pnp_debug_setup(char *__unused)
}
__setup("pnp.debug", pnp_debug_setup);
#endif
+
+#endif
--
1.6.4.2

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