From: Jani Nikula <jani.nikula@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v3 5/6] drm/i915/audio: clean up LPE audio init/cleanup calls
Date: Fri, 05 Nov 2021 13:29:00 +0200 [thread overview]
Message-ID: <871r3ualj7.fsf@intel.com> (raw)
In-Reply-To: <YYUFmkGqEIDpkH8N@intel.com>
On Fri, 05 Nov 2021, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Thu, Nov 04, 2021 at 06:18:57PM +0200, Jani Nikula wrote:
>> Unify audio init/cleanup paths wrt LPE audio, and base the logic on the
>> return values from LPE audio calls. Move the platform device check on
>> cleanup to intel_lpe_audio.c, thereby limiting all audio.lpe substruct
>> access to that file.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>> drivers/gpu/drm/i915/display/intel_audio.c | 14 ++++++++------
>> drivers/gpu/drm/i915/display/intel_lpe_audio.c | 6 ++++--
>> drivers/gpu/drm/i915/display/intel_lpe_audio.h | 4 ++--
>> 3 files changed, 14 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c
>> index 24e76657d561..aa7037021376 100644
>> --- a/drivers/gpu/drm/i915/display/intel_audio.c
>> +++ b/drivers/gpu/drm/i915/display/intel_audio.c
>> @@ -1403,8 +1403,10 @@ static void i915_audio_component_cleanup(struct drm_i915_private *dev_priv)
>> */
>> void intel_audio_init(struct drm_i915_private *dev_priv)
>> {
>> - if (intel_lpe_audio_init(dev_priv) < 0)
>> - i915_audio_component_init(dev_priv);
>> + if (!intel_lpe_audio_init(dev_priv))
>> + return;
>> +
>> + i915_audio_component_init(dev_priv);
>
> The logic here is already a bit funky. Technically we should not
> init the component stuff except when LPE audio is not present.
> Ie. we should only do it when intel_lpe_audio_init() returns
> -ENODEV.
Right.
>
>> }
>>
>> /**
>> @@ -1414,8 +1416,8 @@ void intel_audio_init(struct drm_i915_private *dev_priv)
>> */
>> void intel_audio_deinit(struct drm_i915_private *dev_priv)
>> {
>> - if ((dev_priv)->audio.lpe.platdev != NULL)
>> - intel_lpe_audio_teardown(dev_priv);
>> - else
>> - i915_audio_component_cleanup(dev_priv);
>> + if (!intel_lpe_audio_teardown(dev_priv))
>> + return;
>> +
>> + i915_audio_component_cleanup(dev_priv);
>
> Here it would probably make more sense to just call both
> unconditionally so we don't have to care what happened during
> init.
Yeah, why not.
Thanks for the review, pushed everything except this patch, will
follow-up.
BR,
Jani.
>
>> }
>> diff --git a/drivers/gpu/drm/i915/display/intel_lpe_audio.c b/drivers/gpu/drm/i915/display/intel_lpe_audio.c
>> index 4970bf146c4a..a2984718d136 100644
>> --- a/drivers/gpu/drm/i915/display/intel_lpe_audio.c
>> +++ b/drivers/gpu/drm/i915/display/intel_lpe_audio.c
>> @@ -296,10 +296,10 @@ int intel_lpe_audio_init(struct drm_i915_private *dev_priv)
>> *
>> * release all the resources for LPE audio <-> i915 bridge.
>> */
>> -void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv)
>> +int intel_lpe_audio_teardown(struct drm_i915_private *dev_priv)
>> {
>> if (!HAS_LPE_AUDIO(dev_priv))
>> - return;
>> + return -ENODEV;
>>
>> lpe_audio_platdev_destroy(dev_priv);
>>
>> @@ -307,6 +307,8 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv)
>>
>> dev_priv->audio.lpe.irq = -1;
>> dev_priv->audio.lpe.platdev = NULL;
>> +
>> + return 0;
>> }
>>
>> /**
>> diff --git a/drivers/gpu/drm/i915/display/intel_lpe_audio.h b/drivers/gpu/drm/i915/display/intel_lpe_audio.h
>> index f848c5038714..030874623872 100644
>> --- a/drivers/gpu/drm/i915/display/intel_lpe_audio.h
>> +++ b/drivers/gpu/drm/i915/display/intel_lpe_audio.h
>> @@ -12,8 +12,8 @@ enum pipe;
>> enum port;
>> struct drm_i915_private;
>>
>> -int intel_lpe_audio_init(struct drm_i915_private *dev_priv);
>> -void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv);
>> +int intel_lpe_audio_init(struct drm_i915_private *dev_priv);
>> +int intel_lpe_audio_teardown(struct drm_i915_private *dev_priv);
>> void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv);
>> void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
>> enum pipe pipe, enum port port,
>> --
>> 2.30.2
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2021-11-05 11:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-04 16:18 [Intel-gfx] [PATCH v3 1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private Jani Nikula
2021-11-04 16:18 ` [Intel-gfx] [PATCH v3 2/6] drm/i915/audio: name the audio sub-struct " Jani Nikula
2021-11-04 16:18 ` [Intel-gfx] [PATCH v3 3/6] drm/i915/audio: define the audio struct separately from drm_i915_private Jani Nikula
2021-11-04 16:18 ` [Intel-gfx] [PATCH v3 4/6] drm/i915/audio: move intel_audio_funcs internal to intel_audio.c Jani Nikula
2021-11-04 16:18 ` [Intel-gfx] [PATCH v3 5/6] drm/i915/audio: clean up LPE audio init/cleanup calls Jani Nikula
2021-11-05 10:21 ` Ville Syrjälä
2021-11-05 11:29 ` Jani Nikula [this message]
2021-11-04 16:18 ` [Intel-gfx] [PATCH v3 6/6] drm/i915/audio: rename intel_init_audio_hooks to intel_audio_hooks_init Jani Nikula
2021-11-05 10:21 ` Ville Syrjälä
2021-11-04 19:22 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [v3,1/6] drm/i915/audio: group audio under anonymous struct in drm_i915_private Patchwork
2021-11-04 19:23 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-11-04 19:54 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-11-04 23:32 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=871r3ualj7.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.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