[PORT FROM R2] mid_pmu: Use timeout when waiting for interactive command to complete
authorJouni Hogander <jouni.hogander@intel.com>
Fri, 4 Nov 2011 07:52:09 +0000 (09:52 +0200)
committerbuildbot <buildbot@intel.com>
Wed, 21 Dec 2011 14:42:06 +0000 (06:42 -0800)
BZ: 13779

Currently possible hang exists in mid_pmu code wait for interactive
command complete handling. In some error cases interrupt indicating
command completion doesn't occure and this causes hang without any
error messages.

We don't want to continue when hang happens because it's fatal
error. Instead of quiet hang dump out some useful information and make
it clear where hang happened.

Change-Id: I3d9356221ae7186a59578de7039ab84735178a31
Orig-Change-Id: I31c6ce97a22e6673aff892d3f4b65d8a57fd98b4
Signed-off-by: Jouni Hogander <jouni.hogander@intel.com>
Reviewed-on: http://android.intel.com:8080/29306
Reviewed-by: Martin, LoicX <loicx.martin@intel.com>
Reviewed-by: Mansoor, Illyas <illyas.mansoor@intel.com>
Tested-by: Martin, LoicX <loicx.martin@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
arch/x86/platform/mfld/pmu.c

index 6d88d68..af8c950 100755 (executable)
@@ -1601,7 +1601,9 @@ int __ref pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t state)
                 * powered on in SCU.
                 *
                 */
-               wait_for_completion(&mid_pmu_cxt->set_mode_complete);
+               if (!wait_for_completion_timeout(
+                           &mid_pmu_cxt->set_mode_complete, 5 * HZ))
+                       BUG();
 
                pmu_set_s0ix_possible(state);
 
@@ -2256,7 +2258,9 @@ static int pmu_init(void)
         * powered on in SCU.
         *
         */
-       wait_for_completion(&mid_pmu_cxt->set_mode_complete);
+       if (!wait_for_completion_timeout(&mid_pmu_cxt->set_mode_complete,
+                                        5 * HZ))
+               BUG();
 
        /* In cases were gfx is not enabled
         * this will enable s0ix immediately