[PORT FROM R2] mid_pmu: check if pci_set_power_state called after shutdown
authorIllyas Mansoor <illyas.mansoor@intel.com>
Thu, 12 Jan 2012 18:22:33 +0000 (23:52 +0530)
committerbuildbot <buildbot@intel.com>
Tue, 17 Jan 2012 18:11:01 +0000 (10:11 -0800)
BZ: 17351

There might be some buggy drivers that call pci_set_power_state
even after device_shutdown() is called, this could interfere
with shutdown and cause fabric error because while shtudown
is in progress we dont issue d0ix command.

Added a BUG() to catch this kind of behaviour.

Change-Id: Id718515f288872272aaf76ca04c6c44a5083a309
Signed-off-by: Illyas Mansoor <illyas.mansoor@intel.com>
Reviewed-on: http://android.intel.com:8080/31749
Reviewed-by: Hogander, Jouni <jouni.hogander@intel.com>
Reviewed-by: Rudramuni, Vishwesh M <vishwesh.m.rudramuni@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 c09290c..d182b40 100755 (executable)
@@ -1715,9 +1715,18 @@ int __ref pmu_pci_set_power_state(struct pci_dev *pdev, pci_power_t state)
         * get blocked, until pmu_sc_irq() releases */
        down(&mid_pmu_cxt->scu_ready_sem);
 
-       /* dont proceed if shutdown in progress */
-       if (unlikely(mid_pmu_cxt->shutdown_started))
-               goto unlock;
+       /* There could be some drivers that don't handle
+        * shutdown properly, that is even thou
+        * device shtudown is called we still could
+        * recieve set_power_state from buggy drivers
+        */
+       if (unlikely(mid_pmu_cxt->shutdown_started)) {
+               printk(KERN_CRIT "%s: received after device shutdown from"
+                      " %04x %04X %s %20s:\n",
+               __func__, pdev->vendor, pdev->device, dev_name(&pdev->dev),
+                       dev_driver_string(&pdev->dev));
+               BUG();
+       }
 
        mid_pmu_cxt->interactive_cmd_sent = 1;
 
@@ -2772,9 +2781,6 @@ void mfld_power_off(void)
        else
                /*send S5 command to SCU*/
                writel(S5_VALUE, &mid_pmu_cxt->pmu_reg->pm_cmd);
-
-       /* no more pm command expected. So not doing sem up */
-
 }
 
 static void mid_end(void)