History

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

Linus Torvalds committed 4 years ago

Commit 33563132 parents f58d341 cdb4f264 files · +4 −48Browse files

Unified · Split

4 files
  1. arch/powerpc/platforms/pseries/vas-sysfs.c +4 −2
  2. fs/sysfs/file.c +0 −13
  3. include/linux/kobject.h +0 −1
  4. lib/kobject.c +0 −32
arch/powerpc/platforms/pseries/vas-sysfs.c+4−2
@@ -99,6 +99,7 @@ static struct attribute *vas_def_capab_attrs[] = { · 98 unmodified lines
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,
@@ -106,6 +107,7 @@ static struct attribute *vas_qos_capab_attrs[] = { · 1 unmodified line
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 = { · 42 unmodified lines
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+0−13
@@ -703,19 +703,6 @@ int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid) · 702 unmodified lines
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+0−1
@@ -120,7 +120,6 @@ extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); · 119 unmodified lines
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+0−32
@@ -54,32 +54,6 @@ void kobject_get_ownership(struct kobject *kobj, kuid_t *uid, kgid_t *gid) · 53 unmodified lines
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) · 4 unmodified lines
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) {