Skip to content

Commit 3f16ba1

Browse files
t-8chbentiss
authored andcommitted
HID: use standard debug APIs
The custom "debug" module parameter is fairly inflexible. It can only manage debugging for all calls dbg_hid() at the same time. Furthermore it creates a mismatch between calls to hid_dbg() which can be managed by CONFIG_DYNAMIC_DEBUG and dbg_hid() which is managed by the module parameter. Furthermore the change to pr_debug() allows the debugging statements to be completely compiled-out if desired. Signed-off-by: Thomas Weißschuh <[email protected]> Tested-by: Bastien Nocera <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
1 parent ff17bb8 commit 3f16ba1

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

drivers/hid/hid-core.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@
4141

4242
#define DRIVER_DESC "HID core driver"
4343

44-
int hid_debug = 0;
45-
module_param_named(debug, hid_debug, int, 0600);
46-
MODULE_PARM_DESC(debug, "toggle HID debugging messages");
47-
EXPORT_SYMBOL_GPL(hid_debug);
48-
4944
static int hid_ignore_special_drivers = 0;
5045
module_param_named(ignore_special_drivers, hid_ignore_special_drivers, int, 0600);
5146
MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle all devices by generic driver");
@@ -2910,10 +2905,6 @@ static int __init hid_init(void)
29102905
{
29112906
int ret;
29122907

2913-
if (hid_debug)
2914-
pr_warn("hid_debug is now used solely for parser and driver debugging.\n"
2915-
"debugfs is now used for inspecting the device (report descriptor, reports)\n");
2916-
29172908
ret = bus_register(&hid_bus_type);
29182909
if (ret) {
29192910
pr_err("can't register hid bus\n");

include/linux/hid.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -870,8 +870,6 @@ extern bool hid_is_usb(const struct hid_device *hdev);
870870

871871
/* HID core API */
872872

873-
extern int hid_debug;
874-
875873
extern bool hid_ignore(struct hid_device *);
876874
extern int hid_add_device(struct hid_device *);
877875
extern void hid_destroy_device(struct hid_device *);
@@ -1179,11 +1177,7 @@ int hid_pidff_init(struct hid_device *hid);
11791177
#define hid_pidff_init NULL
11801178
#endif
11811179

1182-
#define dbg_hid(fmt, ...) \
1183-
do { \
1184-
if (hid_debug) \
1185-
printk(KERN_DEBUG "%s: " fmt, __FILE__, ##__VA_ARGS__); \
1186-
} while (0)
1180+
#define dbg_hid(fmt, ...) pr_debug("%s: " fmt, __FILE__, ##__VA_ARGS__)
11871181

11881182
#define hid_err(hid, fmt, ...) \
11891183
dev_err(&(hid)->dev, fmt, ##__VA_ARGS__)

0 commit comments

Comments
 (0)