From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: patch sysfs-remove-now-unnecessary-error-reporting-suppression.patch added to gregkh-2.6 tree Date: Tue, 02 Jun 2009 15:57:27 -0700 Message-ID: <12439834471250@kroah.org> References: <1243628376-22905-3-git-send-email-ebiederm@xmission.com> To: ebiederm@xmission.com, akpm@linux-foundation.org, cornelia.huck@de.ibm.com, ebiederm@aristanetworks.com, gregkh@suse.de, greg@kroah.com, kay.sievers@vrfy.org, linux-fsdevel@vger.kerne Return-path: Received: from kroah.org ([198.145.64.141]:57071 "EHLO coco.kroah.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752052AbZFBXBy (ORCPT ); Tue, 2 Jun 2009 19:01:54 -0400 In-Reply-To: <1243628376-22905-3-git-send-email-ebiederm@xmission.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled Subject: sysfs: Remove now unnecessary error reporting suppression. to my gregkh-2.6 tree. Its filename is sysfs-remove-now-unnecessary-error-reporting-suppression.patch This tree can be found at http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/ >>From ebiederm@xmission.com Tue Jun 2 15:35:03 2009 From: "Eric W. Biederman" Date: Fri, 29 May 2009 13:19:13 -0700 Subject: sysfs: Remove now unnecessary error reporting suppression. To: Andrew Morton , Greg Kroah-Hartman Cc: Tejun Heo , Cornelia Huck , , Kay Sievers , Greg KH , "Eric W. Biederman" , "Eric W. Biederman" Message-ID: <1243628376-22905-3-git-send-email-ebiederm@xmission.com> From: Eric W. Biederman Now that we use sysfs_rename_link in the places we previously used sysfs_create_link_nowarn we can remove sysfs_create_link_nowarn and all it's supporting infrastructure as it has no callers. Signed-off-by: Eric W. Biederman Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/dir.c | 54 +++++++++++------------------------------------------ fs/sysfs/symlink.c | 42 ++++++++--------------------------------- fs/sysfs/sysfs.h | 1 3 files changed, 21 insertions(+), 76 deletions(-) --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c @@ -397,43 +397,6 @@ void sysfs_addrm_start(struct sysfs_addr } /** - * __sysfs_add_one - add sysfs_dirent to parent without warning - * @acxt: addrm context to use - * @sd: sysfs_dirent to be added - * - * Get @acxt->parent_sd and set sd->s_parent to it and increment - * nlink of parent inode if @sd is a directory and link into the - * children list of the parent. - * - * This function should be called between calls to - * sysfs_addrm_start() and sysfs_addrm_finish() and should be - * passed the same @acxt as passed to sysfs_addrm_start(). - * - * LOCKING: - * Determined by sysfs_addrm_start(). - * - * RETURNS: - * 0 on success, -EEXIST if entry with the given name already - * exists. - */ -int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) -{ - if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) - return -EEXIST; - - sd->s_parent = sysfs_get(acxt->parent_sd); - - if (sysfs_type(sd) == SYSFS_DIR && acxt->parent_inode) - inc_nlink(acxt->parent_inode); - - acxt->cnt++; - - sysfs_link_sibling(sd); - - return 0; -} - -/** * sysfs_pathname - return full path to sysfs dirent * @sd: sysfs_dirent whose path we want * @path: caller allocated buffer @@ -475,10 +438,7 @@ static char *sysfs_pathname(struct sysfs */ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) { - int ret; - - ret = __sysfs_add_one(acxt, sd); - if (ret == -EEXIST) { + if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) { char *path = kzalloc(PATH_MAX, GFP_KERNEL); WARN(1, KERN_WARNING "sysfs: cannot create duplicate filename '%s'\n", @@ -486,9 +446,19 @@ int sysfs_add_one(struct sysfs_addrm_cxt strcat(strcat(sysfs_pathname(acxt->parent_sd, path), "/"), sd->s_name)); kfree(path); + return -EEXIST; } - return ret; + sd->s_parent = sysfs_get(acxt->parent_sd); + + if (sysfs_type(sd) == SYSFS_DIR && acxt->parent_inode) + inc_nlink(acxt->parent_inode); + + acxt->cnt++; + + sysfs_link_sibling(sd); + + return 0; } /** --- a/fs/sysfs/symlink.c +++ b/fs/sysfs/symlink.c @@ -19,8 +19,14 @@ #include "sysfs.h" -static int sysfs_do_create_link(struct kobject *kobj, struct kobject *target, - const char *name, int warn) +/** + * sysfs_create_link - create symlink between two objects. + * @kobj: object whose directory we're creating the link in. + * @target: object we're pointing to. + * @name: name of the symlink. + */ +int sysfs_create_link(struct kobject *kobj, struct kobject *target, + const char *name) { struct sysfs_dirent *parent_sd = NULL; struct sysfs_dirent *target_sd = NULL; @@ -60,10 +66,7 @@ static int sysfs_do_create_link(struct k target_sd = NULL; /* reference is now owned by the symlink */ sysfs_addrm_start(&acxt, parent_sd); - if (warn) - error = sysfs_add_one(&acxt, sd); - else - error = __sysfs_add_one(&acxt, sd); + error = sysfs_add_one(&acxt, sd); sysfs_addrm_finish(&acxt); if (error) @@ -78,33 +81,6 @@ static int sysfs_do_create_link(struct k } /** - * sysfs_create_link - create symlink between two objects. - * @kobj: object whose directory we're creating the link in. - * @target: object we're pointing to. - * @name: name of the symlink. - */ -int sysfs_create_link(struct kobject *kobj, struct kobject *target, - const char *name) -{ - return sysfs_do_create_link(kobj, target, name, 1); -} - -/** - * sysfs_create_link_nowarn - create symlink between two objects. - * @kobj: object whose directory we're creating the link in. - * @target: object we're pointing to. - * @name: name of the symlink. - * - * This function does the same as sysf_create_link(), but it - * doesn't warn if the link already exists. - */ -int sysfs_create_link_nowarn(struct kobject *kobj, struct kobject *target, - const char *name) -{ - return sysfs_do_create_link(kobj, target, name, 0); -} - -/** * sysfs_remove_link - remove symlink in object's directory. * @kobj: object we're acting for. * @name: name of the symlink to remove. --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h @@ -108,7 +108,6 @@ struct sysfs_dirent *sysfs_get_active_tw void sysfs_put_active_two(struct sysfs_dirent *sd); void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *parent_sd); -int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd); void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt);