NFC: Fix to resolve abnormal read thread exit
During hiberantion/suspend, freezer process sends fake signals to all running processes to put the device into system wide sleep, which leads to ungraceful exit of I2c read thread leaving the upper layer retry the I2C access & ends up with excessive error logging on the console. Modified code to set/unset the no-freeze flag to ensure such freezer fake signals can be avoided when NFC is enabled & vice versa. Change-Id: If0b8814daa172b3734a331ad9ab225c714e11e43 Signed-off-by: Tapas Dey <quic_c_tdey@quicinc.com>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
ade85437e3
commit
3963d26d45
16
nfc/common.c
16
nfc/common.c
@@ -586,6 +586,15 @@ int nfc_dev_open(struct inode *inode, struct file *filp)
|
||||
|
||||
pr_debug("%s: %d, %d\n", __func__, imajor(inode), iminor(inode));
|
||||
|
||||
/* Set flag to block freezer fake signal if not set already.
|
||||
* Without this Signal being set, Driver is trying to do a read
|
||||
* which is causing the delay in moving to Hibernate Mode.
|
||||
*/
|
||||
if (!(current->flags & PF_NOFREEZE)) {
|
||||
current->flags |= PF_NOFREEZE;
|
||||
pr_debug("%s: current->flags 0x%x. \n", __func__, current->flags);
|
||||
}
|
||||
|
||||
mutex_lock(&nfc_dev->dev_ref_mutex);
|
||||
|
||||
filp->private_data = nfc_dev;
|
||||
@@ -632,6 +641,13 @@ int nfc_dev_close(struct inode *inode, struct file *filp)
|
||||
return -ENODEV;
|
||||
|
||||
pr_debug("%s: %d, %d\n", __func__, imajor(inode), iminor(inode));
|
||||
|
||||
/* unset the flag to restore to previous state */
|
||||
if (current->flags & PF_NOFREEZE) {
|
||||
current->flags &= ~PF_NOFREEZE;
|
||||
pr_debug("%s: current->flags 0x%x. \n", __func__, current->flags);
|
||||
}
|
||||
|
||||
mutex_lock(&nfc_dev->dev_ref_mutex);
|
||||
if (nfc_dev->dev_ref_count == 1) {
|
||||
nfc_dev->nfc_disable_intr(nfc_dev);
|
||||
|
Reference in New Issue
Block a user