Skip to content

Commit 3356313

Browse files
committed
Merge tag 'driver-core-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH: "Here are two small driver core changes for 5.18-rc2. They are the final bits in the removal of the default_attrs field in struct kobj_type. I had to wait until after 5.18-rc1 for all of the changes to do this came in through different development trees, and then one new user snuck in. So this series has two changes: - removal of the default_attrs field in the powerpc/pseries/vas code. The change has been acked by the PPC maintainers to come through this tree - removal of default_attrs from struct kobj_type now that all in-kernel users are removed. This cleans up the kobject code a little bit and removes some duplicated functionality that confused people (now there is only one way to do default groups) Both of these have been in linux-next for all of this week with no reported problems" * tag 'driver-core-5.18-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: kobject: kobj_type: remove default_attrs powerpc/pseries/vas: use default_groups in kobj_type
2 parents f58d341 + cdb4f26 commit 3356313

File tree

4 files changed

+4
-48
lines changed

4 files changed

+4
-48
lines changed

arch/powerpc/platforms/pseries/vas-sysfs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,15 @@ static struct attribute *vas_def_capab_attrs[] = {
9999
&nr_used_credits_attribute.attr,
100100
NULL,
101101
};
102+
ATTRIBUTE_GROUPS(vas_def_capab);
102103

103104
static struct attribute *vas_qos_capab_attrs[] = {
104105
&nr_total_credits_attribute.attr,
105106
&nr_used_credits_attribute.attr,
106107
&update_total_credits_attribute.attr,
107108
NULL,
108109
};
110+
ATTRIBUTE_GROUPS(vas_qos_capab);
109111

110112
static ssize_t vas_type_show(struct kobject *kobj, struct attribute *attr,
111113
char *buf)
@@ -154,13 +156,13 @@ static const struct sysfs_ops vas_sysfs_ops = {
154156
static struct kobj_type vas_def_attr_type = {
155157
.release = vas_type_release,
156158
.sysfs_ops = &vas_sysfs_ops,
157-
.default_attrs = vas_def_capab_attrs,
159+
.default_groups = vas_def_capab_groups,
158160
};
159161

160162
static struct kobj_type vas_qos_attr_type = {
161163
.release = vas_type_release,
162164
.sysfs_ops = &vas_sysfs_ops,
163-
.default_attrs = vas_qos_capab_attrs,
165+
.default_groups = vas_qos_capab_groups,
164166
};
165167

166168
static char *vas_caps_kobj_name(struct vas_caps_entry *centry,

fs/sysfs/file.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -703,19 +703,6 @@ int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid)
703703

704704
ktype = get_ktype(kobj);
705705
if (ktype) {
706-
struct attribute **kattr;
707-
708-
/*
709-
* Change owner of the default attributes associated with the
710-
* ktype of @kobj.
711-
*/
712-
for (kattr = ktype->default_attrs; kattr && *kattr; kattr++) {
713-
error = sysfs_file_change_owner(kobj, (*kattr)->name,
714-
kuid, kgid);
715-
if (error)
716-
return error;
717-
}
718-
719706
/*
720707
* Change owner of the default groups associated with the
721708
* ktype of @kobj.

include/linux/kobject.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
120120
struct kobj_type {
121121
void (*release)(struct kobject *kobj);
122122
const struct sysfs_ops *sysfs_ops;
123-
struct attribute **default_attrs; /* use default_groups instead */
124123
const struct attribute_group **default_groups;
125124
const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj);
126125
const void *(*namespace)(struct kobject *kobj);

lib/kobject.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -54,32 +54,6 @@ void kobject_get_ownership(struct kobject *kobj, kuid_t *uid, kgid_t *gid)
5454
kobj->ktype->get_ownership(kobj, uid, gid);
5555
}
5656

57-
/*
58-
* populate_dir - populate directory with attributes.
59-
* @kobj: object we're working on.
60-
*
61-
* Most subsystems have a set of default attributes that are associated
62-
* with an object that registers with them. This is a helper called during
63-
* object registration that loops through the default attributes of the
64-
* subsystem and creates attributes files for them in sysfs.
65-
*/
66-
static int populate_dir(struct kobject *kobj)
67-
{
68-
const struct kobj_type *t = get_ktype(kobj);
69-
struct attribute *attr;
70-
int error = 0;
71-
int i;
72-
73-
if (t && t->default_attrs) {
74-
for (i = 0; (attr = t->default_attrs[i]) != NULL; i++) {
75-
error = sysfs_create_file(kobj, attr);
76-
if (error)
77-
break;
78-
}
79-
}
80-
return error;
81-
}
82-
8357
static int create_dir(struct kobject *kobj)
8458
{
8559
const struct kobj_type *ktype = get_ktype(kobj);
@@ -90,12 +64,6 @@ static int create_dir(struct kobject *kobj)
9064
if (error)
9165
return error;
9266

93-
error = populate_dir(kobj);
94-
if (error) {
95-
sysfs_remove_dir(kobj);
96-
return error;
97-
}
98-
9967
if (ktype) {
10068
error = sysfs_create_groups(kobj, ktype->default_groups);
10169
if (error) {

0 commit comments

Comments
 (0)