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

+4 -48
+4 -2
arch/powerpc/platforms/pseries/vas-sysfs.c
··· 99 &nr_used_credits_attribute.attr, 100 NULL, 101 }; 102 103 static struct attribute *vas_qos_capab_attrs[] = { 104 &nr_total_credits_attribute.attr, ··· 107 &update_total_credits_attribute.attr, 108 NULL, 109 }; 110 111 static ssize_t vas_type_show(struct kobject *kobj, struct attribute *attr, 112 char *buf) ··· 156 static struct kobj_type vas_def_attr_type = { 157 .release = vas_type_release, 158 .sysfs_ops = &vas_sysfs_ops, 159 - .default_attrs = vas_def_capab_attrs, 160 }; 161 162 static struct kobj_type vas_qos_attr_type = { 163 .release = vas_type_release, 164 .sysfs_ops = &vas_sysfs_ops, 165 - .default_attrs = vas_qos_capab_attrs, 166 }; 167 168 static char *vas_caps_kobj_name(struct vas_caps_entry *centry,
··· 99 &nr_used_credits_attribute.attr, 100 NULL, 101 }; 102 + ATTRIBUTE_GROUPS(vas_def_capab); 103 104 static struct attribute *vas_qos_capab_attrs[] = { 105 &nr_total_credits_attribute.attr, ··· 106 &update_total_credits_attribute.attr, 107 NULL, 108 }; 109 + ATTRIBUTE_GROUPS(vas_qos_capab); 110 111 static ssize_t vas_type_show(struct kobject *kobj, struct attribute *attr, 112 char *buf) ··· 154 static struct kobj_type vas_def_attr_type = { 155 .release = vas_type_release, 156 .sysfs_ops = &vas_sysfs_ops, 157 + .default_groups = vas_def_capab_groups, 158 }; 159 160 static struct kobj_type vas_qos_attr_type = { 161 .release = vas_type_release, 162 .sysfs_ops = &vas_sysfs_ops, 163 + .default_groups = vas_qos_capab_groups, 164 }; 165 166 static char *vas_caps_kobj_name(struct vas_caps_entry *centry,
-13
fs/sysfs/file.c
··· 703 704 ktype = get_ktype(kobj); 705 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 - 719 /* 720 * Change owner of the default groups associated with the 721 * ktype of @kobj.
··· 703 704 ktype = get_ktype(kobj); 705 if (ktype) { 706 /* 707 * Change owner of the default groups associated with the 708 * ktype of @kobj.
-1
include/linux/kobject.h
··· 120 struct kobj_type { 121 void (*release)(struct kobject *kobj); 122 const struct sysfs_ops *sysfs_ops; 123 - struct attribute **default_attrs; /* use default_groups instead */ 124 const struct attribute_group **default_groups; 125 const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); 126 const void *(*namespace)(struct kobject *kobj);
··· 120 struct kobj_type { 121 void (*release)(struct kobject *kobj); 122 const struct sysfs_ops *sysfs_ops; 123 const struct attribute_group **default_groups; 124 const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); 125 const void *(*namespace)(struct kobject *kobj);
-32
lib/kobject.c
··· 54 kobj->ktype->get_ownership(kobj, uid, gid); 55 } 56 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 - 83 static int create_dir(struct kobject *kobj) 84 { 85 const struct kobj_type *ktype = get_ktype(kobj); ··· 63 error = sysfs_create_dir_ns(kobj, kobject_namespace(kobj)); 64 if (error) 65 return error; 66 - 67 - error = populate_dir(kobj); 68 - if (error) { 69 - sysfs_remove_dir(kobj); 70 - return error; 71 - } 72 73 if (ktype) { 74 error = sysfs_create_groups(kobj, ktype->default_groups);
··· 54 kobj->ktype->get_ownership(kobj, uid, gid); 55 } 56 57 static int create_dir(struct kobject *kobj) 58 { 59 const struct kobj_type *ktype = get_ktype(kobj); ··· 89 error = sysfs_create_dir_ns(kobj, kobject_namespace(kobj)); 90 if (error) 91 return error; 92 93 if (ktype) { 94 error = sysfs_create_groups(kobj, ktype->default_groups);