aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-25 14:17:34 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-25 14:17:34 -0500
commit4ba9920e5e9c0e16b5ed24292d45322907bb9035 (patch)
tree7d023baea59ed0886ded1f0b6d1c6385690b88f7 /net/nfc
parent82c477669a4665eb4e52030792051e0559ee2a36 (diff)
parent8b662fe70c68282f78482dc272df0c4f355e49f5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) BPF debugger and asm tool by Daniel Borkmann. 2) Speed up create/bind in AF_PACKET, also from Daniel Borkmann. 3) Correct reciprocal_divide and update users, from Hannes Frederic Sowa and Daniel Borkmann. 4) Currently we only have a "set" operation for the hw timestamp socket ioctl, add a "get" operation to match. From Ben Hutchings. 5) Add better trace events for debugging driver datapath problems, also from Ben Hutchings. 6) Implement auto corking in TCP, from Eric Dumazet. Basically, if we have a small send and a previous packet is already in the qdisc or device queue, defer until TX completion or we get more data. 7) Allow userspace to manage ipv6 temporary addresses, from Jiri Pirko. 8) Add a qdisc bypass option for AF_PACKET sockets, from Daniel Borkmann. 9) Share IP header compression code between Bluetooth and IEEE802154 layers, from Jukka Rissanen. 10) Fix ipv6 router reachability probing, from Jiri Benc. 11) Allow packets to be captured on macvtap devices, from Vlad Yasevich. 12) Support tunneling in GRO layer, from Jerry Chu. 13) Allow bonding to be configured fully using netlink, from Scott Feldman. 14) Allow AF_PACKET users to obtain the VLAN TPID, just like they can already get the TCI. From Atzm Watanabe. 15) New "Heavy Hitter" qdisc, from Terry Lam. 16) Significantly improve the IPSEC support in pktgen, from Fan Du. 17) Allow ipv4 tunnels to cache routes, just like sockets. From Tom Herbert. 18) Add Proportional Integral Enhanced packet scheduler, from Vijay Subramanian. 19) Allow openvswitch to mmap'd netlink, from Thomas Graf. 20) Key TCP metrics blobs also by source address, not just destination address. From Christoph Paasch. 21) Support 10G in generic phylib. From Andy Fleming. 22) Try to short-circuit GRO flow compares using device provided RX hash, if provided. From Tom Herbert. The wireless and netfilter folks have been busy little bees too. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (2064 commits) net/cxgb4: Fix referencing freed adapter ipv6: reallocate addrconf router for ipv6 address when lo device up fib_frontend: fix possible NULL pointer dereference rtnetlink: remove IFLA_BOND_SLAVE definition rtnetlink: remove check for fill_slave_info in rtnl_have_link_slave_info qlcnic: update version to 5.3.55 qlcnic: Enhance logic to calculate msix vectors. qlcnic: Refactor interrupt coalescing code for all adapters. qlcnic: Update poll controller code path qlcnic: Interrupt code cleanup qlcnic: Enhance Tx timeout debugging. qlcnic: Use bool for rx_mac_learn. bonding: fix u64 division rtnetlink: add missing IFLA_BOND_AD_INFO_UNSPEC sfc: Use the correct maximum TX DMA ring size for SFC9100 Add Shradha Shah as the sfc driver maintainer. net/vxlan: Share RX skb de-marking and checksum checks with ovs tulip: cleanup by using ARRAY_SIZE() ip_tunnel: clear IPCB in ip_tunnel_xmit() in case dst_link_failure() is called net/cxgb4: Don't retrieve stats during recovery ...
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/af_nfc.c4
-rw-r--r--net/nfc/core.c11
-rw-r--r--net/nfc/digital_core.c28
-rw-r--r--net/nfc/digital_dep.c54
-rw-r--r--net/nfc/hci/command.c4
-rw-r--r--net/nfc/hci/core.c11
-rw-r--r--net/nfc/hci/hci.h4
-rw-r--r--net/nfc/hci/hcp.c4
-rw-r--r--net/nfc/hci/llc.c4
-rw-r--r--net/nfc/hci/llc.h4
-rw-r--r--net/nfc/hci/llc_nop.c4
-rw-r--r--net/nfc/hci/llc_shdlc.c4
-rw-r--r--net/nfc/llcp.h4
-rw-r--r--net/nfc/llcp_commands.c10
-rw-r--r--net/nfc/llcp_core.c5
-rw-r--r--net/nfc/llcp_sock.c13
-rw-r--r--net/nfc/nci/core.c30
-rw-r--r--net/nfc/nci/data.c3
-rw-r--r--net/nfc/nci/lib.c3
-rw-r--r--net/nfc/nci/ntf.c3
-rw-r--r--net/nfc/nci/rsp.c3
-rw-r--r--net/nfc/netlink.c4
-rw-r--r--net/nfc/nfc.h4
-rw-r--r--net/nfc/rawsock.c4
24 files changed, 117 insertions, 105 deletions
diff --git a/net/nfc/af_nfc.c b/net/nfc/af_nfc.c
index 9d68441e2a5a..2277276f52bc 100644
--- a/net/nfc/af_nfc.c
+++ b/net/nfc/af_nfc.c
@@ -16,9 +16,7 @@
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the 19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 * Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 20 */
23 21
24#include <linux/nfc.h> 22#include <linux/nfc.h>
diff --git a/net/nfc/core.c b/net/nfc/core.c
index 83b9927e7d19..ca1e65f4b133 100644
--- a/net/nfc/core.c
+++ b/net/nfc/core.c
@@ -16,9 +16,7 @@
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the 19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 * Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 20 */
23 21
24#define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__ 22#define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__
@@ -135,11 +133,8 @@ int nfc_dev_up(struct nfc_dev *dev)
135 dev->dev_up = true; 133 dev->dev_up = true;
136 134
137 /* We have to enable the device before discovering SEs */ 135 /* We have to enable the device before discovering SEs */
138 if (dev->ops->discover_se) { 136 if (dev->ops->discover_se && dev->ops->discover_se(dev))
139 rc = dev->ops->discover_se(dev); 137 pr_err("SE discovery failed\n");
140 if (rc)
141 pr_warn("SE discovery failed\n");
142 }
143 138
144error: 139error:
145 device_unlock(&dev->dev); 140 device_unlock(&dev->dev);
diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c
index 09fc95439955..c129d1571ca6 100644
--- a/net/nfc/digital_core.c
+++ b/net/nfc/digital_core.c
@@ -339,7 +339,6 @@ int digital_target_found(struct nfc_digital_dev *ddev,
339 pr_debug("rf_tech=%d, protocol=%d\n", rf_tech, protocol); 339 pr_debug("rf_tech=%d, protocol=%d\n", rf_tech, protocol);
340 340
341 ddev->curr_rf_tech = rf_tech; 341 ddev->curr_rf_tech = rf_tech;
342 ddev->curr_protocol = protocol;
343 342
344 if (DIGITAL_DRV_CAPS_IN_CRC(ddev)) { 343 if (DIGITAL_DRV_CAPS_IN_CRC(ddev)) {
345 ddev->skb_add_crc = digital_skb_add_crc_none; 344 ddev->skb_add_crc = digital_skb_add_crc_none;
@@ -541,8 +540,14 @@ static int digital_dep_link_up(struct nfc_dev *nfc_dev,
541 __u8 comm_mode, __u8 *gb, size_t gb_len) 540 __u8 comm_mode, __u8 *gb, size_t gb_len)
542{ 541{
543 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev); 542 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
543 int rc;
544
545 rc = digital_in_send_atr_req(ddev, target, comm_mode, gb, gb_len);
544 546
545 return digital_in_send_atr_req(ddev, target, comm_mode, gb, gb_len); 547 if (!rc)
548 ddev->curr_protocol = NFC_PROTO_NFC_DEP;
549
550 return rc;
546} 551}
547 552
548static int digital_dep_link_down(struct nfc_dev *nfc_dev) 553static int digital_dep_link_down(struct nfc_dev *nfc_dev)
@@ -557,6 +562,20 @@ static int digital_dep_link_down(struct nfc_dev *nfc_dev)
557static int digital_activate_target(struct nfc_dev *nfc_dev, 562static int digital_activate_target(struct nfc_dev *nfc_dev,
558 struct nfc_target *target, __u32 protocol) 563 struct nfc_target *target, __u32 protocol)
559{ 564{
565 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
566
567 if (ddev->poll_tech_count) {
568 pr_err("Can't activate a target while polling\n");
569 return -EBUSY;
570 }
571
572 if (ddev->curr_protocol) {
573 pr_err("A target is already active\n");
574 return -EBUSY;
575 }
576
577 ddev->curr_protocol = protocol;
578
560 return 0; 579 return 0;
561} 580}
562 581
@@ -565,6 +584,11 @@ static void digital_deactivate_target(struct nfc_dev *nfc_dev,
565{ 584{
566 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev); 585 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
567 586
587 if (!ddev->curr_protocol) {
588 pr_err("No active target\n");
589 return;
590 }
591
568 ddev->curr_protocol = 0; 592 ddev->curr_protocol = 0;
569} 593}
570 594
diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c
index 8b362e802d2f..d4ed25ff723f 100644
--- a/net/nfc/digital_dep.c
+++ b/net/nfc/digital_dep.c
@@ -32,7 +32,6 @@
32#define DIGITAL_ATR_REQ_MIN_SIZE 16 32#define DIGITAL_ATR_REQ_MIN_SIZE 16
33#define DIGITAL_ATR_REQ_MAX_SIZE 64 33#define DIGITAL_ATR_REQ_MAX_SIZE 64
34 34
35#define DIGITAL_NFCID3_LEN ((u8)8)
36#define DIGITAL_LR_BITS_PAYLOAD_SIZE_254B 0x30 35#define DIGITAL_LR_BITS_PAYLOAD_SIZE_254B 0x30
37#define DIGITAL_GB_BIT 0x02 36#define DIGITAL_GB_BIT 0x02
38 37
@@ -206,10 +205,9 @@ int digital_in_send_atr_req(struct nfc_digital_dev *ddev,
206 atr_req->dir = DIGITAL_NFC_DEP_FRAME_DIR_OUT; 205 atr_req->dir = DIGITAL_NFC_DEP_FRAME_DIR_OUT;
207 atr_req->cmd = DIGITAL_CMD_ATR_REQ; 206 atr_req->cmd = DIGITAL_CMD_ATR_REQ;
208 if (target->nfcid2_len) 207 if (target->nfcid2_len)
209 memcpy(atr_req->nfcid3, target->nfcid2, 208 memcpy(atr_req->nfcid3, target->nfcid2, NFC_NFCID2_MAXSIZE);
210 max(target->nfcid2_len, DIGITAL_NFCID3_LEN));
211 else 209 else
212 get_random_bytes(atr_req->nfcid3, DIGITAL_NFCID3_LEN); 210 get_random_bytes(atr_req->nfcid3, NFC_NFCID3_MAXSIZE);
213 211
214 atr_req->did = 0; 212 atr_req->did = 0;
215 atr_req->bs = 0; 213 atr_req->bs = 0;
@@ -382,6 +380,33 @@ int digital_in_send_dep_req(struct nfc_digital_dev *ddev,
382 data_exch); 380 data_exch);
383} 381}
384 382
383static void digital_tg_set_rf_tech(struct nfc_digital_dev *ddev, u8 rf_tech)
384{
385 ddev->curr_rf_tech = rf_tech;
386
387 ddev->skb_add_crc = digital_skb_add_crc_none;
388 ddev->skb_check_crc = digital_skb_check_crc_none;
389
390 if (DIGITAL_DRV_CAPS_TG_CRC(ddev))
391 return;
392
393 switch (ddev->curr_rf_tech) {
394 case NFC_DIGITAL_RF_TECH_106A:
395 ddev->skb_add_crc = digital_skb_add_crc_a;
396 ddev->skb_check_crc = digital_skb_check_crc_a;
397 break;
398
399 case NFC_DIGITAL_RF_TECH_212F:
400 case NFC_DIGITAL_RF_TECH_424F:
401 ddev->skb_add_crc = digital_skb_add_crc_f;
402 ddev->skb_check_crc = digital_skb_check_crc_f;
403 break;
404
405 default:
406 break;
407 }
408}
409
385static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg, 410static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg,
386 struct sk_buff *resp) 411 struct sk_buff *resp)
387{ 412{
@@ -472,11 +497,13 @@ int digital_tg_send_dep_res(struct nfc_digital_dev *ddev, struct sk_buff *skb)
472static void digital_tg_send_psl_res_complete(struct nfc_digital_dev *ddev, 497static void digital_tg_send_psl_res_complete(struct nfc_digital_dev *ddev,
473 void *arg, struct sk_buff *resp) 498 void *arg, struct sk_buff *resp)
474{ 499{
475 u8 rf_tech = PTR_ERR(arg); 500 u8 rf_tech = (unsigned long)arg;
476 501
477 if (IS_ERR(resp)) 502 if (IS_ERR(resp))
478 return; 503 return;
479 504
505 digital_tg_set_rf_tech(ddev, rf_tech);
506
480 digital_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, rf_tech); 507 digital_tg_configure_hw(ddev, NFC_DIGITAL_CONFIG_RF_TECH, rf_tech);
481 508
482 digital_tg_listen(ddev, 1500, digital_tg_recv_dep_req, NULL); 509 digital_tg_listen(ddev, 1500, digital_tg_recv_dep_req, NULL);
@@ -508,7 +535,7 @@ static int digital_tg_send_psl_res(struct nfc_digital_dev *ddev, u8 did,
508 ddev->skb_add_crc(skb); 535 ddev->skb_add_crc(skb);
509 536
510 rc = digital_tg_send_cmd(ddev, skb, 0, digital_tg_send_psl_res_complete, 537 rc = digital_tg_send_cmd(ddev, skb, 0, digital_tg_send_psl_res_complete,
511 ERR_PTR(rf_tech)); 538 (void *)(unsigned long)rf_tech);
512 539
513 if (rc) 540 if (rc)
514 kfree_skb(skb); 541 kfree_skb(skb);
@@ -661,16 +688,10 @@ void digital_tg_recv_atr_req(struct nfc_digital_dev *ddev, void *arg,
661 688
662 if (resp->data[0] == DIGITAL_NFC_DEP_NFCA_SOD_SB) { 689 if (resp->data[0] == DIGITAL_NFC_DEP_NFCA_SOD_SB) {
663 min_size = DIGITAL_ATR_REQ_MIN_SIZE + 2; 690 min_size = DIGITAL_ATR_REQ_MIN_SIZE + 2;
664 691 digital_tg_set_rf_tech(ddev, NFC_DIGITAL_RF_TECH_106A);
665 ddev->curr_rf_tech = NFC_DIGITAL_RF_TECH_106A;
666 ddev->skb_add_crc = digital_skb_add_crc_a;
667 ddev->skb_check_crc = digital_skb_check_crc_a;
668 } else { 692 } else {
669 min_size = DIGITAL_ATR_REQ_MIN_SIZE + 1; 693 min_size = DIGITAL_ATR_REQ_MIN_SIZE + 1;
670 694 digital_tg_set_rf_tech(ddev, NFC_DIGITAL_RF_TECH_212F);
671 ddev->curr_rf_tech = NFC_DIGITAL_RF_TECH_212F;
672 ddev->skb_add_crc = digital_skb_add_crc_f;
673 ddev->skb_check_crc = digital_skb_check_crc_f;
674 } 695 }
675 696
676 if (resp->len < min_size) { 697 if (resp->len < min_size) {
@@ -678,10 +699,7 @@ void digital_tg_recv_atr_req(struct nfc_digital_dev *ddev, void *arg,
678 goto exit; 699 goto exit;
679 } 700 }
680 701
681 if (DIGITAL_DRV_CAPS_TG_CRC(ddev)) { 702 ddev->curr_protocol = NFC_PROTO_NFC_DEP_MASK;
682 ddev->skb_add_crc = digital_skb_add_crc_none;
683 ddev->skb_check_crc = digital_skb_check_crc_none;
684 }
685 703
686 rc = ddev->skb_check_crc(resp); 704 rc = ddev->skb_check_crc(resp);
687 if (rc) { 705 if (rc) {
diff --git a/net/nfc/hci/command.c b/net/nfc/hci/command.c
index 64f922be9281..a9f4d2e62d8d 100644
--- a/net/nfc/hci/command.c
+++ b/net/nfc/hci/command.c
@@ -12,9 +12,7 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the 15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 16 */
19 17
20#define pr_fmt(fmt) "hci: %s: " fmt, __func__ 18#define pr_fmt(fmt) "hci: %s: " fmt, __func__
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index d07ca4c5cf8c..d45b638e77c7 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -12,9 +12,7 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the 15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 16 */
19 17
20#define pr_fmt(fmt) "hci: %s: " fmt, __func__ 18#define pr_fmt(fmt) "hci: %s: " fmt, __func__
@@ -337,11 +335,8 @@ exit:
337 kfree_skb(skb); 335 kfree_skb(skb);
338 336
339exit_noskb: 337exit_noskb:
340 if (r) { 338 if (r)
341 /* TODO: There was an error dispatching the event, 339 nfc_hci_driver_failure(hdev, r);
342 * how to propagate up to nfc core?
343 */
344 }
345} 340}
346 341
347static void nfc_hci_cmd_timeout(unsigned long data) 342static void nfc_hci_cmd_timeout(unsigned long data)
diff --git a/net/nfc/hci/hci.h b/net/nfc/hci/hci.h
index b274d12c18ac..c3d2e2c1394c 100644
--- a/net/nfc/hci/hci.h
+++ b/net/nfc/hci/hci.h
@@ -12,9 +12,7 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the 15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 16 */
19 17
20#ifndef __LOCAL_HCI_H 18#ifndef __LOCAL_HCI_H
diff --git a/net/nfc/hci/hcp.c b/net/nfc/hci/hcp.c
index b6b4109f2343..e9de1514656e 100644
--- a/net/nfc/hci/hcp.c
+++ b/net/nfc/hci/hcp.c
@@ -12,9 +12,7 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the 15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 16 */
19 17
20#define pr_fmt(fmt) "hci: %s: " fmt, __func__ 18#define pr_fmt(fmt) "hci: %s: " fmt, __func__
diff --git a/net/nfc/hci/llc.c b/net/nfc/hci/llc.c
index fe5e966e5b88..a07d2b818487 100644
--- a/net/nfc/hci/llc.c
+++ b/net/nfc/hci/llc.c
@@ -13,9 +13,7 @@
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the 16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 17 */
20 18
21#include <net/nfc/llc.h> 19#include <net/nfc/llc.h>
diff --git a/net/nfc/hci/llc.h b/net/nfc/hci/llc.h
index 7be0b7f3ceb6..5dad4c57ffb3 100644
--- a/net/nfc/hci/llc.h
+++ b/net/nfc/hci/llc.h
@@ -13,9 +13,7 @@
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the 16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 17 */
20 18
21#ifndef __LOCAL_LLC_H_ 19#ifndef __LOCAL_LLC_H_
diff --git a/net/nfc/hci/llc_nop.c b/net/nfc/hci/llc_nop.c
index 87b10291b40f..d0435d5a197b 100644
--- a/net/nfc/hci/llc_nop.c
+++ b/net/nfc/hci/llc_nop.c
@@ -13,9 +13,7 @@
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the 16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 17 */
20 18
21#include <linux/types.h> 19#include <linux/types.h>
diff --git a/net/nfc/hci/llc_shdlc.c b/net/nfc/hci/llc_shdlc.c
index 3e53c1e029dc..401c7e255273 100644
--- a/net/nfc/hci/llc_shdlc.c
+++ b/net/nfc/hci/llc_shdlc.c
@@ -13,9 +13,7 @@
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the 16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */ 17 */
20 18
21#define pr_fmt(fmt) "shdlc: %s: " fmt, __func__ 19#define pr_fmt(fmt) "shdlc: %s: " fmt, __func__
diff --git a/net/nfc/llcp.h b/net/nfc/llcp.h
index f4d48b57ea11..de1789e3cc82 100644
--- a/net/nfc/llcp.h
+++ b/net/nfc/llcp.h
@@ -12,9 +12,7 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the 15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 16 */
19 17
20enum llcp_state { 18enum llcp_state {
diff --git a/net/nfc/llcp_commands.c b/net/nfc/llcp_commands.c
index 1017894807c0..bec6ed15f503 100644
--- a/net/nfc/llcp_commands.c
+++ b/net/nfc/llcp_commands.c
@@ -12,9 +12,7 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the 15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 16 */
19 17
20#define pr_fmt(fmt) "llcp: %s: " fmt, __func__ 18#define pr_fmt(fmt) "llcp: %s: " fmt, __func__
@@ -677,7 +675,7 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
677 675
678 do { 676 do {
679 remote_miu = sock->remote_miu > LLCP_MAX_MIU ? 677 remote_miu = sock->remote_miu > LLCP_MAX_MIU ?
680 local->remote_miu : sock->remote_miu; 678 LLCP_DEFAULT_MIU : sock->remote_miu;
681 679
682 frag_len = min_t(size_t, remote_miu, remaining_len); 680 frag_len = min_t(size_t, remote_miu, remaining_len);
683 681
@@ -686,8 +684,10 @@ int nfc_llcp_send_i_frame(struct nfc_llcp_sock *sock,
686 684
687 pdu = llcp_allocate_pdu(sock, LLCP_PDU_I, 685 pdu = llcp_allocate_pdu(sock, LLCP_PDU_I,
688 frag_len + LLCP_SEQUENCE_SIZE); 686 frag_len + LLCP_SEQUENCE_SIZE);
689 if (pdu == NULL) 687 if (pdu == NULL) {
688 kfree(msg_data);
690 return -ENOMEM; 689 return -ENOMEM;
690 }
691 691
692 skb_put(pdu, LLCP_SEQUENCE_SIZE); 692 skb_put(pdu, LLCP_SEQUENCE_SIZE);
693 693
diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c
index 81cd3416c7d4..6184bd1fba3a 100644
--- a/net/nfc/llcp_core.c
+++ b/net/nfc/llcp_core.c
@@ -12,9 +12,7 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the 15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 16 */
19 17
20#define pr_fmt(fmt) "llcp: %s: " fmt, __func__ 18#define pr_fmt(fmt) "llcp: %s: " fmt, __func__
@@ -945,7 +943,6 @@ static void nfc_llcp_recv_connect(struct nfc_llcp_local *local,
945 new_sock->local = nfc_llcp_local_get(local); 943 new_sock->local = nfc_llcp_local_get(local);
946 new_sock->rw = sock->rw; 944 new_sock->rw = sock->rw;
947 new_sock->miux = sock->miux; 945 new_sock->miux = sock->miux;
948 new_sock->remote_miu = local->remote_miu;
949 new_sock->nfc_protocol = sock->nfc_protocol; 946 new_sock->nfc_protocol = sock->nfc_protocol;
950 new_sock->dsap = ssap; 947 new_sock->dsap = ssap;
951 new_sock->target_idx = local->target_idx; 948 new_sock->target_idx = local->target_idx;
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c
index 824c6056bf82..51f077a92fa9 100644
--- a/net/nfc/llcp_sock.c
+++ b/net/nfc/llcp_sock.c
@@ -12,9 +12,7 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the 15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 * Free Software Foundation, Inc.,
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */ 16 */
19 17
20#define pr_fmt(fmt) "llcp: %s: " fmt, __func__ 18#define pr_fmt(fmt) "llcp: %s: " fmt, __func__
@@ -702,7 +700,6 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
702 700
703 llcp_sock->dev = dev; 701 llcp_sock->dev = dev;
704 llcp_sock->local = nfc_llcp_local_get(local); 702 llcp_sock->local = nfc_llcp_local_get(local);
705 llcp_sock->remote_miu = llcp_sock->local->remote_miu;
706 llcp_sock->ssap = nfc_llcp_get_local_ssap(local); 703 llcp_sock->ssap = nfc_llcp_get_local_ssap(local);
707 if (llcp_sock->ssap == LLCP_SAP_MAX) { 704 if (llcp_sock->ssap == LLCP_SAP_MAX) {
708 ret = -ENOMEM; 705 ret = -ENOMEM;
@@ -772,8 +769,8 @@ static int llcp_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
772 lock_sock(sk); 769 lock_sock(sk);
773 770
774 if (sk->sk_type == SOCK_DGRAM) { 771 if (sk->sk_type == SOCK_DGRAM) {
775 struct sockaddr_nfc_llcp *addr = 772 DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, addr,
776 (struct sockaddr_nfc_llcp *)msg->msg_name; 773 msg->msg_name);
777 774
778 if (msg->msg_namelen < sizeof(*addr)) { 775 if (msg->msg_namelen < sizeof(*addr)) {
779 release_sock(sk); 776 release_sock(sk);
@@ -845,8 +842,8 @@ static int llcp_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
845 842
846 if (sk->sk_type == SOCK_DGRAM && msg->msg_name) { 843 if (sk->sk_type == SOCK_DGRAM && msg->msg_name) {
847 struct nfc_llcp_ui_cb *ui_cb = nfc_llcp_ui_skb_cb(skb); 844 struct nfc_llcp_ui_cb *ui_cb = nfc_llcp_ui_skb_cb(skb);
848 struct sockaddr_nfc_llcp *sockaddr = 845 DECLARE_SOCKADDR(struct sockaddr_nfc_llcp *, sockaddr,
849 (struct sockaddr_nfc_llcp *) msg->msg_name; 846 msg->msg_name);
850 847
851 msg->msg_namelen = sizeof(struct sockaddr_nfc_llcp); 848 msg->msg_namelen = sizeof(struct sockaddr_nfc_llcp);
852 849
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index b943d46a1644..46bda010bf11 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -20,8 +20,7 @@
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 * 21 *
22 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software 23 * along with this program; if not, see <http://www.gnu.org/licenses/>.
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * 24 *
26 */ 25 */
27 26
@@ -302,6 +301,9 @@ static int nci_open_device(struct nci_dev *ndev)
302 rc = __nci_request(ndev, nci_reset_req, 0, 301 rc = __nci_request(ndev, nci_reset_req, 0,
303 msecs_to_jiffies(NCI_RESET_TIMEOUT)); 302 msecs_to_jiffies(NCI_RESET_TIMEOUT));
304 303
304 if (ndev->ops->setup(ndev))
305 ndev->ops->setup(ndev);
306
305 if (!rc) { 307 if (!rc) {
306 rc = __nci_request(ndev, nci_init_req, 0, 308 rc = __nci_request(ndev, nci_init_req, 0,
307 msecs_to_jiffies(NCI_INIT_TIMEOUT)); 309 msecs_to_jiffies(NCI_INIT_TIMEOUT));
@@ -362,6 +364,8 @@ static int nci_close_device(struct nci_dev *ndev)
362 msecs_to_jiffies(NCI_RESET_TIMEOUT)); 364 msecs_to_jiffies(NCI_RESET_TIMEOUT));
363 clear_bit(NCI_INIT, &ndev->flags); 365 clear_bit(NCI_INIT, &ndev->flags);
364 366
367 del_timer_sync(&ndev->cmd_timer);
368
365 /* Flush cmd wq */ 369 /* Flush cmd wq */
366 flush_workqueue(ndev->cmd_wq); 370 flush_workqueue(ndev->cmd_wq);
367 371
@@ -409,12 +413,26 @@ static int nci_dev_down(struct nfc_dev *nfc_dev)
409 return nci_close_device(ndev); 413 return nci_close_device(ndev);
410} 414}
411 415
416int nci_set_config(struct nci_dev *ndev, __u8 id, size_t len, __u8 *val)
417{
418 struct nci_set_config_param param;
419
420 if (!val || !len)
421 return 0;
422
423 param.id = id;
424 param.len = len;
425 param.val = val;
426
427 return __nci_request(ndev, nci_set_config_req, (unsigned long)&param,
428 msecs_to_jiffies(NCI_SET_CONFIG_TIMEOUT));
429}
430EXPORT_SYMBOL(nci_set_config);
431
412static int nci_set_local_general_bytes(struct nfc_dev *nfc_dev) 432static int nci_set_local_general_bytes(struct nfc_dev *nfc_dev)
413{ 433{
414 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev); 434 struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
415 struct nci_set_config_param param; 435 struct nci_set_config_param param;
416 __u8 local_gb[NFC_MAX_GT_LEN];
417 int i;
418 436
419 param.val = nfc_get_local_general_bytes(nfc_dev, &param.len); 437 param.val = nfc_get_local_general_bytes(nfc_dev, &param.len);
420 if ((param.val == NULL) || (param.len == 0)) 438 if ((param.val == NULL) || (param.len == 0))
@@ -423,11 +441,7 @@ static int nci_set_local_general_bytes(struct nfc_dev *nfc_dev)
423 if (param.len > NFC_MAX_GT_LEN) 441 if (param.len > NFC_MAX_GT_LEN)
424 return -EINVAL; 442 return -EINVAL;
425 443
426 for (i = 0; i < param.len; i++)
427 local_gb[param.len-1-i] = param.val[i];
428
429 param.id = NCI_PN_ATR_REQ_GEN_BYTES; 444 param.id = NCI_PN_ATR_REQ_GEN_BYTES;
430 param.val = local_gb;
431 445
432 return nci_request(ndev, nci_set_config_req, (unsigned long)&param, 446 return nci_request(ndev, nci_set_config_req, (unsigned long)&param,
433 msecs_to_jiffies(NCI_SET_CONFIG_TIMEOUT)); 447 msecs_to_jiffies(NCI_SET_CONFIG_TIMEOUT));
diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c
index 2a9399dd6c68..6c3aef852876 100644
--- a/net/nfc/nci/data.c
+++ b/net/nfc/nci/data.c
@@ -16,8 +16,7 @@
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 * 20 *
22 */ 21 */
23 22
diff --git a/net/nfc/nci/lib.c b/net/nfc/nci/lib.c
index 6b7fd26c68d9..ed774a2e989a 100644
--- a/net/nfc/nci/lib.c
+++ b/net/nfc/nci/lib.c
@@ -20,8 +20,7 @@
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 * 21 *
22 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software 23 * along with this program; if not, see <http://www.gnu.org/licenses/>.
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * 24 *
26 */ 25 */
27 26
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index b2aa98ef0927..1e905097456b 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -20,8 +20,7 @@
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 * 21 *
22 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software 23 * along with this program; if not, see <http://www.gnu.org/licenses/>.
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * 24 *
26 */ 25 */
27 26
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c
index dd072f38ad00..041de51ccdbe 100644
--- a/net/nfc/nci/rsp.c
+++ b/net/nfc/nci/rsp.c
@@ -20,8 +20,7 @@
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 * 21 *
22 * You should have received a copy of the GNU General Public License 22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software 23 * along with this program; if not, see <http://www.gnu.org/licenses/>.
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 * 24 *
26 */ 25 */
27 26
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c
index a9b2342d5253..ebbf6fb88b35 100644
--- a/net/nfc/netlink.c
+++ b/net/nfc/netlink.c
@@ -16,9 +16,7 @@
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the 19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 * Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 20 */
23 21
24#define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__ 22#define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__
diff --git a/net/nfc/nfc.h b/net/nfc/nfc.h
index aaf606fc1faa..9d6e74f7e6b3 100644
--- a/net/nfc/nfc.h
+++ b/net/nfc/nfc.h
@@ -16,9 +16,7 @@
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the 19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 * Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 20 */
23 21
24#ifndef __LOCAL_NFC_H 22#ifndef __LOCAL_NFC_H
diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c
index 66bcd2eb5773..c27a6e86cae4 100644
--- a/net/nfc/rawsock.c
+++ b/net/nfc/rawsock.c
@@ -16,9 +16,7 @@
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the 19 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 * Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 20 */
23 21
24#define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__ 22#define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__