crypto: ccree - prevent isr handling in case driver is suspended
authorOfir Drang <ofir.drang@arm.com>
Mon, 17 Jun 2019 08:46:29 +0000 (11:46 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 27 Jun 2019 06:28:00 +0000 (14:28 +0800)
ccree irq may be shared with other devices, in order to prevent ccree isr
handling while device maybe suspended we added a check to verify that the
device is not suspended.

Signed-off-by: Ofir Drang <ofir.drang@arm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccree/cc_driver.c
drivers/crypto/ccree/cc_pm.c
drivers/crypto/ccree/cc_pm.h

index 1e73d32..667bc73 100644 (file)
@@ -134,6 +134,9 @@ static irqreturn_t cc_isr(int irq, void *dev_id)
        u32 imr;
 
        /* STAT_OP_TYPE_GENERIC STAT_PHASE_0: Interrupt */
+       /* if driver suspended return, probebly shared interrupt */
+       if (cc_pm_is_dev_suspended(dev))
+               return IRQ_NONE;
 
        /* read the interrupt status */
        irr = cc_ioread(drvdata, CC_REG(HOST_IRR));
index 20f7f3d..899a52f 100644 (file)
@@ -106,6 +106,12 @@ int cc_pm_put_suspend(struct device *dev)
        return rc;
 }
 
+bool cc_pm_is_dev_suspended(struct device *dev)
+{
+       /* check device state using runtime api */
+       return pm_runtime_suspended(dev);
+}
+
 int cc_pm_init(struct cc_drvdata *drvdata)
 {
        struct device *dev = drvdata_to_dev(drvdata);
index 6190cdb..a7d98a5 100644 (file)
@@ -22,6 +22,7 @@ int cc_pm_suspend(struct device *dev);
 int cc_pm_resume(struct device *dev);
 int cc_pm_get(struct device *dev);
 int cc_pm_put_suspend(struct device *dev);
+bool cc_pm_is_dev_suspended(struct device *dev);
 
 #else
 
@@ -54,6 +55,12 @@ static inline int cc_pm_put_suspend(struct device *dev)
        return 0;
 }
 
+static inline bool cc_pm_is_dev_suspended(struct device *dev)
+{
+       /* if PM not supported device is never suspend */
+       return false;
+}
+
 #endif
 
 #endif /*__POWER_MGR_H__*/