*/
#include <linux/compat.h>
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
-
#include <linux/pci.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24))
#include <linux/mmc/sdio.h>
EXPORT_SYMBOL_GPL(sdio_align_size);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) */
+#ifdef CONFIG_DEBUG_FS
+/*
+ * Backport of debugfs_remove_recursive() without using the internals globals
+ * which are used by the kernel's version with:
+ * simple_release_fs(&debugfs_mount, &debugfs_mount_count);
+ */
+void debugfs_remove_recursive(struct dentry *dentry)
+{
+ struct dentry *last = NULL;
+
+ /* Sanity checks */
+ if (!dentry || !dentry->d_parent || !dentry->d_parent->d_inode)
+ return;
-#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) */
+ while (dentry != last) {
+ struct dentry *child = dentry;
+
+ /* Find a child without children */
+ while (!list_empty(&child->d_subdirs))
+ child = list_entry(child->d_subdirs.next,
+ struct dentry,
+ d_u.d_child);
+
+ /* Bail out if we already tried to remove that entry */
+ if (child == last)
+ return;
+
+ last = child;
+ debugfs_remove(child);
+ }
+}
+EXPORT_SYMBOL_GPL(debugfs_remove_recursive);
+#endif /* CONFIG_DEBUG_FS */