Skip to contentSkip to conversation

driver-core: remove the duplicate assignment of kobj->parent in device_add

PATCH In review Wei Yang 2 participants 2 messages Jan 23, 2013 – Jan 25, 2013 Driver core

lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 driver-core: remove the duplicate assignment of kobj->parent in device_add

kobject_add() will setup the kobject parent correctly.

This patch removes the redundant code.

Tested on Lenovo T420.

---
 drivers/base/core.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/base/core.c +1 -3
index 5e6e00b..37d0ea8 100644
@@ -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;
 
Signature · 1 line
1.7.5.4
maintainer
#1 lore raw
Quoted 1 line · Wei Yang

kobject_add() will setup the kobject parent correctly.

How so?

Quoted 1 line

This patch removes the redundant code.

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

Quoted 1 line

Tested on Lenovo T420.

How?

I don't know about this patch, sorry.

greg k-h