From: Jouni Hogander Date: Fri, 4 Nov 2011 07:52:09 +0000 (+0200) Subject: [PORT FROM R2] mid_pmu: Use timeout when waiting for interactive command to complete X-Git-Tag: 2.1b_release~1710 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=14233945bad4fa6501c04b7fe4200408d94b4931;p=kernel%2Fkernel-mfld-blackbay.git [PORT FROM R2] mid_pmu: Use timeout when waiting for interactive command to complete 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 Reviewed-on: http://android.intel.com:8080/29306 Reviewed-by: Martin, LoicX Reviewed-by: Mansoor, Illyas Tested-by: Martin, LoicX Reviewed-by: buildbot Tested-by: buildbot --- diff --git a/arch/x86/platform/mfld/pmu.c b/arch/x86/platform/mfld/pmu.c index 6d88d68..af8c950 100755 --- a/arch/x86/platform/mfld/pmu.c +++ b/arch/x86/platform/mfld/pmu.c @@ -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