[Intel-gfx] [PATCH 11/18] drm/i915/display/sdvo: Prefer drm_WARN* over WARN*

Jani Nikula jani.nikula at linux.intel.com
Tue Apr 21 06:55:30 UTC 2020


On Mon, 06 Apr 2020, Pankaj Bharadiya <pankaj.laxminarayan.bharadiya at intel.com> wrote:
> struct drm_device specific drm_WARN* macros include device information
> in the backtrace, so we know what device the warnings originate from.
>
> Prefer drm_WARN* over WARN* calls.
>
> Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_sdvo.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c
> index e6306cbb7a3a..477465a9af90 100644
> --- a/drivers/gpu/drm/i915/display/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c
> @@ -431,7 +431,7 @@ static void intel_sdvo_debug_write(struct intel_sdvo *intel_sdvo, u8 cmd,
>  	else
>  		BUF_PRINT("(%02X)", cmd);
>  
> -	WARN_ON(pos >= sizeof(buffer) - 1);
> +	drm_WARN_ON(intel_sdvo->base.base.dev, pos >= sizeof(buffer) - 1);
>  #undef BUF_PRINT
>  
>  	DRM_DEBUG_KMS("%s: W: %02X %s\n", SDVO_NAME(intel_sdvo), cmd, buffer);
> @@ -597,7 +597,7 @@ static bool intel_sdvo_read_response(struct intel_sdvo *intel_sdvo,
>  		BUF_PRINT(" %02X", ((u8 *)response)[i]);
>  	}
>  
> -	WARN_ON(pos >= sizeof(buffer) - 1);
> +	drm_WARN_ON(intel_sdvo->base.base.dev, pos >= sizeof(buffer) - 1);
>  #undef BUF_PRINT
>  
>  	DRM_DEBUG_KMS("%s: R: %s\n", SDVO_NAME(intel_sdvo), buffer);
> @@ -1106,7 +1106,7 @@ static bool intel_sdvo_compute_avi_infoframe(struct intel_sdvo *intel_sdvo,
>  					   HDMI_QUANTIZATION_RANGE_FULL);
>  
>  	ret = hdmi_avi_infoframe_check(frame);
> -	if (WARN_ON(ret))
> +	if (drm_WARN_ON(intel_sdvo->base.base.dev, ret))
>  		return false;
>  
>  	return true;
> @@ -1123,11 +1123,12 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo,
>  	     intel_hdmi_infoframe_enable(HDMI_INFOFRAME_TYPE_AVI)) == 0)
>  		return true;
>  
> -	if (WARN_ON(frame->any.type != HDMI_INFOFRAME_TYPE_AVI))
> +	if (drm_WARN_ON(intel_sdvo->base.base.dev,
> +			frame->any.type != HDMI_INFOFRAME_TYPE_AVI))
>  		return false;
>  
>  	len = hdmi_infoframe_pack_only(frame, sdvo_data, sizeof(sdvo_data));
> -	if (WARN_ON(len < 0))
> +	if (drm_WARN_ON(intel_sdvo->base.base.dev, len < 0))

For most places, but especially places like this, I'd rather you added a
i915 local variable and used &i915->drm instead.

BR,
Jani.


>  		return false;
>  
>  	return intel_sdvo_write_infoframe(intel_sdvo, SDVO_HBUF_INDEX_AVI_IF,
> @@ -1257,7 +1258,8 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_state *pipe_config)
>  		clock->m1 = 12;
>  		clock->m2 = 8;
>  	} else {
> -		WARN(1, "SDVO TV clock out of range: %i\n", dotclock);
> +		drm_WARN(pipe_config->uapi.crtc->dev, 1,
> +			 "SDVO TV clock out of range: %i\n", dotclock);
>  	}
>  
>  	pipe_config->clock_set = true;
> @@ -2294,7 +2296,7 @@ intel_sdvo_connector_atomic_get_property(struct drm_connector *connector,
>  				return 0;
>  			}
>  
> -		WARN_ON(1);
> +		drm_WARN_ON(connector->dev, 1);
>  		*val = 0;
>  	} else if (property == intel_sdvo_connector->top ||
>  		   property == intel_sdvo_connector->bottom)

-- 
Jani Nikula, Intel Open Source Graphics Center


More information about the Intel-gfx mailing list