We have use cases where an empty sysfs directory is created. This requires an attribute list consisting of only the sentinal entry. It takes only to modify one check to enable creating an empty directory with a NULL attribute list. Signed-off-by: Heiner Kallweit --- fs/sysfs/group.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 4e1e4f18a16..031cb6f36b5 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@ -141,9 +141,10 @@ static int internal_create_group(struct kobject *kobj, int update, if (unlikely(update && !kobj->sd)) return -EINVAL; - if (!grp->attrs && !grp->bin_attrs) { - pr_debug("sysfs: (bin_)attrs not set by subsystem for group: %s/%s, skipping\n", - kobj->name, grp->name ?: ""); + /* If name is set w/o attributes, create an empty directory */ + if (!grp->name && !grp->attrs && !grp->bin_attrs) { + pr_debug("sysfs: (bin_)attrs not set by subsystem for group: %s, skipping\n", + kobj->name); return 0; } -- 2.56.0 Now that an empty directory can be created with attrs being NULL, make use of this new functionality and remove the dummy attribute list. Signed-off-by: Heiner Kallweit --- net/core/net-sysfs.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index 5c0402389c6..f58b59e1126 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -910,13 +910,8 @@ static const struct attribute_group netstat_group = { .attrs = netstat_attrs, }; -static struct attribute *wireless_attrs[] = { - NULL -}; - static const struct attribute_group wireless_group = { .name = "wireless", - .attrs = wireless_attrs, }; static bool wireless_group_needed(struct net_device *ndev) -- 2.56.0