forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/nfc/fdp/fdp.c
....@@ -1,15 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /* -------------------------------------------------------------------------
23 * Copyright (C) 2014-2016, Intel Corporation
34 *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License as published by
6
- * the Free Software Foundation; either version 2 of the License, or
7
- * (at your option) any later version.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
135 * -------------------------------------------------------------------------
146 */
157
....@@ -84,7 +76,7 @@
8476 struct nci_core_get_config_rsp {
8577 u8 status;
8678 u8 count;
87
- u8 data[0];
79
+ u8 data[];
8880 };
8981
9082 static int fdp_nci_create_conn(struct nci_dev *ndev)
....@@ -246,9 +238,6 @@
246238 {
247239 int r;
248240 struct fdp_nci_info *info = nci_get_drvdata(ndev);
249
- struct device *dev = &info->phy->i2c_dev->dev;
250
-
251
- dev_dbg(dev, "%s\n", __func__);
252241
253242 r = info->phy_ops->enable(info->phy);
254243
....@@ -257,35 +246,26 @@
257246
258247 static int fdp_nci_close(struct nci_dev *ndev)
259248 {
260
- struct fdp_nci_info *info = nci_get_drvdata(ndev);
261
- struct device *dev = &info->phy->i2c_dev->dev;
262
-
263
- dev_dbg(dev, "%s\n", __func__);
264249 return 0;
265250 }
266251
267252 static int fdp_nci_send(struct nci_dev *ndev, struct sk_buff *skb)
268253 {
269254 struct fdp_nci_info *info = nci_get_drvdata(ndev);
270
- struct device *dev = &info->phy->i2c_dev->dev;
271
-
272
- dev_dbg(dev, "%s\n", __func__);
255
+ int ret;
273256
274257 if (atomic_dec_and_test(&info->data_pkt_counter))
275258 info->data_pkt_counter_cb(ndev);
276259
277
- return info->phy_ops->write(info->phy, skb);
278
-}
260
+ ret = info->phy_ops->write(info->phy, skb);
261
+ if (ret < 0) {
262
+ kfree_skb(skb);
263
+ return ret;
264
+ }
279265
280
-int fdp_nci_recv_frame(struct nci_dev *ndev, struct sk_buff *skb)
281
-{
282
- struct fdp_nci_info *info = nci_get_drvdata(ndev);
283
- struct device *dev = &info->phy->i2c_dev->dev;
284
-
285
- dev_dbg(dev, "%s\n", __func__);
286
- return nci_recv_frame(ndev, skb);
266
+ consume_skb(skb);
267
+ return 0;
287268 }
288
-EXPORT_SYMBOL(fdp_nci_recv_frame);
289269
290270 static int fdp_nci_request_firmware(struct nci_dev *ndev)
291271 {
....@@ -497,8 +477,6 @@
497477 int r;
498478 u8 patched = 0;
499479
500
- dev_dbg(dev, "%s\n", __func__);
501
-
502480 r = nci_core_init(ndev);
503481 if (r)
504482 goto error;
....@@ -606,9 +584,7 @@
606584 struct sk_buff *skb)
607585 {
608586 struct fdp_nci_info *info = nci_get_drvdata(ndev);
609
- struct device *dev = &info->phy->i2c_dev->dev;
610587
611
- dev_dbg(dev, "%s\n", __func__);
612588 info->setup_reset_ntf = 1;
613589 wake_up(&info->setup_wq);
614590
....@@ -619,9 +595,7 @@
619595 struct sk_buff *skb)
620596 {
621597 struct fdp_nci_info *info = nci_get_drvdata(ndev);
622
- struct device *dev = &info->phy->i2c_dev->dev;
623598
624
- dev_dbg(dev, "%s\n", __func__);
625599 info->setup_patch_ntf = 1;
626600 info->setup_patch_status = skb->data[0];
627601 wake_up(&info->setup_wq);
....@@ -794,11 +768,6 @@
794768
795769 void fdp_nci_remove(struct nci_dev *ndev)
796770 {
797
- struct fdp_nci_info *info = nci_get_drvdata(ndev);
798
- struct device *dev = &info->phy->i2c_dev->dev;
799
-
800
- dev_dbg(dev, "%s\n", __func__);
801
-
802771 nci_unregister_device(ndev);
803772 nci_free_device(ndev);
804773 }