mirror of
https://github.com/torvalds/linux.git
synced 2024-12-14 15:13:52 +00:00
drm/i915: add a helper to make a copy of i915_params
Abstract the one user in anticipation of more. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/c6a94b4da8dc723df025b1f602fe46d76d00d53f.1545920737.git.jani.nikula@intel.com
This commit is contained in:
parent
caa5915bb3
commit
4081cef923
@ -1834,18 +1834,9 @@ static void capture_gen_state(struct i915_gpu_state *error)
|
||||
error->driver_caps = i915->caps;
|
||||
}
|
||||
|
||||
static __always_inline void dup_param(const char *type, void *x)
|
||||
{
|
||||
if (!__builtin_strcmp(type, "char *"))
|
||||
*(void **)x = kstrdup(*(void **)x, GFP_ATOMIC);
|
||||
}
|
||||
|
||||
static void capture_params(struct i915_gpu_state *error)
|
||||
{
|
||||
error->params = i915_modparams;
|
||||
#define DUP(T, x, ...) dup_param(#T, &error->params.x);
|
||||
I915_PARAMS_FOR_EACH(DUP);
|
||||
#undef DUP
|
||||
i915_params_copy(&error->params, &i915_modparams);
|
||||
}
|
||||
|
||||
static unsigned long capture_find_epoch(const struct i915_gpu_state *error)
|
||||
|
@ -203,3 +203,17 @@ void i915_params_dump(const struct i915_params *params, struct drm_printer *p)
|
||||
I915_PARAMS_FOR_EACH(PRINT);
|
||||
#undef PRINT
|
||||
}
|
||||
|
||||
static __always_inline void dup_param(const char *type, void *x)
|
||||
{
|
||||
if (!__builtin_strcmp(type, "char *"))
|
||||
*(void **)x = kstrdup(*(void **)x, GFP_ATOMIC);
|
||||
}
|
||||
|
||||
void i915_params_copy(struct i915_params *dest, const struct i915_params *src)
|
||||
{
|
||||
*dest = *src;
|
||||
#define DUP(T, x, ...) dup_param(#T, &dest->x);
|
||||
I915_PARAMS_FOR_EACH(DUP);
|
||||
#undef DUP
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ struct i915_params {
|
||||
extern struct i915_params i915_modparams __read_mostly;
|
||||
|
||||
void i915_params_dump(const struct i915_params *params, struct drm_printer *p);
|
||||
void i915_params_copy(struct i915_params *dest, const struct i915_params *src);
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user