Currently our PARAMS_FOR_EACH macro contains only param type and name. We use this macro to define struct members, but later on we initialize this struct using handcrafted code, which leads in some cases to use mismatched value vs. type. Let's extend our root macro with param default value to keep them in sync. Also drop ; from the macro to allow more flexible usages. Later on we can also add there permission, unsafe tag and description. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx> Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/i915_debugfs.c | 2 +- drivers/gpu/drm/i915/i915_gpu_error.c | 6 +-- drivers/gpu/drm/i915/i915_params.c | 42 ++---------------- drivers/gpu/drm/i915/i915_params.h | 82 +++++++++++++++++------------------ 4 files changed, 48 insertions(+), 84 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 7e0816c..845b740 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c @@ -66,7 +66,7 @@ static int i915_capabilities(struct seq_file *m, void *data) #undef PRINT_FLAG kernel_param_lock(THIS_MODULE); -#define PRINT_PARAM(T, x) seq_print_param(m, #x, #T, &i915.x); +#define PRINT_PARAM(T, x, v) seq_print_param(m, #x, #T, &i915.x); I915_PARAMS_FOR_EACH(PRINT_PARAM); #undef PRINT_PARAM kernel_param_unlock(THIS_MODULE); diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c index e18f350..4f181b4 100644 --- a/drivers/gpu/drm/i915/i915_gpu_error.c +++ b/drivers/gpu/drm/i915/i915_gpu_error.c @@ -566,7 +566,7 @@ static __always_inline void err_print_param(struct drm_i915_error_state_buf *m, static void err_print_params(struct drm_i915_error_state_buf *m, const struct i915_params *p) { -#define PRINT(T, x) err_print_param(m, #x, #T, &p->x); +#define PRINT(T, x, v) err_print_param(m, #x, #T, &p->x); I915_PARAMS_FOR_EACH(PRINT); #undef PRINT } @@ -860,7 +860,7 @@ void __i915_gpu_state_free(struct kref *error_ref) kfree(error->overlay); kfree(error->display); -#define FREE(T, x) free_param(#T, &error->params.x); +#define FREE(T, x, v) free_param(#T, &error->params.x); I915_PARAMS_FOR_EACH(FREE); #undef FREE @@ -1694,7 +1694,7 @@ static int capture(void *data) error->i915->gt.last_init_time)); error->params = i915; -#define DUP(T, x) dup_param(#T, &error->params.x); +#define DUP(T, x, v) dup_param(#T, &error->params.x); I915_PARAMS_FOR_EACH(DUP); #undef DUP diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c index b6a7e36..e74c7bd 100644 --- a/drivers/gpu/drm/i915/i915_params.c +++ b/drivers/gpu/drm/i915/i915_params.c @@ -25,47 +25,11 @@ #include "i915_params.h" #include "i915_drv.h" +#define MEMBER(T, member, value) .member = value, struct i915_params i915 __read_mostly = { - .modeset = -1, - .panel_ignore_lid = 1, - .semaphores = -1, - .lvds_channel_mode = 0, - .panel_use_ssc = -1, - .vbt_sdvo_panel_type = -1, - .enable_rc6 = -1, - .enable_dc = -1, - .enable_fbc = -1, - .enable_execlists = -1, - .enable_hangcheck = true, - .enable_ppgtt = -1, - .enable_psr = -1, - .alpha_support = IS_ENABLED(CONFIG_DRM_I915_ALPHA_SUPPORT), - .disable_power_well = -1, - .enable_ips = 1, - .fastboot = 0, - .prefault_disable = 0, - .load_detect_test = 0, - .force_reset_modeset_test = 0, - .reset = true, - .error_capture = true, - .invert_brightness = 0, - .disable_display = 0, - .enable_cmd_parser = true, - .use_mmio_flip = 0, - .mmio_debug = 0, - .verbose_state_checks = 1, - .nuclear_pageflip = 0, - .edp_vswing = 0, - .enable_guc_loading = 0, - .enable_guc_submission = 0, - .guc_log_level = -1, - .guc_firmware_path = NULL, - .huc_firmware_path = NULL, - .enable_dp_mst = true, - .inject_load_failure = 0, - .enable_dpcd_backlight = false, - .enable_gvt = false, + I915_PARAMS_FOR_EACH(MEMBER) }; +#undef MEMBER module_param_named(modeset, i915.modeset, int, 0400); MODULE_PARM_DESC(modeset, diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h index 34148cc..ca72a8c 100644 --- a/drivers/gpu/drm/i915/i915_params.h +++ b/drivers/gpu/drm/i915/i915_params.h @@ -28,50 +28,50 @@ #include <linux/cache.h> /* for __read_mostly */ #define I915_PARAMS_FOR_EACH(func) \ - func(int, modeset); \ - func(int, panel_ignore_lid); \ - func(int, semaphores); \ - func(int, lvds_channel_mode); \ - func(int, panel_use_ssc); \ - func(int, vbt_sdvo_panel_type); \ - func(int, enable_rc6); \ - func(int, enable_dc); \ - func(int, enable_fbc); \ - func(int, enable_ppgtt); \ - func(int, enable_execlists); \ - func(int, enable_psr); \ - func(int, disable_power_well); \ - func(int, enable_ips); \ - func(int, invert_brightness); \ - func(int, enable_guc_loading); \ - func(int, enable_guc_submission); \ - func(int, guc_log_level); \ - func(char *, guc_firmware_path); \ - func(char *, huc_firmware_path); \ - func(int, use_mmio_flip); \ - func(int, mmio_debug); \ - func(int, edp_vswing); \ - func(unsigned int, inject_load_failure); \ + func(int, modeset, -1) \ + func(int, panel_ignore_lid, 1) \ + func(int, semaphores, -1) \ + func(int, lvds_channel_mode, 0) \ + func(int, panel_use_ssc, -1) \ + func(int, vbt_sdvo_panel_type, -1) \ + func(int, enable_rc6, -1) \ + func(int, enable_dc, -1) \ + func(int, enable_fbc, -1) \ + func(int, enable_ppgtt, -1) \ + func(int, enable_execlists, -1) \ + func(int, enable_psr, -1) \ + func(int, disable_power_well, -1) \ + func(int, enable_ips, 1) \ + func(int, invert_brightness, 0) \ + func(int, enable_guc_loading, 0) \ + func(int, enable_guc_submission, 0) \ + func(int, guc_log_level, -1) \ + func(char *, guc_firmware_path, NULL) \ + func(char *, huc_firmware_path, NULL) \ + func(int, use_mmio_flip, 0) \ + func(int, mmio_debug, 0) \ + func(int, edp_vswing, 0) \ + func(unsigned int, inject_load_failure, 0) \ /* leave bools at the end to not create holes */ \ - func(bool, alpha_support); \ - func(bool, enable_cmd_parser); \ - func(bool, enable_hangcheck); \ - func(bool, fastboot); \ - func(bool, prefault_disable); \ - func(bool, load_detect_test); \ - func(bool, force_reset_modeset_test); \ - func(bool, reset); \ - func(bool, error_capture); \ - func(bool, disable_display); \ - func(bool, verbose_state_checks); \ - func(bool, nuclear_pageflip); \ - func(bool, enable_dp_mst); \ - func(bool, enable_dpcd_backlight); \ - func(bool, enable_gvt) + func(bool, alpha_support, IS_ENABLED(CONFIG_DRM_I915_ALPHA_SUPPORT)) \ + func(bool, enable_cmd_parser, true) \ + func(bool, enable_hangcheck, true) \ + func(bool, fastboot, false) \ + func(bool, prefault_disable, false) \ + func(bool, load_detect_test, false) \ + func(bool, force_reset_modeset_test, false) \ + func(bool, reset, true) \ + func(bool, error_capture, true) \ + func(bool, disable_display, false) \ + func(bool, verbose_state_checks, true) \ + func(bool, nuclear_pageflip, false) \ + func(bool, enable_dp_mst, true) \ + func(bool, enable_dpcd_backlight, false) \ + func(bool, enable_gvt, false) -#define MEMBER(T, member) T member +#define MEMBER(T, member, value) T member; struct i915_params { - I915_PARAMS_FOR_EACH(MEMBER); + I915_PARAMS_FOR_EACH(MEMBER) }; #undef MEMBER -- 2.7.4 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx