aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn533.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-09 21:24:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-09 21:24:39 -0400
commit496322bc91e35007ed754184dcd447a02b6dd685 (patch)
treef5298d0a74c0a6e65c0e98050b594b8d020904c1 /drivers/nfc/pn533.c
parent2e17c5a97e231f3cb426f4b7895eab5be5c5442e (diff)
parent56e0ef527b184b3de2d7f88c6190812b2b2ac6bf (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: "This is a re-do of the net-next pull request for the current merge window. The only difference from the one I made the other day is that this has Eliezer's interface renames and the timeout handling changes made based upon your feedback, as well as a few bug fixes that have trickeled in. Highlights: 1) Low latency device polling, eliminating the cost of interrupt handling and context switches. Allows direct polling of a network device from socket operations, such as recvmsg() and poll(). Currently ixgbe, mlx4, and bnx2x support this feature. Full high level description, performance numbers, and design in commit 0a4db187a999 ("Merge branch 'll_poll'") From Eliezer Tamir. 2) With the routing cache removed, ip_check_mc_rcu() gets exercised more than ever before in the case where we have lots of multicast addresses. Use a hash table instead of a simple linked list, from Eric Dumazet. 3) Add driver for Atheros CQA98xx 802.11ac wireless devices, from Bartosz Markowski, Janusz Dziedzic, Kalle Valo, Marek Kwaczynski, Marek Puzyniak, Michal Kazior, and Sujith Manoharan. 4) Support reporting the TUN device persist flag to userspace, from Pavel Emelyanov. 5) Allow controlling network device VF link state using netlink, from Rony Efraim. 6) Support GRE tunneling in openvswitch, from Pravin B Shelar. 7) Adjust SOCK_MIN_RCVBUF and SOCK_MIN_SNDBUF for modern times, from Daniel Borkmann and Eric Dumazet. 8) Allow controlling of TCP quickack behavior on a per-route basis, from Cong Wang. 9) Several bug fixes and improvements to vxlan from Stephen Hemminger, Pravin B Shelar, and Mike Rapoport. In particular, support receiving on multiple UDP ports. 10) Major cleanups, particular in the area of debugging and cookie lifetime handline, to the SCTP protocol code. From Daniel Borkmann. 11) Allow packets to cross network namespaces when traversing tunnel devices. From Nicolas Dichtel. 12) Allow monitoring netlink traffic via AF_PACKET sockets, in a manner akin to how we monitor real network traffic via ptype_all. From Daniel Borkmann. 13) Several bug fixes and improvements for the new alx device driver, from Johannes Berg. 14) Fix scalability issues in the netem packet scheduler's time queue, by using an rbtree. From Eric Dumazet. 15) Several bug fixes in TCP loss recovery handling, from Yuchung Cheng. 16) Add support for GSO segmentation of MPLS packets, from Simon Horman. 17) Make network notifiers have a real data type for the opaque pointer that's passed into them. Use this to properly handle network device flag changes in arp_netdev_event(). From Jiri Pirko and Timo Teräs. 18) Convert several drivers over to module_pci_driver(), from Peter Huewe. 19) tcp_fixup_rcvbuf() can loop 500 times over loopback, just use a O(1) calculation instead. From Eric Dumazet. 20) Support setting of explicit tunnel peer addresses in ipv6, just like ipv4. From Nicolas Dichtel. 21) Protect x86 BPF JIT against spraying attacks, from Eric Dumazet. 22) Prevent a single high rate flow from overruning an individual cpu during RX packet processing via selective flow shedding. From Willem de Bruijn. 23) Don't use spinlocks in TCP md5 signing fast paths, from Eric Dumazet. 24) Don't just drop GSO packets which are above the TBF scheduler's burst limit, chop them up so they are in-bounds instead. Also from Eric Dumazet. 25) VLAN offloads are missed when configured on top of a bridge, fix from Vlad Yasevich. 26) Support IPV6 in ping sockets. From Lorenzo Colitti. 27) Receive flow steering targets should be updated at poll() time too, from David Majnemer. 28) Fix several corner case regressions in PMTU/redirect handling due to the routing cache removal, from Timo Teräs. 29) We have to be mindful of ipv4 mapped ipv6 sockets in upd_v6_push_pending_frames(). From Hannes Frederic Sowa. 30) Fix L2TP sequence number handling bugs, from James Chapman." * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1214 commits) drivers/net: caif: fix wrong rtnl_is_locked() usage drivers/net: enic: release rtnl_lock on error-path vhost-net: fix use-after-free in vhost_net_flush net: mv643xx_eth: do not use port number as platform device id net: sctp: confirm route during forward progress virtio_net: fix race in RX VQ processing virtio: support unlocked queue poll net/cadence/macb: fix bug/typo in extracting gem_irq_read_clear bit Documentation: Fix references to defunct linux-net@vger.kernel.org net/fs: change busy poll time accounting net: rename low latency sockets functions to busy poll bridge: fix some kernel warning in multicast timer sfc: Fix memory leak when discarding scattered packets sit: fix tunnel update via netlink dt:net:stmmac: Add dt specific phy reset callback support. dt:net:stmmac: Add support to dwmac version 3.610 and 3.710 dt:net:stmmac: Allocate platform data only if its NULL. net:stmmac: fix memleak in the open method ipv6: rt6_check_neigh should successfully verify neigh if no NUD information are available net: ipv6: fix wrong ping_v6_sendmsg return value ...
Diffstat (limited to 'drivers/nfc/pn533.c')
-rw-r--r--drivers/nfc/pn533.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index ec269e6f0375..daf92ac209f8 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -258,7 +258,7 @@ static const struct pn533_poll_modulations poll_mod[] = {
258 .opcode = PN533_FELICA_OPC_SENSF_REQ, 258 .opcode = PN533_FELICA_OPC_SENSF_REQ,
259 .sc = PN533_FELICA_SENSF_SC_ALL, 259 .sc = PN533_FELICA_SENSF_SC_ALL,
260 .rc = PN533_FELICA_SENSF_RC_NO_SYSTEM_CODE, 260 .rc = PN533_FELICA_SENSF_RC_NO_SYSTEM_CODE,
261 .tsn = 0, 261 .tsn = 0x03,
262 }, 262 },
263 }, 263 },
264 .len = 7, 264 .len = 7,
@@ -271,7 +271,7 @@ static const struct pn533_poll_modulations poll_mod[] = {
271 .opcode = PN533_FELICA_OPC_SENSF_REQ, 271 .opcode = PN533_FELICA_OPC_SENSF_REQ,
272 .sc = PN533_FELICA_SENSF_SC_ALL, 272 .sc = PN533_FELICA_SENSF_SC_ALL,
273 .rc = PN533_FELICA_SENSF_RC_NO_SYSTEM_CODE, 273 .rc = PN533_FELICA_SENSF_RC_NO_SYSTEM_CODE,
274 .tsn = 0, 274 .tsn = 0x03,
275 }, 275 },
276 }, 276 },
277 .len = 7, 277 .len = 7,
@@ -1235,7 +1235,7 @@ static int pn533_target_found_type_a(struct nfc_target *nfc_tgt, u8 *tgt_data,
1235struct pn533_target_felica { 1235struct pn533_target_felica {
1236 u8 pol_res; 1236 u8 pol_res;
1237 u8 opcode; 1237 u8 opcode;
1238 u8 nfcid2[8]; 1238 u8 nfcid2[NFC_NFCID2_MAXSIZE];
1239 u8 pad[8]; 1239 u8 pad[8];
1240 /* optional */ 1240 /* optional */
1241 u8 syst_code[]; 1241 u8 syst_code[];
@@ -1275,6 +1275,9 @@ static int pn533_target_found_felica(struct nfc_target *nfc_tgt, u8 *tgt_data,
1275 memcpy(nfc_tgt->sensf_res, &tgt_felica->opcode, 9); 1275 memcpy(nfc_tgt->sensf_res, &tgt_felica->opcode, 9);
1276 nfc_tgt->sensf_res_len = 9; 1276 nfc_tgt->sensf_res_len = 9;
1277 1277
1278 memcpy(nfc_tgt->nfcid2, tgt_felica->nfcid2, NFC_NFCID2_MAXSIZE);
1279 nfc_tgt->nfcid2_len = NFC_NFCID2_MAXSIZE;
1280
1278 return 0; 1281 return 0;
1279} 1282}
1280 1283
@@ -2084,6 +2087,9 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
2084 if (comm_mode == NFC_COMM_PASSIVE) 2087 if (comm_mode == NFC_COMM_PASSIVE)
2085 skb_len += PASSIVE_DATA_LEN; 2088 skb_len += PASSIVE_DATA_LEN;
2086 2089
2090 if (target && target->nfcid2_len)
2091 skb_len += NFC_NFCID3_MAXSIZE;
2092
2087 skb = pn533_alloc_skb(dev, skb_len); 2093 skb = pn533_alloc_skb(dev, skb_len);
2088 if (!skb) 2094 if (!skb)
2089 return -ENOMEM; 2095 return -ENOMEM;
@@ -2100,6 +2106,12 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
2100 *next |= 1; 2106 *next |= 1;
2101 } 2107 }
2102 2108
2109 if (target && target->nfcid2_len) {
2110 memcpy(skb_put(skb, NFC_NFCID3_MAXSIZE), target->nfcid2,
2111 target->nfcid2_len);
2112 *next |= 2;
2113 }
2114
2103 if (gb != NULL && gb_len > 0) { 2115 if (gb != NULL && gb_len > 0) {
2104 memcpy(skb_put(skb, gb_len), gb, gb_len); 2116 memcpy(skb_put(skb, gb_len), gb, gb_len);
2105 *next |= 4; /* We have some Gi */ 2117 *next |= 4; /* We have some Gi */
@@ -2489,7 +2501,7 @@ static void pn533_acr122_poweron_rdr_resp(struct urb *urb)
2489 2501
2490 nfc_dev_dbg(&urb->dev->dev, "%s", __func__); 2502 nfc_dev_dbg(&urb->dev->dev, "%s", __func__);
2491 2503
2492 print_hex_dump(KERN_ERR, "ACR122 RX: ", DUMP_PREFIX_NONE, 16, 1, 2504 print_hex_dump_debug("ACR122 RX: ", DUMP_PREFIX_NONE, 16, 1,
2493 urb->transfer_buffer, urb->transfer_buffer_length, 2505 urb->transfer_buffer, urb->transfer_buffer_length,
2494 false); 2506 false);
2495 2507
@@ -2520,7 +2532,7 @@ static int pn533_acr122_poweron_rdr(struct pn533 *dev)
2520 dev->out_urb->transfer_buffer = cmd; 2532 dev->out_urb->transfer_buffer = cmd;
2521 dev->out_urb->transfer_buffer_length = sizeof(cmd); 2533 dev->out_urb->transfer_buffer_length = sizeof(cmd);
2522 2534
2523 print_hex_dump(KERN_ERR, "ACR122 TX: ", DUMP_PREFIX_NONE, 16, 1, 2535 print_hex_dump_debug("ACR122 TX: ", DUMP_PREFIX_NONE, 16, 1,
2524 cmd, sizeof(cmd), false); 2536 cmd, sizeof(cmd), false);
2525 2537
2526 rc = usb_submit_urb(dev->out_urb, GFP_KERNEL); 2538 rc = usb_submit_urb(dev->out_urb, GFP_KERNEL);
@@ -2774,17 +2786,18 @@ static int pn533_probe(struct usb_interface *interface,
2774 goto destroy_wq; 2786 goto destroy_wq;
2775 2787
2776 nfc_dev_info(&dev->interface->dev, 2788 nfc_dev_info(&dev->interface->dev,
2777 "NXP PN533 firmware ver %d.%d now attached", 2789 "NXP PN5%02X firmware ver %d.%d now attached",
2778 fw_ver.ver, fw_ver.rev); 2790 fw_ver.ic, fw_ver.ver, fw_ver.rev);
2779 2791
2780 2792
2781 dev->nfc_dev = nfc_allocate_device(&pn533_nfc_ops, protocols, 2793 dev->nfc_dev = nfc_allocate_device(&pn533_nfc_ops, protocols,
2782 NFC_SE_NONE,
2783 dev->ops->tx_header_len + 2794 dev->ops->tx_header_len +
2784 PN533_CMD_DATAEXCH_HEAD_LEN, 2795 PN533_CMD_DATAEXCH_HEAD_LEN,
2785 dev->ops->tx_tail_len); 2796 dev->ops->tx_tail_len);
2786 if (!dev->nfc_dev) 2797 if (!dev->nfc_dev) {
2798 rc = -ENOMEM;
2787 goto destroy_wq; 2799 goto destroy_wq;
2800 }
2788 2801
2789 nfc_set_parent_dev(dev->nfc_dev, &interface->dev); 2802 nfc_set_parent_dev(dev->nfc_dev, &interface->dev);
2790 nfc_set_drvdata(dev->nfc_dev, dev); 2803 nfc_set_drvdata(dev->nfc_dev, dev);