intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Manasi Navare <manasi.d.navare@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dhinakaran.pandiyan@intel.com
Subject: Re: [PATCH v3 03/14] drm/i915/dp: rename rate_to_index() to intel_dp_rate_index() and reuse
Date: Tue, 4 Apr 2017 12:19:35 -0700	[thread overview]
Message-ID: <20170404191935.GD2688@intel.com> (raw)
In-Reply-To: <c7b6197aaa12e368a0d024dc142fa574fd0443a7.1490712890.git.jani.nikula@intel.com>

On Tue, Mar 28, 2017 at 05:59:03PM +0300, Jani Nikula wrote:
> Rename the function, move it at the top, and reuse in
> intel_dp_link_rate_index(). If there was a reason in the past to use
> reverse search order here, there isn't now.
> 
> The names may be slightly confusing now, but intel_dp_link_rate_index()
> will go away in follow-up patches.
> 
> v2: Use name intel_dp_rate_index (Dhinakaran)
> 
> Cc: Manasi Navare <manasi.d.navare@intel.com>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
   Reviewed-by: <manasi.d.navare@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 34 +++++++++++++++-------------------
>  1 file changed, 15 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 0e200a37b75b..9fc066dda4e0 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -266,6 +266,18 @@ static int intersect_rates(const int *source_rates, int source_len,
>  	return k;
>  }
>  
> +/* return index of rate in rates array, or -1 if not found */
> +static int intel_dp_rate_index(const int *rates, int len, int rate)
> +{
> +	int i;
> +
> +	for (i = 0; i < len; i++)
> +		if (rate == rates[i])
> +			return i;
> +
> +	return -1;
> +}
> +
>  static int intel_dp_common_rates(struct intel_dp *intel_dp,
>  				 int *common_rates)
>  {
> @@ -284,15 +296,10 @@ static int intel_dp_link_rate_index(struct intel_dp *intel_dp,
>  				    int *common_rates, int link_rate)
>  {
>  	int common_len;
> -	int index;
>  
>  	common_len = intel_dp_common_rates(intel_dp, common_rates);
> -	for (index = 0; index < common_len; index++) {
> -		if (link_rate == common_rates[common_len - index - 1])
> -			return common_len - index - 1;
> -	}
>  
> -	return -1;
> +	return intel_dp_rate_index(common_rates, common_len, link_rate);
>  }
>  
>  int intel_dp_get_link_train_fallback_values(struct intel_dp *intel_dp,
> @@ -1538,17 +1545,6 @@ bool intel_dp_read_desc(struct intel_dp *intel_dp)
>  	return true;
>  }
>  
> -static int rate_to_index(const int *rates, int len, int rate)
> -{
> -	int i;
> -
> -	for (i = 0; i < len; i++)
> -		if (rate == rates[i])
> -			return i;
> -
> -	return -1;
> -}
> -
>  int
>  intel_dp_max_link_rate(struct intel_dp *intel_dp)
>  {
> @@ -1564,8 +1560,8 @@ intel_dp_max_link_rate(struct intel_dp *intel_dp)
>  
>  int intel_dp_rate_select(struct intel_dp *intel_dp, int rate)
>  {
> -	int i = rate_to_index(intel_dp->sink_rates, intel_dp->num_sink_rates,
> -			      rate);
> +	int i = intel_dp_rate_index(intel_dp->sink_rates,
> +				    intel_dp->num_sink_rates, rate);
>  
>  	if (WARN_ON(i < 0))
>  		i = 0;
> -- 
> 2.1.4
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-04-04 19:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28 14:59 [PATCH v3 00/14] drm/i915/dp: link rate and lane count refactoring Jani Nikula
2017-03-28 14:59 ` [PATCH v3 01/14] drm/i915/dp: use known correct array size in rate_to_index Jani Nikula
2017-04-04 19:16   ` Manasi Navare
2017-03-28 14:59 ` [PATCH v3 02/14] drm/i915/dp: return errors from rate_to_index() Jani Nikula
2017-03-28 19:16   ` Manasi Navare
2017-03-29  7:17     ` Jani Nikula
2017-04-04 19:17       ` Manasi Navare
2017-03-28 14:59 ` [PATCH v3 03/14] drm/i915/dp: rename rate_to_index() to intel_dp_rate_index() and reuse Jani Nikula
2017-04-04 19:19   ` Manasi Navare [this message]
2017-03-28 14:59 ` [PATCH v3 04/14] drm/i915/dp: cache source rates at init Jani Nikula
2017-04-05  1:17   ` Manasi Navare
2017-03-28 14:59 ` [PATCH v3 05/14] drm/i915/dp: generate and cache sink rate array for all DP, not just eDP 1.4 Jani Nikula
2017-04-05  1:20   ` Manasi Navare
2017-04-06 11:41     ` Jani Nikula
2017-03-28 14:59 ` [PATCH v3 06/14] drm/i915/dp: use the sink rates array for max sink rates Jani Nikula
2017-03-28 14:59 ` [PATCH v3 07/14] drm/i915/dp: cache common rates with " Jani Nikula
2017-04-05  1:21   ` Manasi Navare
2017-03-28 14:59 ` [PATCH v3 08/14] drm/i915/dp: do not limit rate seek when not needed Jani Nikula
2017-03-28 21:02   ` Manasi Navare
2017-03-29  9:23   ` [PATCH] " Jani Nikula
2017-04-05  1:24     ` Manasi Navare
2017-03-28 14:59 ` [PATCH v3 09/14] drm/i915/dp: don't call the link parameters sink parameters Jani Nikula
2017-03-28 21:11   ` Manasi Navare
2017-03-28 14:59 ` [PATCH v3 10/14] drm/i915/dp: add functions for max common link rate and lane count Jani Nikula
2017-03-28 21:47   ` Manasi Navare
2017-03-28 14:59 ` [PATCH v3 11/14] drm/i915/mst: use max link not sink " Jani Nikula
2017-03-28 21:51   ` Manasi Navare
2017-03-28 14:59 ` [PATCH v3 12/14] drm/i915/dp: localize link rate index variable more Jani Nikula
2017-03-28 22:00   ` Manasi Navare
2017-03-29  7:22     ` Jani Nikula
2017-04-05  1:26       ` Manasi Navare
2017-03-28 14:59 ` [PATCH v3 13/14] drm/i915/dp: use readb and writeb calls for single byte DPCD access Jani Nikula
2017-04-05  1:28   ` Manasi Navare
2017-03-28 14:59 ` [PATCH v3 14/14] drm/i915/dp: read sink count to a temporary variable first Jani Nikula
2017-03-28 16:50 ` ✓ Fi.CI.BAT: success for drm/i915/dp: link rate and lane count refactoring (rev3) Patchwork
2017-03-29  9:48 ` ✓ Fi.CI.BAT: success for drm/i915/dp: link rate and lane count refactoring (rev4) Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170404191935.GD2688@intel.com \
    --to=manasi.d.navare@intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).