ar71xx: ag71xx: use debugfs_remove_recursive
[openwrt.git] / target / linux / ar71xx / files / drivers / net / ag71xx / ag71xx_debugfs.c
index c37265e..eca0905 100644 (file)
@@ -44,8 +44,8 @@ void ag71xx_debugfs_update_int_stats(struct ag71xx *ag, u32 status)
 static ssize_t read_file_int_stats(struct file *file, char __user *user_buf,
                                   size_t count, loff_t *ppos)
 {
-#define PR_INT_STAT(_label, _field)                                    \
-       len += snprintf(buf + len, sizeof(buf) - len,                   \
+#define PR_INT_STAT(_label, _field)                                    \
+       len += snprintf(buf + len, sizeof(buf) - len,                   \
                "%20s: %10lu\n", _label, ag->debug.int_stats._field);
 
        struct ag71xx *ag = file->private_data;
@@ -141,9 +141,7 @@ static const struct file_operations ag71xx_fops_napi_stats = {
 
 void ag71xx_debugfs_exit(struct ag71xx *ag)
 {
-       debugfs_remove(ag->debug.debugfs_napi_stats);
-       debugfs_remove(ag->debug.debugfs_int_stats);
-       debugfs_remove(ag->debug.debugfs_dir);
+       debugfs_remove_recursive(ag->debug.debugfs_dir);
 }
 
 int ag71xx_debugfs_init(struct ag71xx *ag)
@@ -151,31 +149,14 @@ int ag71xx_debugfs_init(struct ag71xx *ag)
        ag->debug.debugfs_dir = debugfs_create_dir(ag->dev->name,
                                                   ag71xx_debugfs_root);
        if (!ag->debug.debugfs_dir)
-               goto err;
-
-       ag->debug.debugfs_int_stats =
-                       debugfs_create_file("int_stats",
-                                           S_IRUGO,
-                                           ag->debug.debugfs_dir,
-                                           ag,
-                                           &ag71xx_fops_int_stats);
-       if (!ag->debug.debugfs_int_stats)
-               goto err;
-
-       ag->debug.debugfs_napi_stats =
-                       debugfs_create_file("napi_stats",
-                                           S_IRUGO,
-                                           ag->debug.debugfs_dir,
-                                           ag,
-                                           &ag71xx_fops_napi_stats);
-       if (!ag->debug.debugfs_napi_stats)
-               goto err;
+               return -ENOMEM;
 
-       return 0;
+       debugfs_create_file("int_stats", S_IRUGO, ag->debug.debugfs_dir,
+                           ag, &ag71xx_fops_int_stats);
+       debugfs_create_file("napi_stats", S_IRUGO, ag->debug.debugfs_dir,
+                           ag, &ag71xx_fops_napi_stats);
 
- err:
-       ag71xx_debugfs_exit(ag);
-       return -ENOMEM;
+       return 0;
 }
 
 int ag71xx_debugfs_root_init(void)