From 7dd0b7d5465df472af3bffe588e0c240861ad6b1 Mon Sep 17 00:00:00 2001 From: nxf24591 Date: Fri, 29 Jul 2022 19:28:34 +0530 Subject: [PATCH] Updated corresponding to - NFC_AR_00_1E800_13.09.00_OpnSrc --- nfc/Kbuild | 2 ++ nfc/common.c | 13 ++++++------- nfc/common.h | 2 +- nfc/common_ese.c | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/nfc/Kbuild b/nfc/Kbuild index 9a4e9a23da..02db26ac5d 100644 --- a/nfc/Kbuild +++ b/nfc/Kbuild @@ -4,3 +4,5 @@ nfc_i2c-y := common.o \ common_ese.o \ i2c_drv.o +ccflags-y += -DDYNAMIC_DEBUG_MODULE + diff --git a/nfc/common.c b/nfc/common.c index a4f8029fa1..5b47e373c3 100644 --- a/nfc/common.c +++ b/nfc/common.c @@ -1,6 +1,6 @@ /****************************************************************************** * Copyright (C) 2015, The Linux Foundation. All rights reserved. - * Copyright (C) 2019-2021 NXP + * Copyright (C) 2019-2022 NXP * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,14 +44,14 @@ int nfc_parse_dt(struct device *dev, struct platform_configs *nfc_configs, if ((!gpio_is_valid(nfc_gpio->irq))) { pr_err("%s: irq gpio invalid %d\n", __func__, nfc_gpio->irq); - return -EINVAL; + return nfc_gpio->irq; } pr_info("%s: irq %d\n", __func__, nfc_gpio->irq); } nfc_gpio->ven = of_get_named_gpio(np, DTS_VEN_GPIO_STR, 0); if ((!gpio_is_valid(nfc_gpio->ven))) { pr_err("%s: ven gpio invalid %d\n", __func__, nfc_gpio->ven); - return -EINVAL; + return nfc_gpio->ven; } /* some products like sn220 does not required fw dwl pin */ nfc_gpio->dwl_req = of_get_named_gpio(np, DTS_FWDN_GPIO_STR, 0); @@ -410,10 +410,6 @@ int nfc_dev_close(struct inode *inode, struct file *filp) if (nfc_dev->dev_ref_count == 1) { nfc_dev->nfc_disable_intr(nfc_dev); set_valid_gpio(nfc_dev->configs.gpio.dwl_req, 0); - } - if (nfc_dev->dev_ref_count > 0) - nfc_dev->dev_ref_count = nfc_dev->dev_ref_count - 1; - else { /* * Use "ESE_RST_PROT_DIS" as argument * if eSE calls flow is via NFC driver @@ -421,6 +417,9 @@ int nfc_dev_close(struct inode *inode, struct file *filp) */ nfc_ese_pwr(nfc_dev, ESE_RST_PROT_DIS_NFC); } + if (nfc_dev->dev_ref_count > 0) + nfc_dev->dev_ref_count = nfc_dev->dev_ref_count - 1; + filp->private_data = NULL; mutex_unlock(&nfc_dev->dev_ref_mutex); diff --git a/nfc/common.h b/nfc/common.h index 4899c0d92c..bd6759a966 100644 --- a/nfc/common.h +++ b/nfc/common.h @@ -27,7 +27,7 @@ /* Max device count for this driver */ #define DEV_COUNT 1 /* i2c device class */ -#define CLASS_NAME "nfc" +#define CLASS_NAME "nxpnfc" /* NFC character device name, this will be in /dev/ */ #define NFC_CHAR_DEV_NAME "nxp-nci" diff --git a/nfc/common_ese.c b/nfc/common_ese.c index 5c725a6845..9be98e2445 100644 --- a/nfc/common_ese.c +++ b/nfc/common_ese.c @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (C) 2020-2021 NXP + * Copyright (C) 2020-2022 NXP * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -135,6 +135,7 @@ static int validate_cold_reset_protection_request(struct cold_reset *cold_reset, IS_SRC(arg, cold_reset->rst_prot_src)) { pr_debug("%s: enable reset protection from same src\n", __func__); + ret = -EINVAL; } else { pr_err("%s: operation not permitted\n", __func__); ret = -EPERM; @@ -161,7 +162,6 @@ static int perform_cold_reset_protection(struct nfc_dev *nfc_dev, /* check if NFCC not in the FW download or hard reset state */ ret = validate_cold_reset_protection_request(cold_reset, arg); if (ret < 0) { - pr_err("%s: invalid cmd\n", __func__); goto err; }