PCI: pciehp: Replace pciehp_debug module param with dyndbg

Previously pciehp debug messages were enabled by the pciehp_debug module
parameter, e.g., by booting with this kernel command line option:

  pciehp.pciehp_debug=1

Convert this mechanism to use the generic dynamic debug (dyndbg) feature.
After this commit, pciehp debug messages are enabled by building the kernel
with CONFIG_DYNAMIC_DEBUG=y and booting with this command line option:

  dyndbg="file pciehp* +p"

The dyndbg facility is much more flexible: messages can be enabled at boot-
or run-time based on the file name, function name, line number, message
test, etc.  See Documentation/admin-guide/dynamic-debug-howto.rst for more
details.

Link: https://lore.kernel.org/lkml/20190509141456.223614-7-helgaas@kernel.org
Signed-off-by: Frederick Lawler <fred@fredlawl.com>
[bhelgaas: commit log, comment, remove pciehp_debug parameter]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
This commit is contained in:
Frederick Lawler 2019-05-07 18:24:52 -05:00 committed by Bjorn Helgaas
parent 7e696b8ae9
commit 017124725c
2 changed files with 6 additions and 13 deletions

View File

@ -29,13 +29,13 @@
extern bool pciehp_poll_mode; extern bool pciehp_poll_mode;
extern int pciehp_poll_time; extern int pciehp_poll_time;
extern bool pciehp_debug;
/*
* Set CONFIG_DYNAMIC_DEBUG=y and boot with 'dyndbg="file pciehp* +p"' to
* enable debug messages.
*/
#define dbg(format, arg...) \ #define dbg(format, arg...) \
do { \ pr_debug("%s: " format, MY_NAME, ## arg);
if (pciehp_debug) \
printk(KERN_DEBUG "%s: " format, MY_NAME, ## arg); \
} while (0)
#define err(format, arg...) \ #define err(format, arg...) \
printk(KERN_ERR "%s: " format, MY_NAME, ## arg) printk(KERN_ERR "%s: " format, MY_NAME, ## arg)
#define info(format, arg...) \ #define info(format, arg...) \
@ -44,11 +44,7 @@ do { \
printk(KERN_WARNING "%s: " format, MY_NAME, ## arg) printk(KERN_WARNING "%s: " format, MY_NAME, ## arg)
#define ctrl_dbg(ctrl, format, arg...) \ #define ctrl_dbg(ctrl, format, arg...) \
do { \ dev_dbg(&ctrl->pcie->device, format, ## arg)
if (pciehp_debug) \
dev_printk(KERN_DEBUG, &ctrl->pcie->device, \
format, ## arg); \
} while (0)
#define ctrl_err(ctrl, format, arg...) \ #define ctrl_err(ctrl, format, arg...) \
dev_err(&ctrl->pcie->device, format, ## arg) dev_err(&ctrl->pcie->device, format, ## arg)
#define ctrl_info(ctrl, format, arg...) \ #define ctrl_info(ctrl, format, arg...) \

View File

@ -27,7 +27,6 @@
#include "../pci.h" #include "../pci.h"
/* Global variables */ /* Global variables */
bool pciehp_debug;
bool pciehp_poll_mode; bool pciehp_poll_mode;
int pciehp_poll_time; int pciehp_poll_time;
@ -35,10 +34,8 @@ int pciehp_poll_time;
* not really modular, but the easiest way to keep compat with existing * not really modular, but the easiest way to keep compat with existing
* bootargs behaviour is to continue using module_param here. * bootargs behaviour is to continue using module_param here.
*/ */
module_param(pciehp_debug, bool, 0644);
module_param(pciehp_poll_mode, bool, 0644); module_param(pciehp_poll_mode, bool, 0644);
module_param(pciehp_poll_time, int, 0644); module_param(pciehp_poll_time, int, 0644);
MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not");
MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not"); MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not");
MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds"); MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds");