linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] driver-core: remove the duplicate assignment of kobj->parent in device_add
@ 2013-01-23  5:58 Wei Yang
  2013-01-25 20:32 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Yang @ 2013-01-23  5:58 UTC (permalink / raw)
  To: linux-kernel, gregkh; +Cc: Wei Yang

kobject_add() will setup the kobject parent correctly.

This patch removes the redundant code.

Tested on Lenovo T420.

Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Reviewed-by: Ram Pai <linuxram@us.ibm.com>
Reviewed-by: Gavin Shan <shangw@linux.vnet.ibm.com>
---
 drivers/base/core.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 5e6e00b..37d0ea8 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -992,8 +992,6 @@ int device_add(struct device *dev)
 
 	parent = get_device(dev->parent);
 	kobj = get_device_parent(dev, parent);
-	if (kobj)
-		dev->kobj.parent = kobj;
 
 	/* use parent numa_node */
 	if (parent)
@@ -1001,7 +999,7 @@ int device_add(struct device *dev)
 
 	/* first, register with generic layer. */
 	/* we require the name to be set before, and pass NULL */
-	error = kobject_add(&dev->kobj, dev->kobj.parent, NULL);
+	error = kobject_add(&dev->kobj, kobj, NULL);
 	if (error)
 		goto Error;
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] driver-core: remove the duplicate assignment of kobj->parent in device_add
  2013-01-23  5:58 [PATCH] driver-core: remove the duplicate assignment of kobj->parent in device_add Wei Yang
@ 2013-01-25 20:32 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2013-01-25 20:32 UTC (permalink / raw)
  To: Wei Yang; +Cc: linux-kernel

On Wed, Jan 23, 2013 at 01:58:30PM +0800, Wei Yang wrote:
> kobject_add() will setup the kobject parent correctly.

How so?

> This patch removes the redundant code.

I don't know, how is it redundant?  What is this causing?  Is it somehow
slowing things down?

> Tested on Lenovo T420.

How?

I don't know about this patch, sorry.

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-01-25 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-23  5:58 [PATCH] driver-core: remove the duplicate assignment of kobj->parent in device_add Wei Yang
2013-01-25 20:32 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).