[PATCH] USB: mon: Allow to use usbmon without debugfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Do not bail out in mon_init() if debugfs is not available, instead just
print the warning but go ahead loading the binary API.

In mon_text_add() we need to properly return in case debugfs is not
available (mon_dir = NULL) so the mbus->text_inited member is properly
set.

Signed-off-by: Tobias Klauser <tklauser@xxxxxxxxxx>
---
 drivers/usb/mon/mon_main.c |    5 ++---
 drivers/usb/mon/mon_text.c |   12 +++++-------
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c
index 1040511..02ce808 100644
--- a/drivers/usb/mon/mon_main.c
+++ b/drivers/usb/mon/mon_main.c
@@ -347,8 +347,8 @@ static int __init mon_init(void)
 	struct usb_bus *ubus;
 	int rc;
 
-	if ((rc = mon_text_init()) != 0)
-		goto err_text;
+	if (mon_text_init() != 0)
+		printk(KERN_WARNING TAG ": debugfs is not available\n");
 	if ((rc = mon_bin_init()) != 0)
 		goto err_bin;
 
@@ -373,7 +373,6 @@ err_reg:
 	mon_bin_exit();
 err_bin:
 	mon_text_exit();
-err_text:
 	return rc;
 }
 
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
index c302e19..a424473 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)
 	int busnum = ubus? ubus->busnum: 0;
 	int rc;
 
+	if (mon_dir == NULL)
+		return 0;
+
 	if (ubus != NULL) {
 		rc = snprintf(name, NAMESZ, "%dt", busnum);
 		if (rc <= 0 || rc >= NAMESZ)
@@ -739,14 +742,9 @@ int __init mon_text_init(void)
 	struct dentry *mondir;
 
 	mondir = debugfs_create_dir("usbmon", usb_debug_root);
-	if (IS_ERR(mondir)) {
-		printk(KERN_NOTICE TAG ": debugfs is not available\n");
-		return -ENODEV;
-	}
-	if (mondir == NULL) {
-		printk(KERN_NOTICE TAG ": unable to create usbmon directory\n");
+	if (IS_ERR_OR_NULL(mondir))
 		return -ENODEV;
-	}
+
 	mon_dir = mondir;
 	return 0;
 }
-- 
1.7.5.4

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux