Revert "hal: enable form factor based configuration"

Build fix.

This reverts commit 62dd1dcd291e52fb47255ca2b912ada6f6dfa73a.

Change-Id: I629314021b51d6baa0145b32241ff0be97713bd4
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 297ddd4..a4ea34c 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -307,19 +307,20 @@
 {
     int i, num_devices = 0;
     snd_device_t new_snd_devices[2];
-    int ret_val = -EINVAL;
+
     if (snd_device < SND_DEVICE_MIN ||
         snd_device >= SND_DEVICE_MAX) {
         ALOGE("%s: Invalid sound device %d", __func__, snd_device);
-        goto on_error;
+        return -EINVAL;
     }
 
     platform_send_audio_calibration(adev->platform, snd_device);
 
-    if (adev->snd_dev_ref_cnt[snd_device] >= 1) {
+    adev->snd_dev_ref_cnt[snd_device]++;
+    if (adev->snd_dev_ref_cnt[snd_device] > 1) {
         ALOGV("%s: snd_device(%d: %s) is already active",
               __func__, snd_device, platform_get_snd_device_name(snd_device));
-        goto on_success;
+        return 0;
     }
 
     /* due to the possibility of calibration overwrite between listen
@@ -336,11 +337,12 @@
         snd_device == SND_DEVICE_OUT_VOICE_SPEAKER) &&
         audio_extn_spkr_prot_is_enabled()) {
         if (audio_extn_spkr_prot_get_acdb_id(snd_device) < 0) {
-            goto on_error;
+            adev->snd_dev_ref_cnt[snd_device]--;
+            return -EINVAL;
         }
         if (audio_extn_spkr_prot_start_processing(snd_device)) {
             ALOGE("%s: spkr_start_processing failed", __func__);
-            goto on_error;
+            return -EINVAL;
         }
     } else if (platform_can_split_snd_device(snd_device, &num_devices, new_snd_devices)) {
         for (i = 0; i < num_devices; i++) {
@@ -348,20 +350,12 @@
         }
         platform_set_speaker_gain_in_combo(adev, snd_device, true);
     } else {
-        char device_name[DEVICE_NAME_MAX_SIZE] = {0};
-        if (platform_get_snd_device_name_extn(adev->platform, snd_device, device_name) < 0 ) {
-            ALOGE(" %s: Invalid sound device returned", __func__);
-            goto on_error;
-        }
-
-        ALOGV("%s: snd_device(%d: %s)", __func__, snd_device, device_name);
-        audio_route_apply_and_update_path(adev->audio_route, device_name);
+        const char * dev_path = platform_get_snd_device_name(snd_device);
+        ALOGV("%s: snd_device(%d: %s)", __func__, snd_device, dev_path);
+        audio_route_apply_and_update_path(adev->audio_route, dev_path);
     }
-on_success:
-    adev->snd_dev_ref_cnt[snd_device]++;
-    ret_val = 0;
-on_error:
-    return ret_val;
+
+    return 0;
 }
 
 int disable_snd_device(struct audio_device *adev,
@@ -395,14 +389,7 @@
             }
             platform_set_speaker_gain_in_combo(adev, snd_device, false);
         } else {
-            char device_name[DEVICE_NAME_MAX_SIZE] = {0};
-            if (platform_get_snd_device_name_extn(adev->platform, snd_device, device_name) < 0 ) {
-                ALOGE(" %s: Invalid sound device returned", __func__);
-                return -EINVAL;
-            }
-
-            ALOGD("%s: snd_device(%d: %s)", __func__, snd_device, device_name);
-            audio_route_reset_and_update_path(adev->audio_route, device_name);
+            audio_route_reset_and_update_path(adev->audio_route, dev_path);
         }
         audio_extn_sound_trigger_update_device_status(snd_device,
                                         ST_EVENT_SND_DEVICE_FREE);