@@ -16,6 +16,14 @@ config WWAN
if WWAN
+config WWAN_DEBUGFS
+ bool "WWAN subsystem common debugfs interface"
+ depends on DEBUG_FS
+ help
+ Enables common debugfs infrastructure for WWAN devices.
+
+ If unsure, say N.
+
config WWAN_HWSIM
tristate "Simulated WWAN device"
help
@@ -83,6 +91,7 @@ config IOSM
config IOSM_DEBUGFS
bool "IOSM Debugfs support"
depends on IOSM && DEBUG_FS
+ select WWAN_DEBUGFS
help
Enables debugfs driver interface for traces collection.
@@ -146,6 +146,7 @@ static struct wwan_device *wwan_dev_get_by_name(const char *name)
return to_wwan_dev(dev);
}
+#ifdef CONFIG_WWAN_DEBUGFS
struct dentry *wwan_get_debugfs_dir(struct device *parent)
{
struct wwan_device *wwandev;
@@ -157,6 +158,7 @@ struct dentry *wwan_get_debugfs_dir(struct device *parent)
return wwandev->debugfs_dir;
}
EXPORT_SYMBOL_GPL(wwan_get_debugfs_dir);
+#endif
/* This function allocates and registers a new WWAN device OR if a WWAN device
* already exist for the given parent, it gets a reference and return it.
@@ -207,8 +209,10 @@ static struct wwan_device *wwan_create_dev(struct device *parent)
}
wwandev_name = kobject_name(&wwandev->dev.kobj);
+#ifdef CONFIG_WWAN_DEBUGFS
wwandev->debugfs_dir = debugfs_create_dir(wwandev_name,
wwan_debugfs_dir);
+#endif
done_unlock:
mutex_unlock(&wwan_register_lock);
@@ -240,7 +244,9 @@ static void wwan_remove_dev(struct wwan_device *wwandev)
ret = device_for_each_child(&wwandev->dev, NULL, is_wwan_child);
if (!ret) {
+#ifdef CONFIG_WWAN_DEBUGFS
debugfs_remove_recursive(wwandev->debugfs_dir);
+#endif
device_unregister(&wwandev->dev);
} else {
put_device(&wwandev->dev);
@@ -1140,7 +1146,9 @@ static int __init wwan_init(void)
goto destroy;
}
+#ifdef CONFIG_WWAN_DEBUGFS
wwan_debugfs_dir = debugfs_create_dir("wwan", NULL);
+#endif
return 0;
@@ -171,6 +171,13 @@ int wwan_register_ops(struct device *parent, const struct wwan_ops *ops,
void wwan_unregister_ops(struct device *parent);
+#ifdef CONFIG_WWAN_DEBUGFS
struct dentry *wwan_get_debugfs_dir(struct device *parent);
+#else
+static inline struct dentry *wwan_get_debugfs_dir(struct device *parent)
+{
+ return NULL;
+}
+#endif
#endif /* __WWAN_H */
Current WWAN debugfs interface does not take too much space, but it is useless without driver-specific debugfs interfaces. To avoid overloading debugfs with empty directories, make the common WWAN debugfs interface optional. And force its selection if any driver-specific interface (only IOSM at the moment) is enabled by user. Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> --- drivers/net/wwan/Kconfig | 9 +++++++++ drivers/net/wwan/wwan_core.c | 8 ++++++++ include/linux/wwan.h | 7 +++++++ 3 files changed, 24 insertions(+)