accel: constify the struct device_type usage

Message ID 20240219-device_cleanup-accel-v1-1-5031e5046cff@marliere.net
State New
Headers
Series accel: constify the struct device_type usage |

Commit Message

Ricardo B. Marliere Feb. 19, 2024, 7:48 p.m. UTC
  Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
accel_sysfs_device_minor variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
---
 drivers/accel/drm_accel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: b401b621758e46812da61fa58a67c3fd8d91de0d
change-id: 20240219-device_cleanup-accel-a990dc3bfbc1

Best regards,
  

Comments

Oded Gabbay Feb. 26, 2024, 8:03 a.m. UTC | #1
On Mon, Feb 19, 2024 at 04:48:28PM -0300, Ricardo B. Marliere wrote:
> Since commit aed65af1cc2f ("drivers: make device_type const"), the driver
> core can properly handle constant struct device_type. Move the
> accel_sysfs_device_minor variable to be a constant structure as well,
> placing it into read-only memory which can not be modified at runtime.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net>
> ---
>  drivers/accel/drm_accel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/accel/drm_accel.c b/drivers/accel/drm_accel.c
> index 24cac4c0274b..16c3edb8c46e 100644
> --- a/drivers/accel/drm_accel.c
> +++ b/drivers/accel/drm_accel.c
> @@ -23,7 +23,7 @@ static struct idr accel_minors_idr;
>  
>  static struct dentry *accel_debugfs_root;
>  
> -static struct device_type accel_sysfs_device_minor = {
> +static const struct device_type accel_sysfs_device_minor = {
>  	.name = "accel_minor"
>  };
>  
> 
> ---
> base-commit: b401b621758e46812da61fa58a67c3fd8d91de0d
> change-id: 20240219-device_cleanup-accel-a990dc3bfbc1
> 
> Best regards,
> -- 
> Ricardo B. Marliere <ricardo@marliere.net>
> 
Applied to -next.
Thanks,
Oded
  

Patch

diff --git a/drivers/accel/drm_accel.c b/drivers/accel/drm_accel.c
index 24cac4c0274b..16c3edb8c46e 100644
--- a/drivers/accel/drm_accel.c
+++ b/drivers/accel/drm_accel.c
@@ -23,7 +23,7 @@  static struct idr accel_minors_idr;
 
 static struct dentry *accel_debugfs_root;
 
-static struct device_type accel_sysfs_device_minor = {
+static const struct device_type accel_sysfs_device_minor = {
 	.name = "accel_minor"
 };