Re: [PATCH 6/6] drm/i915/mst: use min_array() and max_array() instead of hand-rolling

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

 



On Fri, Jan 31, 2025 at 11:20:22AM +0200, Jani Nikula wrote:
> On Thu, 30 Jan 2025, Imre Deak <imre.deak@xxxxxxxxx> wrote:
> > On Thu, Jan 30, 2025 at 04:35:06PM +0200, Imre Deak wrote:
> >> On Wed, Jan 29, 2025 at 04:46:38PM +0200, Jani Nikula wrote:
> >> > Improve code clarity by using existing min_array() and max_array()
> >> > helpers to find the lowest and highest values in an array.
> >> > 
> >> > Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> >> 
> >> Reviewed-by: Imre Deak <imre.deak@xxxxxxxxx>
> >> 
> >> > ---
> >> >  drivers/gpu/drm/i915/display/intel_dp_mst.c | 13 +++----------
> >> >  1 file changed, 3 insertions(+), 10 deletions(-)
> >> > 
> >> > diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> >> > index a4ed4f379d1e..60b003bcd1ee 100644
> >> > --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c
> >> > +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c
> >> > @@ -391,7 +391,7 @@ static int mst_stream_dsc_compute_link_config(struct intel_dp *intel_dp,
> >> >  {
> >> >  	struct intel_display *display = to_intel_display(intel_dp);
> >> >  	struct intel_connector *connector = to_intel_connector(conn_state->connector);
> >> > -	int i, num_bpc;
> >> > +	int num_bpc;
> >> >  	u8 dsc_bpc[3] = {};
> >> >  	int min_bpp, max_bpp, sink_min_bpp, sink_max_bpp;
> >> >  	int min_compressed_bpp, max_compressed_bpp;
> >> > @@ -405,15 +405,8 @@ static int mst_stream_dsc_compute_link_config(struct intel_dp *intel_dp,
> >> >  	drm_dbg_kms(display->drm, "DSC Source supported min bpp %d max bpp %d\n",
> >> >  		    min_bpp, max_bpp);
> >> >  
> >> > -	sink_max_bpp = dsc_bpc[0] * 3;
> >> > -	sink_min_bpp = sink_max_bpp;
> >> > -
> >> > -	for (i = 1; i < num_bpc; i++) {
> >> > -		if (sink_min_bpp > dsc_bpc[i] * 3)
> >> > -			sink_min_bpp = dsc_bpc[i] * 3;
> >> > -		if (sink_max_bpp < dsc_bpc[i] * 3)
> >> > -			sink_max_bpp = dsc_bpc[i] * 3;
> >> > -	}
> >> > +	sink_min_bpp = min_array(dsc_bpc, num_bpc) * 3;
> >> > +	sink_max_bpp = max_array(dsc_bpc, num_bpc) * 3;
> >
> > Does linux/minmax.h need to be included explicitly for this?
> 
> It's included from kernel.h, so I figured not.

Side note: There've been a few discussions[1] around why relying on kernel.h
is not best of the ideas (just for future reference).

[1] https://lore.kernel.org/r/20230817143352.132583-2-lucas.segarra.fernandez@xxxxxxxxx/

Raag



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux