Re: [PATCH 12/18] drm/i915/display/tc: Prefer drm_WARN_ON over WARN_ON

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 06 Apr 2020, Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@xxxxxxxxx> 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_ON over WARN_ON.
>
> Conversion is done with below sementic patch:
>
> @@
> identifier func, T;
> @@
> func(struct intel_digital_port *T,...) {
> <+...
> -WARN_ON(
> +drm_WARN_ON(T->base.base.dev,
> ...)
> ...+>
>
> }
>
> Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@xxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/display/intel_tc.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_tc.c b/drivers/gpu/drm/i915/display/intel_tc.c
> index 9b850c11aa78..7d4172498320 100644
> --- a/drivers/gpu/drm/i915/display/intel_tc.c
> +++ b/drivers/gpu/drm/i915/display/intel_tc.c
> @@ -295,12 +295,12 @@ static void icl_tc_phy_connect(struct intel_digital_port *dig_port,
>  	}
>  
>  	if (!icl_tc_phy_set_safe_mode(dig_port, false) &&
> -	    !WARN_ON(dig_port->tc_legacy_port))
> +	    !drm_WARN_ON(dig_port->base.base.dev, dig_port->tc_legacy_port))
>  		goto out_set_tbt_alt_mode;
>  
>  	max_lanes = intel_tc_port_fia_max_lane_count(dig_port);
>  	if (dig_port->tc_legacy_port) {
> -		WARN_ON(max_lanes != 4);
> +		drm_WARN_ON(dig_port->base.base.dev, max_lanes != 4);

The patch needs a rebase, and please use i915 local variable.

BR,
Jani.

>  		dig_port->tc_mode = TC_PORT_LEGACY;
>  
>  		return;
> @@ -381,14 +381,16 @@ intel_tc_port_get_current_mode(struct intel_digital_port *dig_port)
>  	bool in_safe_mode = icl_tc_phy_is_in_safe_mode(dig_port);
>  	enum tc_port_mode mode;
>  
> -	if (in_safe_mode || WARN_ON(!icl_tc_phy_status_complete(dig_port)))
> +	if (in_safe_mode || drm_WARN_ON(dig_port->base.base.dev,
> +					!icl_tc_phy_status_complete(dig_port)))
>  		return TC_PORT_TBT_ALT;
>  
>  	mode = dig_port->tc_legacy_port ? TC_PORT_LEGACY : TC_PORT_DP_ALT;
>  	if (live_status_mask) {
>  		enum tc_port_mode live_mode = fls(live_status_mask) - 1;
>  
> -		if (!WARN_ON(live_mode == TC_PORT_TBT_ALT))
> +		if (!drm_WARN_ON(dig_port->base.base.dev,
> +				 live_mode == TC_PORT_TBT_ALT))
>  			mode = live_mode;
>  	}
>  
> @@ -432,7 +434,7 @@ static void
>  intel_tc_port_link_init_refcount(struct intel_digital_port *dig_port,
>  				 int refcount)
>  {
> -	WARN_ON(dig_port->tc_link_refcount);
> +	drm_WARN_ON(dig_port->base.base.dev, dig_port->tc_link_refcount);
>  	dig_port->tc_link_refcount = refcount;
>  }

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux