mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
Driver core changes for 5.18-rc2
Here are 2 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 2 changes: - removal of the default_attrs field in the powerpc/pseries/vas code. 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.) All of these have been in linux-next for all of this week with no reported problems. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCYlLRHg8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+yn+9gCfXN0OvKmw5QD55z8YGp/jIycK0ToAnifJ/OX+ sU2V8ZQfNbV8xw7iXfc2 =L+Uc -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
33563138ac
4 changed files with 4 additions and 48 deletions
|
@ -99,6 +99,7 @@ static struct attribute *vas_def_capab_attrs[] = {
|
||||||
&nr_used_credits_attribute.attr,
|
&nr_used_credits_attribute.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
ATTRIBUTE_GROUPS(vas_def_capab);
|
||||||
|
|
||||||
static struct attribute *vas_qos_capab_attrs[] = {
|
static struct attribute *vas_qos_capab_attrs[] = {
|
||||||
&nr_total_credits_attribute.attr,
|
&nr_total_credits_attribute.attr,
|
||||||
|
@ -106,6 +107,7 @@ static struct attribute *vas_qos_capab_attrs[] = {
|
||||||
&update_total_credits_attribute.attr,
|
&update_total_credits_attribute.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
ATTRIBUTE_GROUPS(vas_qos_capab);
|
||||||
|
|
||||||
static ssize_t vas_type_show(struct kobject *kobj, struct attribute *attr,
|
static ssize_t vas_type_show(struct kobject *kobj, struct attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
|
@ -154,13 +156,13 @@ static const struct sysfs_ops vas_sysfs_ops = {
|
||||||
static struct kobj_type vas_def_attr_type = {
|
static struct kobj_type vas_def_attr_type = {
|
||||||
.release = vas_type_release,
|
.release = vas_type_release,
|
||||||
.sysfs_ops = &vas_sysfs_ops,
|
.sysfs_ops = &vas_sysfs_ops,
|
||||||
.default_attrs = vas_def_capab_attrs,
|
.default_groups = vas_def_capab_groups,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct kobj_type vas_qos_attr_type = {
|
static struct kobj_type vas_qos_attr_type = {
|
||||||
.release = vas_type_release,
|
.release = vas_type_release,
|
||||||
.sysfs_ops = &vas_sysfs_ops,
|
.sysfs_ops = &vas_sysfs_ops,
|
||||||
.default_attrs = vas_qos_capab_attrs,
|
.default_groups = vas_qos_capab_groups,
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *vas_caps_kobj_name(struct vas_caps_entry *centry,
|
static char *vas_caps_kobj_name(struct vas_caps_entry *centry,
|
||||||
|
|
|
@ -703,19 +703,6 @@ int sysfs_change_owner(struct kobject *kobj, kuid_t kuid, kgid_t kgid)
|
||||||
|
|
||||||
ktype = get_ktype(kobj);
|
ktype = get_ktype(kobj);
|
||||||
if (ktype) {
|
if (ktype) {
|
||||||
struct attribute **kattr;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Change owner of the default attributes associated with the
|
|
||||||
* ktype of @kobj.
|
|
||||||
*/
|
|
||||||
for (kattr = ktype->default_attrs; kattr && *kattr; kattr++) {
|
|
||||||
error = sysfs_file_change_owner(kobj, (*kattr)->name,
|
|
||||||
kuid, kgid);
|
|
||||||
if (error)
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change owner of the default groups associated with the
|
* Change owner of the default groups associated with the
|
||||||
* ktype of @kobj.
|
* ktype of @kobj.
|
||||||
|
|
|
@ -120,7 +120,6 @@ extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
|
||||||
struct kobj_type {
|
struct kobj_type {
|
||||||
void (*release)(struct kobject *kobj);
|
void (*release)(struct kobject *kobj);
|
||||||
const struct sysfs_ops *sysfs_ops;
|
const struct sysfs_ops *sysfs_ops;
|
||||||
struct attribute **default_attrs; /* use default_groups instead */
|
|
||||||
const struct attribute_group **default_groups;
|
const struct attribute_group **default_groups;
|
||||||
const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj);
|
const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj);
|
||||||
const void *(*namespace)(struct kobject *kobj);
|
const void *(*namespace)(struct kobject *kobj);
|
||||||
|
|
|
@ -54,32 +54,6 @@ void kobject_get_ownership(struct kobject *kobj, kuid_t *uid, kgid_t *gid)
|
||||||
kobj->ktype->get_ownership(kobj, uid, gid);
|
kobj->ktype->get_ownership(kobj, uid, gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* populate_dir - populate directory with attributes.
|
|
||||||
* @kobj: object we're working on.
|
|
||||||
*
|
|
||||||
* Most subsystems have a set of default attributes that are associated
|
|
||||||
* with an object that registers with them. This is a helper called during
|
|
||||||
* object registration that loops through the default attributes of the
|
|
||||||
* subsystem and creates attributes files for them in sysfs.
|
|
||||||
*/
|
|
||||||
static int populate_dir(struct kobject *kobj)
|
|
||||||
{
|
|
||||||
const struct kobj_type *t = get_ktype(kobj);
|
|
||||||
struct attribute *attr;
|
|
||||||
int error = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (t && t->default_attrs) {
|
|
||||||
for (i = 0; (attr = t->default_attrs[i]) != NULL; i++) {
|
|
||||||
error = sysfs_create_file(kobj, attr);
|
|
||||||
if (error)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int create_dir(struct kobject *kobj)
|
static int create_dir(struct kobject *kobj)
|
||||||
{
|
{
|
||||||
const struct kobj_type *ktype = get_ktype(kobj);
|
const struct kobj_type *ktype = get_ktype(kobj);
|
||||||
|
@ -90,12 +64,6 @@ static int create_dir(struct kobject *kobj)
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
error = populate_dir(kobj);
|
|
||||||
if (error) {
|
|
||||||
sysfs_remove_dir(kobj);
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ktype) {
|
if (ktype) {
|
||||||
error = sysfs_create_groups(kobj, ktype->default_groups);
|
error = sysfs_create_groups(kobj, ktype->default_groups);
|
||||||
if (error) {
|
if (error) {
|
||||||
|
|
Loading…
Reference in a new issue