Re: 2.6.19-rc3-mm1 -- missing network adaptors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 30 Oct 2006 21:14:32 +0100,
Cornelia Huck <[email protected]> wrote:

> With CONFIG_SYSFS_DEPRECATED set, you'll get errors for devices which
> have no parent set. The kobject's parent is set to the class
> subsystem's kobject, meaning there is a child with name bus_id (e.
> g. /sys/class/net/lo). Unfortunately, we also try to create a link
> named bus_id in /sys/class/<foo>, which will fail with -EEXIST... We
> should probably drop that link if we have no parent.

You can use the following as a band-aid (everything looks sane on my
system), although you will still have problems if your setup tools
can't cope with symlinks :/ (a link is still created for devices with
real parents).

Signed-off-by: Cornelia Huck <[email protected]>

---
 drivers/base/core.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

--- linux-2.6-CH.orig/drivers/base/core.c
+++ linux-2.6-CH/drivers/base/core.c
@@ -368,6 +368,12 @@ static void klist_children_put(struct kl
 static int device_add_class_symlinks(struct device *dev)
 {
 	int error;
+	int create_link =
+#ifdef CONFIG_SYSFS_DEPRECATED
+		dev->parent ? 1 : 0;
+#else
+	1;
+#endif
 
 	if (!dev->class)
 		return 0;
@@ -375,10 +381,12 @@ static int device_add_class_symlinks(str
 				  "subsystem");
 	if (error)
 		goto out;
-	error = sysfs_create_link(&dev->class->subsys.kset.kobj, &dev->kobj,
-				  dev->bus_id);
-	if (error)
-		goto out_subsys;
+	if (create_link) {
+		error = sysfs_create_link(&dev->class->subsys.kset.kobj,
+					  &dev->kobj, dev->bus_id);
+		if (error)
+			goto out_subsys;
+	}
 #ifdef CONFIG_SYSFS_DEPRECATED
 	if (dev->parent) {
 		char *class_name;
@@ -407,7 +415,8 @@ out_device:
 		sysfs_remove_link(&dev->kobj, "device");
 out_busid:
 #endif
-	sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id);
+	if (create_link)
+		sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id);
 out_subsys:
 	sysfs_remove_link(&dev->kobj, "subsystem");
 out:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux