diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2011-07-07 03:28:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-07-08 17:55:09 -0400 |
commit | 8dec92b24064f1ffbb6537ba97729b633b400c28 (patch) | |
tree | fc1c0e88de41ef6fd29df8e068431eb67a080768 /drivers/usb/mon | |
parent | 004c19682884d4f40000ce1ded53f4a1d0b18206 (diff) |
USB: mon: Allow to use usbmon without debugfs
Do not bail out with an error in mon_text_init() if debugfs is not
available, instead just return 0 and let mon_init() go ahead with
loading the binary API. Return -ENOMEM in case debugfs_create_dir()
fails for other reasons. Later, it is enough to check for mon_dir
not set.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/mon')
-rw-r--r-- | drivers/usb/mon/mon_text.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index c302e1983c7..1c3afcc11bd 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c | |||
@@ -670,6 +670,9 @@ int mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus) | |||
670 | int busnum = ubus? ubus->busnum: 0; | 670 | int busnum = ubus? ubus->busnum: 0; |
671 | int rc; | 671 | int rc; |
672 | 672 | ||
673 | if (mon_dir == NULL) | ||
674 | return 0; | ||
675 | |||
673 | if (ubus != NULL) { | 676 | if (ubus != NULL) { |
674 | rc = snprintf(name, NAMESZ, "%dt", busnum); | 677 | rc = snprintf(name, NAMESZ, "%dt", busnum); |
675 | if (rc <= 0 || rc >= NAMESZ) | 678 | if (rc <= 0 || rc >= NAMESZ) |
@@ -740,12 +743,12 @@ int __init mon_text_init(void) | |||
740 | 743 | ||
741 | mondir = debugfs_create_dir("usbmon", usb_debug_root); | 744 | mondir = debugfs_create_dir("usbmon", usb_debug_root); |
742 | if (IS_ERR(mondir)) { | 745 | if (IS_ERR(mondir)) { |
743 | printk(KERN_NOTICE TAG ": debugfs is not available\n"); | 746 | /* debugfs not available, but we can use usbmon without it */ |
744 | return -ENODEV; | 747 | return 0; |
745 | } | 748 | } |
746 | if (mondir == NULL) { | 749 | if (mondir == NULL) { |
747 | printk(KERN_NOTICE TAG ": unable to create usbmon directory\n"); | 750 | printk(KERN_NOTICE TAG ": unable to create usbmon directory\n"); |
748 | return -ENODEV; | 751 | return -ENOMEM; |
749 | } | 752 | } |
750 | mon_dir = mondir; | 753 | mon_dir = mondir; |
751 | return 0; | 754 | return 0; |