Merge " Audio: Revert hal changes to block pcm_close during SSR"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 806a4be..b54261e 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -842,11 +842,9 @@
         pcm_close(in->pcm);
         in->pcm = NULL;
         ret = -EIO;
-        in->pcm_error_type = PCM_ERROR_EIO;
         goto error_open;
     }
 
-    in->pcm_error_type = PCM_ERROR_NONE;
     ALOGV("%s: exit", __func__);
     return ret;
 
@@ -1243,10 +1241,8 @@
             pcm_close(out->pcm);
             out->pcm = NULL;
             ret = -EIO;
-            out->pcm_error_type = PCM_ERROR_EIO;
             goto error_open;
         }
-        out->pcm_error_type = PCM_ERROR_NONE;
     } else {
         out->pcm = NULL;
         out->compr = compress_open(adev->snd_card,
@@ -1684,12 +1680,6 @@
             ALOGD(" %s: sound card is not active/SSR state", __func__);
             ret= -ENETRESET;
             goto exit;
-        } else if (PCM_ERROR_ENETRESET ==  out->pcm_error_type) {
-            ALOGD(" %s restarting pcm session on post SSR", __func__);
-            out->standby = false;
-            pthread_mutex_unlock(&out->lock);
-            out_standby(&out->stream.common);
-            pthread_mutex_lock(&out->lock);
         }
     }
 
@@ -1741,12 +1731,11 @@
     }
 
 exit:
-
+    /* ToDo: There may be a corner case when SSR happens back to back during
+       start/stop. Need to post different error to handle that. */
     if (-ENETRESET == ret) {
         pthread_mutex_lock(&adev->snd_card_status.lock);
         adev->snd_card_status.state = SND_CARD_STATE_OFFLINE;
-        out->pcm_error_type = PCM_ERROR_ENETRESET;
-        out->standby = true; /*standby will be called on post SSR */
         pthread_mutex_unlock(&adev->snd_card_status.lock);
     }
 
@@ -2102,12 +2091,6 @@
             ALOGD(" %s: sound card is not active/SSR state", __func__);
             ret= -ENETRESET;
             goto exit;
-        } else if (PCM_ERROR_ENETRESET ==  in->pcm_error_type) {
-            ALOGD(" %s restarting pcm session on post SSR", __func__);
-            in->standby = false;
-            pthread_mutex_unlock(&in->lock);
-            in_standby(&in->stream.common);
-            pthread_mutex_lock(&in->lock);
         }
     }
 
@@ -2141,13 +2124,12 @@
         memset(buffer, 0, bytes);
 
 exit:
-
+    /* ToDo: There may be a corner case when SSR happens back to back during
+        start/stop. Need to post different error to handle that. */
     if (-ENETRESET == ret) {
         pthread_mutex_lock(&adev->snd_card_status.lock);
         adev->snd_card_status.state = SND_CARD_STATE_OFFLINE;
-        in->pcm_error_type = PCM_ERROR_ENETRESET;
         memset(buffer, 0, bytes);
-        in->standby = true; /*standby will be called on post SSR */
         pthread_mutex_unlock(&adev->snd_card_status.lock);
     }
     pthread_mutex_unlock(&in->lock);
diff --git a/hal/audio_hw.h b/hal/audio_hw.h
index 7d8d924..1b2606c 100644
--- a/hal/audio_hw.h
+++ b/hal/audio_hw.h
@@ -140,12 +140,6 @@
     OFFLOAD_STATE_PAUSED,
 };
 
-enum {
-    PCM_ERROR_NONE,
-    PCM_ERROR_EIO,
-    PCM_ERROR_ENETRESET,  /* For SSR */
-};
-
 struct offload_cmd {
     struct listnode node;
     int cmd;
@@ -193,7 +187,6 @@
     void *offload_cookie;
     struct compr_gapless_mdata gapless_mdata;
     int send_new_metadata;
-    int pcm_error_type;
 
     struct audio_device *dev;
 };
@@ -212,7 +205,6 @@
     bool enable_aec;
     bool enable_ns;
     audio_format_t format;
-    int pcm_error_type;
 
     struct audio_device *dev;
 };