Skip to content

Commit 2d0cfbe

Browse files
htejungregkh
authored andcommitted
sysfs, kernfs: remove sysfs_add_one()
sysfs_add_one() is a wrapper around __sysfs_add_one() which prints out duplicate name warning if __sysfs_add_one() fails with -EEXIST. The previous kernfs conversions moved all dup warnings to sysfs interface functions and sysfs_add_one() doesn't have any user left. Remove sysfs_add_one() and update __sysfs_add_one() to take its name. This patch doesn't make any functional changes. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 496f739 commit 2d0cfbe

4 files changed

Lines changed: 6 additions & 41 deletions

File tree

‎fs/sysfs/dir.c‎

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt)
395395
}
396396

397397
/**
398-
* __sysfs_add_one - add sysfs_dirent to parent without warning
398+
* sysfs_add_one - add sysfs_dirent to parent without warning
399399
* @acxt: addrm context to use
400400
* @sd: sysfs_dirent to be added
401401
* @parent_sd: the parent sysfs_dirent to add @sd to
@@ -415,8 +415,8 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt)
415415
* 0 on success, -EEXIST if entry with the given name already
416416
* exists.
417417
*/
418-
int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
419-
struct sysfs_dirent *parent_sd)
418+
int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
419+
struct sysfs_dirent *parent_sd)
420420
{
421421
bool has_ns = parent_sd->s_flags & SYSFS_FLAG_NS;
422422
struct sysfs_inode_attrs *ps_iattr;
@@ -487,39 +487,6 @@ void sysfs_warn_dup(struct sysfs_dirent *parent, const char *name)
487487
kfree(path);
488488
}
489489

490-
/**
491-
* sysfs_add_one - add sysfs_dirent to parent
492-
* @acxt: addrm context to use
493-
* @sd: sysfs_dirent to be added
494-
* @parent_sd: the parent sysfs_dirent to add @sd to
495-
*
496-
* Get @parent_sd and set @sd->s_parent to it and increment nlink of
497-
* the parent inode if @sd is a directory and link into the children
498-
* list of the parent.
499-
*
500-
* This function should be called between calls to
501-
* sysfs_addrm_start() and sysfs_addrm_finish() and should be
502-
* passed the same @acxt as passed to sysfs_addrm_start().
503-
*
504-
* LOCKING:
505-
* Determined by sysfs_addrm_start().
506-
*
507-
* RETURNS:
508-
* 0 on success, -EEXIST if entry with the given name already
509-
* exists.
510-
*/
511-
int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
512-
struct sysfs_dirent *parent_sd)
513-
{
514-
int ret;
515-
516-
ret = __sysfs_add_one(acxt, sd, parent_sd);
517-
518-
if (ret == -EEXIST)
519-
sysfs_warn_dup(parent_sd, sd->s_name);
520-
return ret;
521-
}
522-
523490
/**
524491
* sysfs_remove_one - remove sysfs_dirent from parent
525492
* @acxt: addrm context to use
@@ -694,7 +661,7 @@ struct sysfs_dirent *kernfs_create_dir_ns(struct sysfs_dirent *parent,
694661

695662
/* link in */
696663
sysfs_addrm_start(&acxt);
697-
rc = __sysfs_add_one(&acxt, sd, parent);
664+
rc = sysfs_add_one(&acxt, sd, parent);
698665
sysfs_addrm_finish(&acxt);
699666

700667
if (!rc)

‎fs/sysfs/file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ struct sysfs_dirent *kernfs_create_file_ns(struct sysfs_dirent *parent,
10071007
sd->s_flags |= SYSFS_FLAG_HAS_MMAP;
10081008

10091009
sysfs_addrm_start(&acxt);
1010-
rc = __sysfs_add_one(&acxt, sd, parent);
1010+
rc = sysfs_add_one(&acxt, sd, parent);
10111011
sysfs_addrm_finish(&acxt);
10121012

10131013
if (rc) {

‎fs/sysfs/symlink.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct sysfs_dirent *kernfs_create_link(struct sysfs_dirent *parent,
4747
sysfs_get(target); /* ref owned by symlink */
4848

4949
sysfs_addrm_start(&acxt);
50-
error = __sysfs_add_one(&acxt, sd, parent);
50+
error = sysfs_add_one(&acxt, sd, parent);
5151
sysfs_addrm_finish(&acxt);
5252

5353
if (!error)

‎fs/sysfs/sysfs.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd);
167167
void sysfs_put_active(struct sysfs_dirent *sd);
168168
void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt);
169169
void sysfs_warn_dup(struct sysfs_dirent *parent, const char *name);
170-
int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
171-
struct sysfs_dirent *parent_sd);
172170
int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
173171
struct sysfs_dirent *parent_sd);
174172
void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt);

0 commit comments

Comments
 (0)