return pos->s_parent;
 }
 
-void __sysfs_remove(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
+static void __sysfs_remove(struct sysfs_addrm_cxt *acxt,
+                          struct sysfs_dirent *sd)
 {
        struct sysfs_dirent *pos, *next;
 
        sysfs_addrm_finish(&acxt);
 }
 
+/**
+ * sysfs_hash_and_remove - find a sysfs_dirent by name and remove it
+ * @dir_sd: parent of the target
+ * @name: name of the sysfs_dirent to remove
+ * @ns: namespace tag of the sysfs_dirent to remove
+ *
+ * Look for the sysfs_dirent with @name and @ns under @dir_sd and remove
+ * it.  Returns 0 on success, -ENOENT if such entry doesn't exist.
+ */
+int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name,
+                         const void *ns)
+{
+       struct sysfs_addrm_cxt acxt;
+       struct sysfs_dirent *sd;
+
+       if (!dir_sd) {
+               WARN(1, KERN_WARNING "sysfs: can not remove '%s', no directory\n",
+                       name);
+               return -ENOENT;
+       }
+
+       sysfs_addrm_start(&acxt);
+
+       sd = sysfs_find_dirent(dir_sd, name, ns);
+       if (sd)
+               __sysfs_remove(&acxt, sd);
+
+       sysfs_addrm_finish(&acxt);
+
+       if (sd)
+               return 0;
+       else
+               return -ENOENT;
+}
+
 /**
  *     sysfs_remove_dir - remove an object's directory.
  *     @kobj:  object.
 
        sysfs_put(sd);
 }
 
-int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name,
-                         const void *ns)
-{
-       struct sysfs_addrm_cxt acxt;
-       struct sysfs_dirent *sd;
-
-       if (!dir_sd) {
-               WARN(1, KERN_WARNING "sysfs: can not remove '%s', no directory\n",
-                       name);
-               return -ENOENT;
-       }
-
-       sysfs_addrm_start(&acxt);
-
-       sd = sysfs_find_dirent(dir_sd, name, ns);
-       if (sd)
-               __sysfs_remove(&acxt, sd);
-
-       sysfs_addrm_finish(&acxt);
-
-       if (sd)
-               return 0;
-       else
-               return -ENOENT;
-}
-
 int sysfs_permission(struct inode *inode, int mask)
 {
        struct sysfs_dirent *sd;
 
                    struct sysfs_dirent *parent_sd);
 int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
                  struct sysfs_dirent *parent_sd);
-void __sysfs_remove(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd);
 void sysfs_remove(struct sysfs_dirent *sd);
+int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name,
+                         const void *ns);
 void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt);
 
 struct sysfs_dirent *sysfs_find_dirent(struct sysfs_dirent *parent_sd,
                  struct kstat *stat);
 int sysfs_setxattr(struct dentry *dentry, const char *name, const void *value,
                   size_t size, int flags);
-int sysfs_hash_and_remove(struct sysfs_dirent *dir_sd, const char *name,
-                         const void *ns);
 int sysfs_inode_init(void);
 
 /*