[PATCH v6 2/3] drm/i915: Prepare error capture to work with const modparams

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We are planning to enforce "read_mostly" access to modparams.
Let start handle modparams as it was already defined as const.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx>
---
 drivers/gpu/drm/i915/i915_gpu_error.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index c7aaf62..15fe8ed 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -820,7 +820,7 @@ static void i915_error_object_free(struct drm_i915_error_object *obj)
 	kfree(obj);
 }
 
-static __always_inline void free_param(const char *type, void *x)
+static __always_inline void free_param(const char *type, const void *x)
 {
 	if (!__builtin_strcmp(type, "char *"))
 		kfree(*(void **)x);
@@ -1680,7 +1680,7 @@ static void i915_capture_gen_state(struct drm_i915_private *dev_priv,
 	       sizeof(error->device_info));
 }
 
-static __always_inline void dup_param(const char *type, void *x)
+static __always_inline void dup_param(const char *type, const void *x)
 {
 	if (!__builtin_strcmp(type, "char *"))
 		*(void **)x = kstrdup(*(void **)x, GFP_ATOMIC);
@@ -1696,7 +1696,7 @@ static int capture(void *data)
 		ktime_to_timeval(ktime_sub(ktime_get(),
 					   error->i915->gt.last_init_time));
 
-	error->params = i915_modparams;
+	memcpy(&error->params, &i915_modparams, sizeof(i915_modparams));
 #define DUP(T, x) dup_param(#T, &error->params.x);
 	I915_PARAMS_FOR_EACH(DUP);
 #undef DUP
-- 
2.7.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux