Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754245Ab0ALRey (ORCPT ); Tue, 12 Jan 2010 12:34:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751135Ab0ALRex (ORCPT ); Tue, 12 Jan 2010 12:34:53 -0500 Received: from e4.ny.us.ibm.com ([32.97.182.144]:50576 "EHLO e4.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822Ab0ALRew (ORCPT ); Tue, 12 Jan 2010 12:34:52 -0500 Date: Tue, 12 Jan 2010 11:34:49 -0600 From: "Serge E. Hallyn" To: "Eric W. Biederman" Cc: Greg Kroah-Hartman , Kay Sievers , linux-kernel@vger.kernel.org, Tejun Heo , Cornelia Huck , linux-fsdevel@vger.kernel.org, Eric Dumazet , Benjamin LaHaise , "Eric W. Biederman" Subject: Re: [PATCH 5/7] driver core: Use sysfs_rename_link in device_rename Message-ID: <20100112173449.GB13506@us.ibm.com> References: <1263241315-19499-5-git-send-email-ebiederm@xmission.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1263241315-19499-5-git-send-email-ebiederm@xmission.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1796 Lines: 54 Quoting Eric W. Biederman (ebiederm@xmission.com): > From: Eric W. Biederman > > Don't open code the renaming of symlinks in sysfs > instead use the new helper function sysfs_rename_link > > Signed-off-by: Eric W. Biederman Acked-by: Serge Hallyn > --- > drivers/base/core.c | 18 ++++++------------ > 1 files changed, 6 insertions(+), 12 deletions(-) > > diff --git a/drivers/base/core.c b/drivers/base/core.c > index 2820257..ba66394 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -1574,22 +1574,16 @@ int device_rename(struct device *dev, char *new_name) > if (old_class_name) { > new_class_name = make_class_name(dev->class->name, &dev->kobj); > if (new_class_name) { > - error = sysfs_create_link_nowarn(&dev->parent->kobj, > - &dev->kobj, > - new_class_name); > - if (error) > - goto out; > - sysfs_remove_link(&dev->parent->kobj, old_class_name); > + error = sysfs_rename_link(&dev->parent->kobj, > + &dev->kobj, > + old_class_name, > + new_class_name); > } > } > #else > if (dev->class) { > - error = sysfs_create_link_nowarn(&dev->class->p->class_subsys.kobj, > - &dev->kobj, dev_name(dev)); > - if (error) > - goto out; > - sysfs_remove_link(&dev->class->p->class_subsys.kobj, > - old_device_name); > + error = sysfs_rename_link(&dev->class->p->class_subsys.kobj, > + &dev->kobj, old_device_name, new_name); > } > #endif > > -- > 1.6.5.2.143.g8cc62 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/