Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: ccree - prevent isr handling in case driver is suspended

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>

authored by

Ofir Drang and committed by
Herbert Xu
3db617e7 d84f6269

+16
+3
drivers/crypto/ccree/cc_driver.c
··· 134 134 u32 imr; 135 135 136 136 /* STAT_OP_TYPE_GENERIC STAT_PHASE_0: Interrupt */ 137 + /* if driver suspended return, probebly shared interrupt */ 138 + if (cc_pm_is_dev_suspended(dev)) 139 + return IRQ_NONE; 137 140 138 141 /* read the interrupt status */ 139 142 irr = cc_ioread(drvdata, CC_REG(HOST_IRR));
+6
drivers/crypto/ccree/cc_pm.c
··· 106 106 return rc; 107 107 } 108 108 109 + bool cc_pm_is_dev_suspended(struct device *dev) 110 + { 111 + /* check device state using runtime api */ 112 + return pm_runtime_suspended(dev); 113 + } 114 + 109 115 int cc_pm_init(struct cc_drvdata *drvdata) 110 116 { 111 117 struct device *dev = drvdata_to_dev(drvdata);
+7
drivers/crypto/ccree/cc_pm.h
··· 22 22 int cc_pm_resume(struct device *dev); 23 23 int cc_pm_get(struct device *dev); 24 24 int cc_pm_put_suspend(struct device *dev); 25 + bool cc_pm_is_dev_suspended(struct device *dev); 25 26 26 27 #else 27 28 ··· 53 52 static inline int cc_pm_put_suspend(struct device *dev) 54 53 { 55 54 return 0; 55 + } 56 + 57 + static inline bool cc_pm_is_dev_suspended(struct device *dev) 58 + { 59 + /* if PM not supported device is never suspend */ 60 + return false; 56 61 } 57 62 58 63 #endif