Skip to content

Commit 97ef062

Browse files
Bjorn Helgaaslenb
authored andcommitted
PNP: add CONFIG_PNP_DEBUG_MESSAGES and pnp_dbg()
This adds the core function pnp_dbg() and a new config option to enable it. The PNP core debugging messages can be enabled at boot-time with the "pnp.debug" kernel parameter. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 2663f60 commit 97ef062

4 files changed

Lines changed: 39 additions & 0 deletions

File tree

‎Documentation/kernel-parameters.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,10 @@ and is between 256 and 4096 characters. It is defined in the file
16601660
Override pmtimer IOPort with a hex value.
16611661
e.g. pmtmr=0x508
16621662

1663+
pnp.debug [PNP]
1664+
Enable PNP debug messages. This depends on the
1665+
CONFIG_PNP_DEBUG_MESSAGES option.
1666+
16631667
pnpacpi= [ACPI]
16641668
{ off }
16651669

‎drivers/pnp/Kconfig‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ menuconfig PNP
2020

2121
If unsure, say Y.
2222

23+
config PNP_DEBUG_MESSAGES
24+
default y
25+
bool "PNP debugging messages"
26+
depends on PNP
27+
help
28+
Say Y here if you want the PNP layer to be able to produce debugging
29+
messages if needed. The messages can be enabled at boot-time with
30+
the pnp.debug kernel parameter.
31+
32+
This option allows you to save a bit of space if you do not want
33+
the messages to even be built into the kernel.
34+
35+
If you have any doubts about this, say Y here.
36+
2337
if PNP
2438

2539
config PNP_DEBUG

‎drivers/pnp/base.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,13 @@ struct pnp_resource *pnp_add_io_resource(struct pnp_dev *dev,
166166
struct pnp_resource *pnp_add_mem_resource(struct pnp_dev *dev,
167167
resource_size_t start,
168168
resource_size_t end, int flags);
169+
170+
extern int pnp_debug;
171+
172+
#if defined(CONFIG_PNP_DEBUG_MESSAGES)
173+
#define pnp_dbg(dev, format, arg...) \
174+
({ if (pnp_debug) dev_printk(KERN_DEBUG, dev, format, ## arg); 0; })
175+
#else
176+
#define pnp_dbg(dev, format, arg...) \
177+
({ if (0) dev_printk(KERN_DEBUG, dev, format, ## arg); 0; })
178+
#endif

‎drivers/pnp/core.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,14 @@ static int __init pnp_init(void)
221221
}
222222

223223
subsys_initcall(pnp_init);
224+
225+
int pnp_debug;
226+
227+
#if defined(CONFIG_PNP_DEBUG_MESSAGES)
228+
static int __init pnp_debug_setup(char *__unused)
229+
{
230+
pnp_debug = 1;
231+
return 1;
232+
}
233+
__setup("pnp.debug", pnp_debug_setup);
234+
#endif

0 commit comments

Comments
 (0)