Re: borked sysfs system devices in 2.5.72

Patrick Mochel
2003-06-17T22:38:10Z

> Look in subsys_attr_show(). It is being passed a kobject, which is a
> member of a "struct sys_device". We can tell this because I printed out
> the address of the sys device in sys_device_register(). A to_subsys()
> is being performed on that object, which is wrong, because the kobject
> is not a member of a "struct subsystem".

My question was how the hell it was getting there in the first place, and
I see that the type of the object isn't getting set properly, so it
defaults to treat it as a struct subsystem.

Could you please try the following patch, and let me know if it works?

Thanks,

-pat

===== drivers/base/sys.c 1.25 vs edited =====
--- 1.25/drivers/base/sys.c Mon Jun 16 10:07:04 2003
+++ edited/drivers/base/sys.c Tue Jun 17 15:50:48 2003
@@ -170,6 +172,9 @@

/* Make sure the kset is set */
sysdev->kobj.kset = &cls->kset;
+
+ /* But make sure we point to the right type for sysfs translation */
+ sysdev->kobj.ktype = &ktype_sysdev;

/* set the kobject name */
snprintf(sysdev->kobj.name,KOBJ_NAME_LEN,"%s%d",