Add a helper instead of open coding the plurals in debug logs. Also fixes the case for "0 display pipes available." Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> --- I stumbled upon the pipes one while working on ->num_pipes. I honestly thought we'd have more users than this, but to my surprise couldn't find any. Perhaps this is not worth it after all. --- drivers/gpu/drm/i915/display/intel_display.c | 2 +- drivers/gpu/drm/i915/i915_utils.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index e661e2099118..c4bfd80a1cfa 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -16215,7 +16215,7 @@ int intel_modeset_init(struct drm_device *dev) DRM_DEBUG_KMS("%d display pipe%s available.\n", INTEL_INFO(dev_priv)->num_pipes, - INTEL_INFO(dev_priv)->num_pipes > 1 ? "s" : ""); + plural(INTEL_INFO(dev_priv)->num_pipes)); for_each_pipe(dev_priv, pipe) { ret = intel_crtc_init(dev_priv, pipe); diff --git a/drivers/gpu/drm/i915/i915_utils.h b/drivers/gpu/drm/i915/i915_utils.h index 562f756da421..dc34dfe18a1e 100644 --- a/drivers/gpu/drm/i915/i915_utils.h +++ b/drivers/gpu/drm/i915/i915_utils.h @@ -410,6 +410,11 @@ static inline const char *enableddisabled(bool v) return v ? "enabled" : "disabled"; } +static inline const char *plural(long v) +{ + return v == 1 ? "" : "s"; +} + static inline void add_taint_for_CI(unsigned int taint) { /* -- 2.20.1 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx