diff mbox

drm/i915/dp: Add a helper function to return DP link rate index

Message ID 1479766785-24095-1-git-send-email-manasi.d.navare@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Navare, Manasi Nov. 21, 2016, 10:19 p.m. UTC
Common rates array is used to keep track of common rates
supported between DP sink and source. This helper function
returns the index of a specific link rate in this common rates
array.

This is in prep with patches for DP Link training compliance
tests that need an index for the link rate specified by the
test as well as for link training failure handling patches that
require index of fallback link rate.

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

kernel test robot Nov. 22, 2016, 12:11 a.m. UTC | #1
Hi Manasi,

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on next-20161117]
[cannot apply to v4.9-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Manasi-Navare/drm-i915-dp-Add-a-helper-function-to-return-DP-link-rate-index/20161122-073517
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-x000-201647 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/i915/intel_dp.c:291:12: error: 'intel_dp_link_rate_index' defined but not used [-Werror=unused-function]
    static int intel_dp_link_rate_index(struct intel_dp *intel_dp,
               ^~~~~~~~~~~~~~~~~~~~~~~~
   Cyclomatic Complexity 5 include/linux/compiler.h:__read_once_size
   Cyclomatic Complexity 5 include/linux/compiler.h:__write_once_size
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:ffs
   Cyclomatic Complexity 1 arch/x86/include/asm/bitops.h:fls64
   Cyclomatic Complexity 1 include/linux/log2.h:__ilog2_u64
   Cyclomatic Complexity 1 include/linux/list.h:INIT_LIST_HEAD
   Cyclomatic Complexity 1 include/linux/err.h:ERR_PTR
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 3 include/linux/err.h:IS_ERR_OR_NULL
   Cyclomatic Complexity 1 arch/x86/include/asm/atomic.h:atomic_read
   Cyclomatic Complexity 1 include/asm-generic/getorder.h:__get_order
   Cyclomatic Complexity 1 arch/x86/include/asm/paravirt.h:arch_local_save_flags
   Cyclomatic Complexity 1 arch/x86/include/asm/irqflags.h:arch_irqs_disabled_flags
   Cyclomatic Complexity 1 arch/x86/include/asm/processor.h:rep_nop
   Cyclomatic Complexity 1 arch/x86/include/asm/processor.h:cpu_relax
   Cyclomatic Complexity 1 include/linux/mutex.h:mutex_is_locked
   Cyclomatic Complexity 1 arch/x86/include/asm/preempt.h:preempt_count
   Cyclomatic Complexity 1 include/linux/jiffies.h:_msecs_to_jiffies
   Cyclomatic Complexity 3 include/linux/jiffies.h:msecs_to_jiffies
   Cyclomatic Complexity 1 include/linux/jiffies.h:_usecs_to_jiffies
   Cyclomatic Complexity 3 include/linux/jiffies.h:usecs_to_jiffies
   Cyclomatic Complexity 2 include/linux/ktime.h:ktime_divns
   Cyclomatic Complexity 1 include/linux/ktime.h:ktime_to_ms
   Cyclomatic Complexity 1 include/linux/ktime.h:ktime_ms_delta
   Cyclomatic Complexity 1 include/linux/timekeeping.h:ktime_get_boottime
   Cyclomatic Complexity 1 include/linux/workqueue.h:to_delayed_work
   Cyclomatic Complexity 1 include/linux/workqueue.h:__init_work
   Cyclomatic Complexity 1 include/linux/workqueue.h:queue_delayed_work
   Cyclomatic Complexity 1 include/linux/workqueue.h:schedule_delayed_work
   Cyclomatic Complexity 1 include/linux/kasan.h:kasan_kmalloc
   Cyclomatic Complexity 28 include/linux/slab.h:kmalloc_index
   Cyclomatic Complexity 1 include/linux/slab.h:kmem_cache_alloc_trace
   Cyclomatic Complexity 1 include/linux/slab.h:kmalloc_order_trace
   Cyclomatic Complexity 68 include/linux/slab.h:kmalloc_large
   Cyclomatic Complexity 5 include/linux/slab.h:kmalloc
   Cyclomatic Complexity 1 include/linux/slab.h:kzalloc
   Cyclomatic Complexity 1 include/linux/ww_mutex.h:ww_mutex_is_locked
   Cyclomatic Complexity 1 include/drm/drm_modeset_lock.h:drm_modeset_is_locked
   Cyclomatic Complexity 3 include/drm/drmP.h:drm_can_sleep
   Cyclomatic Complexity 1 include/drm/drm_modeset_helper_vtables.h:drm_connector_helper_add
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_reg.h:i915_mmio_reg_offset
   Cyclomatic Complexity 2 drivers/gpu/drm/i915/i915_drv.h:yesno
   Cyclomatic Complexity 2 drivers/gpu/drm/i915/i915_drv.h:onoff
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_drv.h:to_i915
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_drv.h:intel_info
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/i915_drv.h:msecs_to_jiffies_timeout
   Cyclomatic Complexity 5 drivers/gpu/drm/i915/i915_drv.h:wait_remaining_ms_from_jiffies
   Cyclomatic Complexity 1 include/drm/drm_dp_helper.h:drm_dp_max_lane_count
   Cyclomatic Complexity 3 include/drm/drm_dp_helper.h:drm_dp_enhanced_frame_cap
   Cyclomatic Complexity 3 include/drm/drm_dp_helper.h:drm_dp_tps3_supported
   Cyclomatic Complexity 1 include/drm/drm_dp_helper.h:drm_dp_is_branch
   Cyclomatic Complexity 1 include/drm/drm_dp_helper.h:drm_dp_dpcd_readb
   Cyclomatic Complexity 1 include/drm/drm_dp_helper.h:drm_dp_dpcd_writeb
   Cyclomatic Complexity 2 drivers/gpu/drm/i915/intel_drv.h:vlv_pipe_to_channel
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_drv.h:intel_get_crtc_for_pipe
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_drv.h:intel_attached_encoder
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_drv.h:enc_to_dig_port
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_drv.h:enc_to_intel_dp
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_drv.h:dp_to_dig_port
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_drv.h:intel_crtc_has_type
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_drv.h:intel_wait_for_vblank
   Cyclomatic Complexity 2 drivers/gpu/drm/i915/intel_drv.h:intel_wait_for_vblank_if_active
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_drv.h:intel_dp_unused_lane_mask
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:is_edp
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:intel_dp_to_dev
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:intel_attached_dp
   Cyclomatic Complexity 2 drivers/gpu/drm/i915/intel_dp.c:intel_dp_max_lane_count
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:intel_dp_link_required
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:intel_dp_max_data_rate
   Cyclomatic Complexity 3 drivers/gpu/drm/i915/intel_dp.c:intel_dp_unpack_aux
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:vlv_pipe_has_pp_on
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:vlv_pipe_has_vdd_on
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:vlv_pipe_any
   Cyclomatic Complexity 4 drivers/gpu/drm/i915/intel_dp.c:vlv_initial_pps_pipe
   Cyclomatic Complexity 2 drivers/gpu/drm/i915/intel_dp.c:g4x_get_aux_clock_divider
   Cyclomatic Complexity 3 drivers/gpu/drm/i915/intel_dp.c:ilk_get_aux_clock_divider
   Cyclomatic Complexity 5 drivers/gpu/drm/i915/intel_dp.c:hsw_get_aux_clock_divider
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:skl_get_aux_clock_divider
   Cyclomatic Complexity 5 drivers/gpu/drm/i915/intel_dp.c:g4x_get_aux_send_ctl
   Cyclomatic Complexity 2 drivers/gpu/drm/i915/intel_dp.c:skl_get_aux_send_ctl
   Cyclomatic Complexity 8 drivers/gpu/drm/i915/intel_dp.c:intel_dp_set_clock
   Cyclomatic Complexity 3 drivers/gpu/drm/i915/intel_dp.c:rate_to_index
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:wait_backlight_on
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:edp_wait_backlight_off
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:edp_panel_vdd_schedule_off
   Cyclomatic Complexity 7 drivers/gpu/drm/i915/intel_dp.c:gen4_signal_levels
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:intel_dp_autotest_link_training
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:intel_dp_autotest_video_pattern
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:intel_dp_autotest_phy_pattern
   Cyclomatic Complexity 1 drivers/gpu/drm/i915/intel_dp.c:intel_dp_init_panel_power_timestamps
   Cyclomatic Complexity 3 drivers/gpu/drm/i915/intel_dp.c:intel_dp_max_link_bw
   Cyclomatic Complexity 2 drivers/gpu/drm/i915/intel_dp.c:intel_dp_sink_rates
   Cyclomatic Complexity 6 drivers/gpu/drm/i915/intel_dp.c:intersect_rates
   Cyclomatic Complexity 6 drivers/gpu/drm/i915/intel_dp.c:ibx_digital_port_connected
   Cyclomatic Complexity 7 drivers/gpu/drm/i915/intel_dp.c:cpt_digital_port_connected
   Cyclomatic Complexity 5 drivers/gpu/drm/i915/intel_dp.c:gm45_digital_port_connected
   Cyclomatic Complexity 5 drivers/gpu/drm/i915/intel_dp.c:g4x_digital_port_connected
   Cyclomatic Complexity 3 drivers/gpu/drm/i915/intel_dp.c:skl_aux_ctl_reg

vim +/intel_dp_link_rate_index +291 drivers/gpu/drm/i915/intel_dp.c

   285	
   286		return intersect_rates(source_rates, source_len,
   287				       sink_rates, sink_len,
   288				       common_rates);
   289	}
   290	
 > 291	static int intel_dp_link_rate_index(struct intel_dp *intel_dp,
   292					    int *common_rates, int link_rate)
   293	{
   294		int common_len;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Jani Nikula Nov. 22, 2016, 1:41 p.m. UTC | #2
On Tue, 22 Nov 2016, Manasi Navare <manasi.d.navare@intel.com> wrote:
> Common rates array is used to keep track of common rates
> supported between DP sink and source. This helper function
> returns the index of a specific link rate in this common rates
> array.
>
> This is in prep with patches for DP Link training compliance
> tests that need an index for the link rate specified by the
> test as well as for link training failure handling patches that
> require index of fallback link rate.

I'm not a fan of adding functions that are not used in prep patches.

BR,
Jani.


>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Signed-off-by: Manasi Navare <manasi.d.navare@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 90283ed..bf72335 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -288,6 +288,21 @@ static int intel_dp_common_rates(struct intel_dp *intel_dp,
>  			       common_rates);
>  }
>  
> +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;
> +}
> +
>  static enum drm_mode_status
>  intel_dp_mode_valid(struct drm_connector *connector,
>  		    struct drm_display_mode *mode)
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 90283ed..bf72335 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -288,6 +288,21 @@  static int intel_dp_common_rates(struct intel_dp *intel_dp,
 			       common_rates);
 }
 
+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;
+}
+
 static enum drm_mode_status
 intel_dp_mode_valid(struct drm_connector *connector,
 		    struct drm_display_mode *mode)