提交 7075cb85 编写于 作者: M Michal Wajdeczko 提交者: Joonas Lahtinen

drm/i915: Extend I915_PARAMS_FOR_EACH with default member value

By combining default value into helper macro we can initialize
modparams struct in the same automatic way as it was declared.
This will initialize members in the same order as declared
and additionally will disallow declaring new member without
proper default value for it.

v2: make MEMBER macro more robust (Joonas)
Signed-off-by: NMichal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk>
Acked-by: NJani Nikula <jani.nikula@intel.com>
Reviewed-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: NJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170925105008.46060-2-michal.wajdeczko@intel.com
上级 54fea2b9
...@@ -66,7 +66,7 @@ static int i915_capabilities(struct seq_file *m, void *data) ...@@ -66,7 +66,7 @@ static int i915_capabilities(struct seq_file *m, void *data)
#undef PRINT_FLAG #undef PRINT_FLAG
kernel_param_lock(THIS_MODULE); kernel_param_lock(THIS_MODULE);
#define PRINT_PARAM(T, x) seq_print_param(m, #x, #T, &i915_modparams.x); #define PRINT_PARAM(T, x, ...) seq_print_param(m, #x, #T, &i915_modparams.x);
I915_PARAMS_FOR_EACH(PRINT_PARAM); I915_PARAMS_FOR_EACH(PRINT_PARAM);
#undef PRINT_PARAM #undef PRINT_PARAM
kernel_param_unlock(THIS_MODULE); kernel_param_unlock(THIS_MODULE);
......
...@@ -572,7 +572,7 @@ static __always_inline void err_print_param(struct drm_i915_error_state_buf *m, ...@@ -572,7 +572,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, static void err_print_params(struct drm_i915_error_state_buf *m,
const struct i915_params *p) const struct i915_params *p)
{ {
#define PRINT(T, x) err_print_param(m, #x, #T, &p->x); #define PRINT(T, x, ...) err_print_param(m, #x, #T, &p->x);
I915_PARAMS_FOR_EACH(PRINT); I915_PARAMS_FOR_EACH(PRINT);
#undef PRINT #undef PRINT
} }
...@@ -866,7 +866,7 @@ void __i915_gpu_state_free(struct kref *error_ref) ...@@ -866,7 +866,7 @@ void __i915_gpu_state_free(struct kref *error_ref)
kfree(error->overlay); kfree(error->overlay);
kfree(error->display); kfree(error->display);
#define FREE(T, x) free_param(#T, &error->params.x); #define FREE(T, x, ...) free_param(#T, &error->params.x);
I915_PARAMS_FOR_EACH(FREE); I915_PARAMS_FOR_EACH(FREE);
#undef FREE #undef FREE
...@@ -1704,7 +1704,7 @@ static int capture(void *data) ...@@ -1704,7 +1704,7 @@ static int capture(void *data)
error->i915->gt.last_init_time)); error->i915->gt.last_init_time));
error->params = i915_modparams; error->params = i915_modparams;
#define DUP(T, x) dup_param(#T, &error->params.x); #define DUP(T, x, ...) dup_param(#T, &error->params.x);
I915_PARAMS_FOR_EACH(DUP); I915_PARAMS_FOR_EACH(DUP);
#undef DUP #undef DUP
......
...@@ -33,45 +33,9 @@ ...@@ -33,45 +33,9 @@
MODULE_PARM_DESC(name, desc) MODULE_PARM_DESC(name, desc)
struct i915_params i915_modparams __read_mostly = { struct i915_params i915_modparams __read_mostly = {
.modeset = -1, #define MEMBER(T, member, value) .member = (value),
.panel_ignore_lid = 1, I915_PARAMS_FOR_EACH(MEMBER)
.semaphores = -1, #undef MEMBER
.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 = 2,
.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_param_named(modeset, int, 0400, i915_param_named(modeset, int, 0400,
......
...@@ -28,49 +28,49 @@ ...@@ -28,49 +28,49 @@
#include <linux/cache.h> /* for __read_mostly */ #include <linux/cache.h> /* for __read_mostly */
#define I915_PARAMS_FOR_EACH(param) \ #define I915_PARAMS_FOR_EACH(param) \
param(char *, vbt_firmware) \ param(char *, vbt_firmware, NULL) \
param(int, modeset) \ param(int, modeset, -1) \
param(int, panel_ignore_lid) \ param(int, panel_ignore_lid, 1) \
param(int, semaphores) \ param(int, semaphores, -1) \
param(int, lvds_channel_mode) \ param(int, lvds_channel_mode, 0) \
param(int, panel_use_ssc) \ param(int, panel_use_ssc, -1) \
param(int, vbt_sdvo_panel_type) \ param(int, vbt_sdvo_panel_type, -1) \
param(int, enable_rc6) \ param(int, enable_rc6, -1) \
param(int, enable_dc) \ param(int, enable_dc, -1) \
param(int, enable_fbc) \ param(int, enable_fbc, -1) \
param(int, enable_ppgtt) \ param(int, enable_ppgtt, -1) \
param(int, enable_execlists) \ param(int, enable_execlists, -1) \
param(int, enable_psr) \ param(int, enable_psr, -1) \
param(int, disable_power_well) \ param(int, disable_power_well, -1) \
param(int, enable_ips) \ param(int, enable_ips, 1) \
param(int, invert_brightness) \ param(int, invert_brightness, 0) \
param(int, enable_guc_loading) \ param(int, enable_guc_loading, 0) \
param(int, enable_guc_submission) \ param(int, enable_guc_submission, 0) \
param(int, guc_log_level) \ param(int, guc_log_level, -1) \
param(char *, guc_firmware_path) \ param(char *, guc_firmware_path, NULL) \
param(char *, huc_firmware_path) \ param(char *, huc_firmware_path, NULL) \
param(int, use_mmio_flip) \ param(int, use_mmio_flip, 0) \
param(int, mmio_debug) \ param(int, mmio_debug, 0) \
param(int, edp_vswing) \ param(int, edp_vswing, 0) \
param(int, reset) \ param(int, reset, 2) \
param(unsigned int, inject_load_failure) \ param(unsigned int, inject_load_failure, 0) \
/* leave bools at the end to not create holes */ \ /* leave bools at the end to not create holes */ \
param(bool, alpha_support) \ param(bool, alpha_support, IS_ENABLED(CONFIG_DRM_I915_ALPHA_SUPPORT)) \
param(bool, enable_cmd_parser) \ param(bool, enable_cmd_parser, true) \
param(bool, enable_hangcheck) \ param(bool, enable_hangcheck, true) \
param(bool, fastboot) \ param(bool, fastboot, 0) \
param(bool, prefault_disable) \ param(bool, prefault_disable, 0) \
param(bool, load_detect_test) \ param(bool, load_detect_test, 0) \
param(bool, force_reset_modeset_test) \ param(bool, force_reset_modeset_test, 0) \
param(bool, error_capture) \ param(bool, error_capture, true) \
param(bool, disable_display) \ param(bool, disable_display, 0) \
param(bool, verbose_state_checks) \ param(bool, verbose_state_checks, 1) \
param(bool, nuclear_pageflip) \ param(bool, nuclear_pageflip, 0) \
param(bool, enable_dp_mst) \ param(bool, enable_dp_mst, true) \
param(bool, enable_dpcd_backlight) \ param(bool, enable_dpcd_backlight, false) \
param(bool, enable_gvt) param(bool, enable_gvt, false)
#define MEMBER(T, member) T member; #define MEMBER(T, member, ...) T member;
struct i915_params { struct i915_params {
I915_PARAMS_FOR_EACH(MEMBER); I915_PARAMS_FOR_EACH(MEMBER);
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册