Updated corresponding to - NFC_AR_00_E800_12.0A.00_OpnSrc

This commit is contained in:
nxf35421
2021-08-19 13:43:24 +05:30
parent f94d1b082c
commit 6b429ad0d1
2 changed files with 19 additions and 5 deletions

13
nfc/Kconfig Normal file
View File

@@ -0,0 +1,13 @@
#
# near field communication driver configuration
#
config NXP_NFC_I2C
tristate "NXP NCI based NFC I2C Slave Driver for SNxxx"
depends on I2C
help
This enables the NFC driver for SNxxx based devices.
This is for I2C connected version. NCI protocol logic
resides in the usermode and it has no other NFC dependencies.
If unsure, say N.

View File

@@ -256,12 +256,13 @@ ssize_t nfc_i2c_dev_read(struct file *filp, char __user *buf, size_t count,
int ret; int ret;
struct nfc_dev *nfc_dev = (struct nfc_dev *)filp->private_data; struct nfc_dev *nfc_dev = (struct nfc_dev *)filp->private_data;
if (filp->f_flags & O_NONBLOCK) {
pr_err("%s: f_flags has nonblock. try again\n", __func__);
return -EAGAIN;
}
mutex_lock(&nfc_dev->read_mutex); mutex_lock(&nfc_dev->read_mutex);
ret = i2c_read(nfc_dev, nfc_dev->read_kbuf, count, 0); if (filp->f_flags & O_NONBLOCK) {
ret = i2c_master_recv(nfc_dev->i2c_dev.client, nfc_dev->read_kbuf, count);
pr_debug("%s: NONBLOCK read ret = %d\n", __func__, ret);
} else {
ret = i2c_read(nfc_dev, nfc_dev->read_kbuf, count, 0);
}
if (ret > 0) { if (ret > 0) {
if (copy_to_user(buf, nfc_dev->read_kbuf, ret)) { if (copy_to_user(buf, nfc_dev->read_kbuf, ret)) {
pr_warn("%s: failed to copy to user space\n", __func__); pr_warn("%s: failed to copy to user space\n", __func__);