aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/nfc/pn533.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 697f154331ed..22efb6a672c4 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -1113,6 +1113,23 @@ static void pn533_send_complete(struct urb *urb)
1113 } 1113 }
1114} 1114}
1115 1115
1116static void pn533_abort_cmd(struct pn533 *dev, gfp_t flags)
1117{
1118 /* ACR122U does not support any command which aborts last
1119 * issued command i.e. as ACK for standard PN533. Additionally,
1120 * it behaves stange, sending broken or incorrect responses,
1121 * when we cancel urb before the chip will send response.
1122 */
1123 if (dev->device_type == PN533_DEVICE_ACR122U)
1124 return;
1125
1126 /* An ack will cancel the last issued command */
1127 pn533_send_ack(dev, flags);
1128
1129 /* cancel the urb request */
1130 usb_kill_urb(dev->in_urb);
1131}
1132
1116static struct sk_buff *pn533_alloc_skb(struct pn533 *dev, unsigned int size) 1133static struct sk_buff *pn533_alloc_skb(struct pn533 *dev, unsigned int size)
1117{ 1134{
1118 struct sk_buff *skb; 1135 struct sk_buff *skb;
@@ -1631,9 +1648,6 @@ static void pn533_listen_mode_timer(unsigned long data)
1631 1648
1632 nfc_dev_dbg(&dev->interface->dev, "Listen mode timeout"); 1649 nfc_dev_dbg(&dev->interface->dev, "Listen mode timeout");
1633 1650
1634 /* An ack will cancel the last issued command (poll) */
1635 pn533_send_ack(dev, GFP_ATOMIC);
1636
1637 dev->cancel_listen = 1; 1651 dev->cancel_listen = 1;
1638 1652
1639 pn533_poll_next_mod(dev); 1653 pn533_poll_next_mod(dev);
@@ -1763,7 +1777,7 @@ static void pn533_wq_poll(struct work_struct *work)
1763 1777
1764 if (dev->cancel_listen == 1) { 1778 if (dev->cancel_listen == 1) {
1765 dev->cancel_listen = 0; 1779 dev->cancel_listen = 0;
1766 usb_kill_urb(dev->in_urb); 1780 pn533_abort_cmd(dev, GFP_ATOMIC);
1767 } 1781 }
1768 1782
1769 rc = pn533_send_poll_frame(dev); 1783 rc = pn533_send_poll_frame(dev);
@@ -1825,12 +1839,7 @@ static void pn533_stop_poll(struct nfc_dev *nfc_dev)
1825 return; 1839 return;
1826 } 1840 }
1827 1841
1828 /* An ack will cancel the last issued command (poll) */ 1842 pn533_abort_cmd(dev, GFP_KERNEL);
1829 pn533_send_ack(dev, GFP_KERNEL);
1830
1831 /* prevent pn533_start_poll_complete to issue a new poll meanwhile */
1832 usb_kill_urb(dev->in_urb);
1833
1834 pn533_poll_reset_mod_list(dev); 1843 pn533_poll_reset_mod_list(dev);
1835} 1844}
1836 1845
@@ -2123,10 +2132,8 @@ static int pn533_dep_link_down(struct nfc_dev *nfc_dev)
2123 2132
2124 pn533_poll_reset_mod_list(dev); 2133 pn533_poll_reset_mod_list(dev);
2125 2134
2126 if (dev->tgt_mode || dev->tgt_active_prot) { 2135 if (dev->tgt_mode || dev->tgt_active_prot)
2127 pn533_send_ack(dev, GFP_KERNEL); 2136 pn533_abort_cmd(dev, GFP_KERNEL);
2128 usb_kill_urb(dev->in_urb);
2129 }
2130 2137
2131 dev->tgt_active_prot = 0; 2138 dev->tgt_active_prot = 0;
2132 dev->tgt_mode = 0; 2139 dev->tgt_mode = 0;