On Mon, 2017-09-25 at 09:45 +0000, Michal Wajdeczko wrote: > 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: Michal Wajdeczko <michal.wajdeczko@xxxxxxxxx> > Cc: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Cc: Jani Nikula <jani.nikula@xxxxxxxxx> > Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > Reviewed-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> > Acked-by: Jani Nikula <jani.nikula@xxxxxxxxx> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> <SNIP> > +++ b/drivers/gpu/drm/i915/i915_params.c > @@ -33,45 +33,9 @@ > MODULE_PARM_DESC(name, desc) > > struct i915_params i915_modparams __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 = 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, > +#define MEMBER(T, member, value) .member = (value), > + I915_PARAMS_FOR_EACH(MEMBER) To fix the problem that next patch is needed for; .member = typecheck(T, (value)) ? (value) : (value), Assuming it won't mess up GCC code generation. Can be sent as an extra patch on top when this gets in. Regards, Joonas -- Joonas Lahtinen Open Source Technology Center Intel Corporation _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx