[Intel-xe] [PATCH 1/2] drm/xe: make kobject type struct as constant

Nirmoy Das nirmoy.das at linux.intel.com
Mon Jul 3 19:25:10 UTC 2023


On 7/3/2023 11:19 AM, Tejas Upadhyay wrote:
> 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 definition to prevent
> modification at runtime.
>
> Signed-off-by: Tejas Upadhyay <tejas.upadhyay at intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_gt_sysfs.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_sysfs.c b/drivers/gpu/drm/xe/xe_gt_sysfs.c
> index 13570987a756..2c47059bef42 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sysfs.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sysfs.c
> @@ -17,7 +17,7 @@ static void xe_gt_sysfs_kobj_release(struct kobject *kobj)
>   	kfree(kobj);
>   }
>   
> -static struct kobj_type xe_gt_sysfs_kobj_type = {
> +static const struct kobj_type xe_gt_sysfs_kobj_type = {
>   	.release = xe_gt_sysfs_kobj_release,
>   	.sysfs_ops = &kobj_sysfs_ops,
>   };


More information about the Intel-xe mailing list