public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Subject: Re: [PATCH 2/3] drm/dp/i915: Clean up clock configuration	for HDMI audio
Date: Thu, 11 Aug 2016 10:52:53 +0300	[thread overview]
Message-ID: <877fbnwxm2.fsf@intel.com> (raw)
In-Reply-To: <1470897673-29292-2-git-send-email-dhinakaran.pandiyan@intel.com>

On Thu, 11 Aug 2016, Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> wrote:
> No functional change, just clean up. Debug messages now print out clock
> units. Additionally, the configuration bits, which are 1:1 mapped to the
> clock frequency and don't convey much information are not printed out.

IMO the cleanups here are subjective, i.e. another day someone might
come in and rewrite it back to having just one code path for return
instead of many. And someone might prefer early returns for errors.

If you really wanted to clean this up, you could abstract the config
lookup based on clock, and it would be a less subjective improvement.

>
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_audio.c | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> index 3efce0e..9465f54 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -104,21 +104,17 @@ static u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjusted
>  	int i;
>  
>  	for (i = 0; i < ARRAY_SIZE(hdmi_audio_clock); i++) {
> -		if (adjusted_mode->crtc_clock == hdmi_audio_clock[i].clock)
> -			break;
> -	}
> -
> -	if (i == ARRAY_SIZE(hdmi_audio_clock)) {
> -		DRM_DEBUG_KMS("HDMI audio pixel clock setting for %d not found, falling back to defaults\n",
> -			      adjusted_mode->crtc_clock);
> -		i = 1;
> +		if (adjusted_mode->crtc_clock == hdmi_audio_clock[i].clock) {
> +			DRM_DEBUG_KMS("Configuring audio for HDMI pixel clk %dkHz\n",
> +				      hdmi_audio_clock[i].clock);
> +			return hdmi_audio_clock[i].config;
> +		}
>  	}
>  
> -	DRM_DEBUG_KMS("Configuring HDMI audio for pixel clock %d (0x%08x)\n",
> -		      hdmi_audio_clock[i].clock,
> -		      hdmi_audio_clock[i].config);
> +	DRM_DEBUG_KMS("No config. for HDMI pixel clk %dkHz, using default %dkHz\n",

Please at least fix the typos.

> +		      adjusted_mode->crtc_clock, hdmi_audio_clock[1].clock);
>  
> -	return hdmi_audio_clock[i].config;
> +	return hdmi_audio_clock[1].config;
>  }
>  
>  static int audio_config_get_n(const struct drm_display_mode *mode, int rate)

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-08-11  7:53 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-09 22:06 [PATCH] drm/i915: Fix braces in conditonal branches Dhinakaran Pandiyan
2016-08-09 22:08 ` Chris Wilson
2016-08-09 23:15   ` Pandiyan, Dhinakaran
2016-08-11  6:41   ` [PATCH 1/3] drm/i915: Clean up hsw_audio_codec_enable() Dhinakaran Pandiyan
2016-08-11  6:41     ` [PATCH 2/3] drm/dp/i915: Clean up clock configuration for HDMI audio Dhinakaran Pandiyan
2016-08-11  7:08       ` Chris Wilson
2016-08-11  7:52       ` Jani Nikula [this message]
2016-08-11 18:42         ` Pandiyan, Dhinakaran
2016-08-11  6:41     ` [PATCH 3/3] drm/i915: Eliminate redundant local variable definition Dhinakaran Pandiyan
2016-08-11  7:09       ` Chris Wilson
2016-08-11 18:22         ` Pandiyan, Dhinakaran
2016-08-11  7:07     ` [PATCH 1/3] drm/i915: Clean up hsw_audio_codec_enable() Chris Wilson
2016-08-11  7:47     ` Jani Nikula
2016-08-11  7:54       ` Chris Wilson
2016-08-11  8:04         ` Jani Nikula
2016-08-10 11:02 ` ✗ Ro.CI.BAT: failure for drm/i915: Fix braces in conditonal branches 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=877fbnwxm2.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=dhinakaran.pandiyan@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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