On Thu, Feb 02, 2017 at 11:37:06AM +0200, Jani Nikula wrote: > On Thu, 02 Feb 2017, Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote: > > I want to print the struct from the error state and so would like to use > > the existing struct definition as the template ala DEV_INFO* > > > > v2: Use MEMBER() rather than p(). > > > > Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > > I've been telling everyone who complains about testing specific firmware > blob versions to add a module parameter to specify and override the > default filename. AFAICT this series does not make string parameters any > harder, but please do double check. I think they expect a static > allocation for the string buffer too, so the struct assignment should be > fine as well. charp which is the dynamically allocated string might be easier, certainly for 0400 parameters. Hmm. Except for copying into the error state, 0600 charp will take a bit more work (another iterator to kstrdup). diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 86649610b9eb..2d32dacebeb3 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -76,6 +76,13 @@ static void seq_param_uint(struct seq_file *m, const char *name, param_uint x) seq_printf(m, "i915.%s=%u\n", name, x); } +static void seq_param_charp(struct seq_file *m, const char *name, param_charp x) +{ + kernel_param_lock(THIS_MODULE); + seq_printf(m, "i915.%s=%s\n", name, x); + kernel_param_unlock(THIS_MODULE); +} + static int i915_capabilities(struct seq_file *m, void *data) { struct drm_i915_private *dev_priv = node_to_i915(m->private); diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index b8f2b671fc0a..35602935dba8 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -567,6 +567,15 @@ static void err_param_uint(struct drm_i915_error_state_buf *m, err_printf(m, "%s: %u\n", name, x); } +static void err_param_charp(struct drm_i915_error_state_buf *m, + const char *name, + param_charp x) +{ + kernel_param_lock(THIS_MODULE); + err_printf(m, "%s: %s\n", name, x); + kernel_param_unlock(THIS_MODULE); +} + static void err_print_params(struct drm_i915_error_state_buf *m, const struct i915_params *p) { diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index f1fa51190dc6..f9cc170577c2 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -65,6 +65,8 @@ struct i915_params i915 __read_mostly = { .enable_gvt = false, }; +module_param_named_unsafe(my_string, i915.my_string, charp, 0400); + module_param_named(modeset, i915.modeset, int, 0400); MODULE_PARM_DESC(modeset, "Use kernel modesetting [KMS] (0=disable, " diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h index 87ac6ed995d3..bc5aea9e3fb6 100644 --- a/drivers/gpu/drm/i915/i915_params.h +++ b/drivers/gpu/drm/i915/i915_params.h @@ -30,6 +30,7 @@ typedef bool param_bool; typedef int param_int; typedef unsigned int param_uint; +typedef char *param_charp; #define I915_PARAMS_FOR_EACH(func) \ func(param_int, modeset); \ @@ -54,6 +55,7 @@ typedef unsigned int param_uint; func(param_int, mmio_debug); \ func(param_int, edp_vswing); \ func(param_uint, inject_load_failure); \ + func(param_charp, my_string); \ /* leave bools at the end to not create holes */ \ func(param_bool, alpha_support); \ func(param_bool, enable_cmd_parser); \ -- Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx