From patchwork Sat Feb 20 00:37:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Roskin X-Patchwork-Id: 80895 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1K0cJLL018256 for ; Sat, 20 Feb 2010 00:38:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756620Ab0BTAhl (ORCPT ); Fri, 19 Feb 2010 19:37:41 -0500 Received: from c60.cesmail.net ([216.154.195.49]:5084 "EHLO c60.cesmail.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756262Ab0BTAhX (ORCPT ); Fri, 19 Feb 2010 19:37:23 -0500 Received: from unknown (HELO smtprelay1.cesmail.net) ([192.168.1.111]) by c60.cesmail.net with ESMTP; 19 Feb 2010 19:37:23 -0500 Received: from [192.168.0.22] (unknown [72.92.88.10]) by smtprelay1.cesmail.net (Postfix) with ESMTPSA id 2DB0F34C6D; Fri, 19 Feb 2010 19:37:20 -0500 (EST) Subject: [PATCH v2] compat: move debugfs_remove_recursive() to compat-2.6.27 From: Pavel Roskin To: "Luis R. Rodriguez" Cc: linux-wireless@vger.kernel.org In-Reply-To: <20100220000921.15525.55155.stgit@mj.roinet.com> References: <20100220000921.15525.55155.stgit@mj.roinet.com> Date: Fri, 19 Feb 2010 19:37:10 -0500 Message-Id: <1266626230.25707.60.camel@mj> Mime-Version: 1.0 X-Mailer: Evolution 2.26.3 (2.26.3-1.fc11) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 20 Feb 2010 00:38:19 +0000 (UTC) diff --git a/compat/compat-2.6.26.c b/compat/compat-2.6.26.c index 82134c2..b9bf9e7 100644 --- a/compat/compat-2.6.26.c +++ b/compat/compat-2.6.26.c @@ -89,37 +89,5 @@ int dev_set_name(struct device *dev, const char *fmt, ...) } EXPORT_SYMBOL_GPL(dev_set_name); -/* - * 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; - - 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 /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26) */ diff --git a/compat/compat-2.6.27.c b/compat/compat-2.6.27.c index 4fef36a..240f84f 100644 --- a/compat/compat-2.6.27.c +++ b/compat/compat-2.6.27.c @@ -206,6 +206,38 @@ unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz) EXPORT_SYMBOL_GPL(sdio_align_size); #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24) */ +/* + * 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; + + 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 /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27) */ diff --git a/include/linux/compat-2.6.26.h b/include/linux/compat-2.6.26.h index 498fe44..2bee30e 100644 --- a/include/linux/compat-2.6.26.h +++ b/include/linux/compat-2.6.26.h @@ -11,20 +11,12 @@ #include #include #include -#include #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)) #include #endif #include #include -#if defined(CONFIG_DEBUG_FS) -void debugfs_remove_recursive(struct dentry *dentry); -#else -static inline void debugfs_remove_recursive(struct dentry *dentry) -{ } -#endif - /* These jiffie helpers added as of 2.6.26 */ /* diff --git a/include/linux/compat-2.6.27.h b/include/linux/compat-2.6.27.h index e9de41e..f4c77ce 100644 --- a/include/linux/compat-2.6.27.h +++ b/include/linux/compat-2.6.27.h @@ -5,6 +5,7 @@ #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) +#include #include #include #include @@ -214,4 +215,11 @@ static inline void dma_sync_single_range_for_device(struct device *dev, #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)) */ +#if defined(CONFIG_DEBUG_FS) +void debugfs_remove_recursive(struct dentry *dentry); +#else +static inline void debugfs_remove_recursive(struct dentry *dentry) +{ } +#endif + #endif /* LINUX_26_27_COMPAT_H */