From: "Pandiyan, Dhinakaran" <dhinakaran.pandiyan@intel.com>
To: "chris@chris-wilson.co.uk" <chris@chris-wilson.co.uk>
Cc: "intel-gfx@lists.freedesktop.org" <intel-gfx@lists.freedesktop.org>
Subject: Re: [PATCH] drm/i915: Fix braces in conditonal branches
Date: Tue, 9 Aug 2016 23:15:21 +0000 [thread overview]
Message-ID: <1470785379.25988.1.camel@dk-H97M-D3H> (raw)
In-Reply-To: <20160809220857.GA29783@nuc-i3427.alporthouse.com>
On Tue, 2016-08-09 at 23:08 +0100, Chris Wilson wrote:
> On Tue, Aug 09, 2016 at 03:06:10PM -0700, Dhinakaran Pandiyan wrote:
> > No functional change, just adding braces to all branches of conditional
> > statement because one of them already had.
> > ---
> > drivers/gpu/drm/i915/intel_audio.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> > index d32f586..26a795f 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -335,11 +335,11 @@ static void hsw_audio_codec_enable(struct drm_connector *connector,
> >
> > tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> > if (audio_rate_need_prog(intel_crtc, adjusted_mode)) {
> > - if (!acomp)
> > + if (!acomp) {
> > rate = 0;
> > - else if (port >= PORT_A && port <= PORT_E)
> > + } else if (port >= PORT_A && port <= PORT_E) {
> > rate = acomp->aud_sample_rate[port];
> > - else {
> > + } else {
> > DRM_ERROR("invalid port: %d\n", port);
> > rate = 0;
> > }
>
> Or you could improve scoping of the locals and eliminate a few lines
> whilst adding more information to the debug:
>
> diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> index d32f586..98d4576 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -282,14 +282,9 @@ static void hsw_audio_codec_enable(struct drm_connector *connector,
> struct drm_i915_private *dev_priv = to_i915(connector->dev);
> struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> enum pipe pipe = intel_crtc->pipe;
> - struct i915_audio_component *acomp = dev_priv->audio_component;
> const uint8_t *eld = connector->eld;
> - struct intel_digital_port *intel_dig_port =
> - enc_to_dig_port(&encoder->base);
> - enum port port = intel_dig_port->port;
> uint32_t tmp;
> int len, i;
> - int n, rate;
>
> DRM_DEBUG_KMS("Enable audio codec on pipe %c, %u bytes ELD\n",
> pipe_name(pipe), drm_eld_size(eld));
> @@ -335,19 +330,18 @@ static void hsw_audio_codec_enable(struct drm_connector *connector,
>
> tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> if (audio_rate_need_prog(intel_crtc, adjusted_mode)) {
> - if (!acomp)
> - rate = 0;
> - else if (port >= PORT_A && port <= PORT_E)
> + enum port port = enc_to_dig_port(&encoder_base)->port;
> + struct i915_audio_component *acomp = dev_priv->audio_component;
> + int rate, n;
> +
> + rate = 0;
> + if (acomp && port >= PORT_A && port <= PORT_E)
> rate = acomp->aud_sample_rate[port];
> - else {
> - DRM_ERROR("invalid port: %d\n", port);
> - rate = 0;
> - }
> +
> n = audio_config_get_n(adjusted_mode, rate);
> - if (n != 0)
> + DRM_DEBUG_KMS("port %d audio rate %d => N=%x\n", port, rate, n);
> + if (n)
> tmp = audio_config_setup_n_reg(n, tmp);
> - else
> - DRM_DEBUG_KMS("no suitable N value is found\n");
> }
>
> I915_WRITE(HSW_AUD_CFG(pipe), tmp);
>
>
This looks a lot cleaner.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-08-09 23:15 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 [this message]
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
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=1470785379.25988.1.camel@dk-H97M-D3H \
--to=dhinakaran.pandiyan@intel.com \
--cc=chris@chris-wilson.co.uk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.