mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
driver core: make kobj_type structures constant
Since commit ee6d3dd4ed
("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.
Take advantage of this to constify the structure definitions to prevent
modification at runtime.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20230204-kobj_type-driver-core-v1-1-b9f809419f2c@weissschuh.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
dda6b81f17
commit
c83d9ab42f
@@ -91,7 +91,7 @@ static void driver_release(struct kobject *kobj)
|
|||||||
kfree(drv_priv);
|
kfree(drv_priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_type driver_ktype = {
|
static const struct kobj_type driver_ktype = {
|
||||||
.sysfs_ops = &driver_sysfs_ops,
|
.sysfs_ops = &driver_sysfs_ops,
|
||||||
.release = driver_release,
|
.release = driver_release,
|
||||||
};
|
};
|
||||||
@@ -159,7 +159,7 @@ static void bus_release(struct kobject *kobj)
|
|||||||
bus->p = NULL;
|
bus->p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_type bus_ktype = {
|
static const struct kobj_type bus_ktype = {
|
||||||
.sysfs_ops = &bus_sysfs_ops,
|
.sysfs_ops = &bus_sysfs_ops,
|
||||||
.release = bus_release,
|
.release = bus_release,
|
||||||
};
|
};
|
||||||
|
@@ -77,7 +77,7 @@ static const struct sysfs_ops class_sysfs_ops = {
|
|||||||
.store = class_attr_store,
|
.store = class_attr_store,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct kobj_type class_ktype = {
|
static const struct kobj_type class_ktype = {
|
||||||
.sysfs_ops = &class_sysfs_ops,
|
.sysfs_ops = &class_sysfs_ops,
|
||||||
.release = class_release,
|
.release = class_release,
|
||||||
.child_ns_type = class_child_ns_type,
|
.child_ns_type = class_child_ns_type,
|
||||||
|
@@ -2354,7 +2354,7 @@ static void device_get_ownership(const struct kobject *kobj, kuid_t *uid, kgid_t
|
|||||||
dev->class->get_ownership(dev, uid, gid);
|
dev->class->get_ownership(dev, uid, gid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_type device_ktype = {
|
static const struct kobj_type device_ktype = {
|
||||||
.release = device_release,
|
.release = device_release,
|
||||||
.sysfs_ops = &dev_sysfs_ops,
|
.sysfs_ops = &dev_sysfs_ops,
|
||||||
.namespace = device_namespace,
|
.namespace = device_namespace,
|
||||||
@@ -2992,7 +2992,7 @@ struct kobj_ns_type_operations *class_dir_child_ns_type(const struct kobject *ko
|
|||||||
return dir->class->ns_type;
|
return dir->class->ns_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_type class_dir_ktype = {
|
static const struct kobj_type class_dir_ktype = {
|
||||||
.release = class_dir_release,
|
.release = class_dir_release,
|
||||||
.sysfs_ops = &kobj_sysfs_ops,
|
.sysfs_ops = &kobj_sysfs_ops,
|
||||||
.child_ns_type = class_dir_child_ns_type
|
.child_ns_type = class_dir_child_ns_type
|
||||||
|
@@ -760,7 +760,7 @@ static void software_node_release(struct kobject *kobj)
|
|||||||
kfree(swnode);
|
kfree(swnode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct kobj_type software_node_type = {
|
static const struct kobj_type software_node_type = {
|
||||||
.release = software_node_release,
|
.release = software_node_release,
|
||||||
.sysfs_ops = &kobj_sysfs_ops,
|
.sysfs_ops = &kobj_sysfs_ops,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user