Commit 22fd6153 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

driver core: class: fix block class problem when removing CONFIG_SYSFS_DEPRECATED*

In removing the CONFIG_SYSFS_DEPRECATED and CONFIG_SYSFS_DEPRECATED_V2
config options, I messed up in the __class_register() function and got
the logic incorrect.  Fix this all up by just removing the special case
of a block device class logic in this function, as that is what is
intended.

In testing, this solves the boot problem on my systems, hopefully on
others as well.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Fixes: 721da5ce ("driver core: remove CONFIG_SYSFS_DEPRECATED and CONFIG_SYSFS_DEPRECATED_V2")
Link: https://lore.kernel.org/r/20230307075102.3537-1-gregkh@linuxfoundation.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 721da5ce
...@@ -178,13 +178,7 @@ int __class_register(struct class *cls, struct lock_class_key *key) ...@@ -178,13 +178,7 @@ int __class_register(struct class *cls, struct lock_class_key *key)
if (!cls->dev_kobj) if (!cls->dev_kobj)
cls->dev_kobj = sysfs_dev_char_kobj; cls->dev_kobj = sysfs_dev_char_kobj;
#if defined(CONFIG_BLOCK)
/* let the block class directory show up in the root of sysfs */
if (cls != &block_class)
cp->subsys.kobj.kset = class_kset; cp->subsys.kobj.kset = class_kset;
#else
cp->subsys.kobj.kset = class_kset;
#endif
cp->subsys.kobj.ktype = &class_ktype; cp->subsys.kobj.ktype = &class_ktype;
cp->class = cls; cp->class = cls;
cls->p = cp; cls->p = cp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment