On Fri, Jul 29, 2016 at 11:35:27AM +0200, Daniel Vetter wrote: > On Thu, Jul 28, 2016 at 05:50:46PM +0300, ville.syrjala@xxxxxxxxxxxxxxx wrote: > > From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > > > Let's make rate_to_index() return the highest rate available that's > > less than or equal to the rate requested by the caller. The function > > can then be used to filter out rates higher than a certain maximum > > rate. > > > > Cc: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira@xxxxxxxxx> > > Cc: Jim Bride <jim.bride@xxxxxxxxxxxxxxx> > > Cc: Manasi D Navare <manasi.d.navare@xxxxxxxxx> > > Cc: Durgadoss R <durgadoss.r@xxxxxxxxx> > > Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > > Not sure what this will be used for, couldn't figure it out looking at > later patches? Ah, forgot to mention that part. It seemed like there was a hunk in the upfront link training patch that could use this, rather than hand rolling yet another way of looking through the rate array. > -Daneil > > > --- > > drivers/gpu/drm/i915/intel_dp.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c > > index 40cae6202160..08d95352ffd6 100644 > > --- a/drivers/gpu/drm/i915/intel_dp.c > > +++ b/drivers/gpu/drm/i915/intel_dp.c > > @@ -1431,10 +1431,13 @@ static int rate_to_index(int find, const int *rates) > > int i = 0; > > > > for (i = 0; i < DP_MAX_SUPPORTED_RATES; ++i) > > - if (find == rates[i]) > > + if (find < rates[i]) > > break; > > > > - return i; > > + if (WARN_ON(i == 0)) > > + return 0; > > + > > + return i - 1; > > } > > > > int > > -- > > 2.7.4 > > > > _______________________________________________ > > Intel-gfx mailing list > > Intel-gfx@xxxxxxxxxxxxxxxxxxxxx > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx > > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch -- Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx