forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/drivers/nfc/pn533/usb.c
....@@ -1,21 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for NXP PN533 NFC Chip - USB transport layer
34 *
45 * Copyright (C) 2011 Instituto Nokia de Tecnologia
56 * Copyright (C) 2012-2013 Tieto Poland
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
197 */
208
219 #include <linux/device.h>
....@@ -222,7 +210,7 @@
222210 usb_kill_urb(phy->in_urb);
223211 }
224212
225
-/* ACR122 specific structs and fucntions */
213
+/* ACR122 specific structs and functions */
226214
227215 /* ACS ACR122 pn533 frame definitions */
228216 #define PN533_ACR122_TX_FRAME_HEADER_LEN (sizeof(struct pn533_acr122_tx_frame) \
....@@ -546,9 +534,9 @@
546534 goto error;
547535 }
548536
549
- priv = pn533_register_device(id->driver_info, protocols, protocol_type,
537
+ priv = pn53x_common_init(id->driver_info, protocol_type,
550538 phy, &usb_phy_ops, fops,
551
- &phy->udev->dev, &interface->dev);
539
+ &phy->udev->dev);
552540
553541 if (IS_ERR(priv)) {
554542 rc = PTR_ERR(priv);
....@@ -559,14 +547,17 @@
559547
560548 rc = pn533_finalize_setup(priv);
561549 if (rc)
562
- goto err_deregister;
550
+ goto err_clean;
563551
564552 usb_set_intfdata(interface, phy);
553
+ rc = pn53x_register_nfc(priv, protocols, &interface->dev);
554
+ if (rc)
555
+ goto err_clean;
565556
566557 return 0;
567558
568
-err_deregister:
569
- pn533_unregister_device(phy->priv);
559
+err_clean:
560
+ pn53x_common_clean(priv);
570561 error:
571562 usb_kill_urb(phy->in_urb);
572563 usb_kill_urb(phy->out_urb);
....@@ -589,7 +580,8 @@
589580 if (!phy)
590581 return;
591582
592
- pn533_unregister_device(phy->priv);
583
+ pn53x_unregister_nfc(phy->priv);
584
+ pn53x_common_clean(phy->priv);
593585
594586 usb_set_intfdata(interface, NULL);
595587