drm/i915: Make kobj_type structures constant
authorThomas Weißschuh <linux@weissschuh.net>
Thu, 16 Feb 2023 01:05:30 +0000 (01:05 +0000)
committerJani Nikula <jani.nikula@intel.com>
Fri, 17 Feb 2023 09:50:28 +0000 (11:50 +0200)
Since commit ee6d3dd4ed48 ("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>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230216-kobj_type-i915-v1-1-ca65c9b93518@weissschuh.net
drivers/gpu/drm/i915/gt/intel_gt_sysfs.c
drivers/gpu/drm/i915/gt/sysfs_engines.c

index 6629e4c..33cba40 100644 (file)
@@ -72,7 +72,7 @@ static void kobj_gt_release(struct kobject *kobj)
 {
 }
 
-static struct kobj_type kobj_gt_type = {
+static const struct kobj_type kobj_gt_type = {
        .release = kobj_gt_release,
        .sysfs_ops = &kobj_sysfs_ops,
        .default_groups = id_groups,
index 323cead..7eae326 100644 (file)
@@ -419,7 +419,7 @@ static void kobj_engine_release(struct kobject *kobj)
        kfree(kobj);
 }
 
-static struct kobj_type kobj_engine_type = {
+static const struct kobj_type kobj_engine_type = {
        .release = kobj_engine_release,
        .sysfs_ops = &kobj_sysfs_ops
 };