| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for NXP PN533 NFC Chip - USB transport layer |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2011 Instituto Nokia de Tecnologia |
|---|
| 5 | 6 | * 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/>. |
|---|
| 19 | 7 | */ |
|---|
| 20 | 8 | |
|---|
| 21 | 9 | #include <linux/device.h> |
|---|
| .. | .. |
|---|
| 222 | 210 | usb_kill_urb(phy->in_urb); |
|---|
| 223 | 211 | } |
|---|
| 224 | 212 | |
|---|
| 225 | | -/* ACR122 specific structs and fucntions */ |
|---|
| 213 | +/* ACR122 specific structs and functions */ |
|---|
| 226 | 214 | |
|---|
| 227 | 215 | /* ACS ACR122 pn533 frame definitions */ |
|---|
| 228 | 216 | #define PN533_ACR122_TX_FRAME_HEADER_LEN (sizeof(struct pn533_acr122_tx_frame) \ |
|---|
| .. | .. |
|---|
| 546 | 534 | goto error; |
|---|
| 547 | 535 | } |
|---|
| 548 | 536 | |
|---|
| 549 | | - priv = pn533_register_device(id->driver_info, protocols, protocol_type, |
|---|
| 537 | + priv = pn53x_common_init(id->driver_info, protocol_type, |
|---|
| 550 | 538 | phy, &usb_phy_ops, fops, |
|---|
| 551 | | - &phy->udev->dev, &interface->dev); |
|---|
| 539 | + &phy->udev->dev); |
|---|
| 552 | 540 | |
|---|
| 553 | 541 | if (IS_ERR(priv)) { |
|---|
| 554 | 542 | rc = PTR_ERR(priv); |
|---|
| .. | .. |
|---|
| 559 | 547 | |
|---|
| 560 | 548 | rc = pn533_finalize_setup(priv); |
|---|
| 561 | 549 | if (rc) |
|---|
| 562 | | - goto err_deregister; |
|---|
| 550 | + goto err_clean; |
|---|
| 563 | 551 | |
|---|
| 564 | 552 | usb_set_intfdata(interface, phy); |
|---|
| 553 | + rc = pn53x_register_nfc(priv, protocols, &interface->dev); |
|---|
| 554 | + if (rc) |
|---|
| 555 | + goto err_clean; |
|---|
| 565 | 556 | |
|---|
| 566 | 557 | return 0; |
|---|
| 567 | 558 | |
|---|
| 568 | | -err_deregister: |
|---|
| 569 | | - pn533_unregister_device(phy->priv); |
|---|
| 559 | +err_clean: |
|---|
| 560 | + pn53x_common_clean(priv); |
|---|
| 570 | 561 | error: |
|---|
| 571 | 562 | usb_kill_urb(phy->in_urb); |
|---|
| 572 | 563 | usb_kill_urb(phy->out_urb); |
|---|
| .. | .. |
|---|
| 589 | 580 | if (!phy) |
|---|
| 590 | 581 | return; |
|---|
| 591 | 582 | |
|---|
| 592 | | - pn533_unregister_device(phy->priv); |
|---|
| 583 | + pn53x_unregister_nfc(phy->priv); |
|---|
| 584 | + pn53x_common_clean(phy->priv); |
|---|
| 593 | 585 | |
|---|
| 594 | 586 | usb_set_intfdata(interface, NULL); |
|---|
| 595 | 587 | |
|---|