[Intel-gfx] [PATCH v3 5/6] drm/i915/audio: clean up LPE audio init/cleanup calls
Jani Nikula
jani.nikula at intel.com
Thu Nov 4 16:18:57 UTC 2021
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 at 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);
}
/**
@@ -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);
}
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
More information about the Intel-gfx
mailing list