On Thu, Feb 15, 2024 at 06:40:48PM +0200, Ville Syrjala wrote: > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Utilize drm_printer in pipe_config_infoframe_mismatch() to avoid > a bit of code duplication. > > print_hex_dump() doesn't know anything about the printer so > it still needs the DRM_UT_KMS check and special handling for > the loglevel. But at least we end up with a bit less copy-pasta. > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/intel_display.c | 37 ++++++++++---------- > 1 file changed, 19 insertions(+), 18 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c > index 0292c49e0dad..e5010049d52e 100644 > --- a/drivers/gpu/drm/i915/display/intel_display.c > +++ b/drivers/gpu/drm/i915/display/intel_display.c > @@ -4866,33 +4866,34 @@ pipe_config_buffer_mismatch(bool fastset, const struct intel_crtc *crtc, > const char *name, > const u8 *a, const u8 *b, size_t len) > { > - struct drm_i915_private *dev_priv = to_i915(crtc->base.dev); > + struct drm_i915_private *i915 = to_i915(crtc->base.dev); > + struct drm_printer p; > + const char *loglevel; > > if (fastset) { > if (!drm_debug_enabled(DRM_UT_KMS)) > return; > > - /* only dump up to the last difference */ > - len = memcmp_diff_len(a, b, len); > + p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); > + loglevel = KERN_DEBUG; > > - drm_dbg_kms(&dev_priv->drm, > - "[CRTC:%d:%s] fastset requirement not met in %s buffer\n", > - crtc->base.base.id, crtc->base.name, name); > - print_hex_dump(KERN_DEBUG, "expected: ", DUMP_PREFIX_NONE, > - 16, 0, a, len, false); > - print_hex_dump(KERN_DEBUG, "found: ", DUMP_PREFIX_NONE, > - 16, 0, b, len, false); > + drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s buffer\n", > + crtc->base.base.id, crtc->base.name, name); > } else { > - /* only dump up to the last difference */ > - len = memcmp_diff_len(a, b, len); > + p = drm_err_printer(&i915->drm, NULL); > + loglevel = KERN_ERR; > > - drm_err(&dev_priv->drm, "[CRTC:%d:%s] mismatch in %s buffer\n", > - crtc->base.base.id, crtc->base.name, name); > - print_hex_dump(KERN_ERR, "expected: ", DUMP_PREFIX_NONE, > - 16, 0, a, len, false); > - print_hex_dump(KERN_ERR, "found: ", DUMP_PREFIX_NONE, > - 16, 0, b, len, false); > + drm_printf(&p, "[CRTC:%d:%s] mismatch in %s buffer\n", > + crtc->base.base.id, crtc->base.name, name); > } > + > + /* only dump up to the last difference */ > + len = memcmp_diff_len(a, b, len); > + > + print_hex_dump(loglevel, "expected: ", DUMP_PREFIX_NONE, > + 16, 0, a, len, false); > + print_hex_dump(loglevel, "found: ", DUMP_PREFIX_NONE, > + 16, 0, b, len, false); > } > > static void __printf(4, 5) > -- > 2.43.0 >