diff options
author | David S. Miller <davem@davemloft.net> | 2016-01-04 21:48:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-01-04 21:48:15 -0500 |
commit | 15ab90f400781a801017ea2bd8597e6eb3f39f79 (patch) | |
tree | 561d350474e9eeecf4e0364291366b193460c974 /net/nfc | |
parent | 197c949e7798fbf28cfadc69d9ca0c2abbf93191 (diff) | |
parent | c6dc65d885b98898bf287aaf44e020077b41769f (diff) |
Merge tag 'nfc-next-4.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-next
Samuel Ortiz says:
====================
NFC 4.5 pull request
This is the first NFC pull request for 4.5 and it brings:
- A new driver for the STMicroelectronics ST95HF NFC chipset.
The ST95HF is an NFC digital transceiver with an embedded analog
front-end and as such relies on the Linux NFC digital
implementation. This is the 3rd user of the NFC digital stack.
- ACPI support for the ST st-nci and st21nfca drivers.
- A small improvement for the nfcsim driver, as we can now tune
the Rx delay through sysfs.
- A bunch of minor cleanups and small fixes from Christophe Ricard,
for a few drivers and the NFC core code.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/core.c | 13 | ||||
-rw-r--r-- | net/nfc/digital_core.c | 3 | ||||
-rw-r--r-- | net/nfc/nci/core.c | 6 | ||||
-rw-r--r-- | net/nfc/nci/hci.c | 2 | ||||
-rw-r--r-- | net/nfc/netlink.c | 37 | ||||
-rw-r--r-- | net/nfc/nfc.h | 1 |
6 files changed, 57 insertions, 5 deletions
diff --git a/net/nfc/core.c b/net/nfc/core.c index 1fe3d3b362c0..122bb81da918 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c | |||
@@ -953,6 +953,19 @@ out: | |||
953 | } | 953 | } |
954 | EXPORT_SYMBOL(nfc_se_transaction); | 954 | EXPORT_SYMBOL(nfc_se_transaction); |
955 | 955 | ||
956 | int nfc_se_connectivity(struct nfc_dev *dev, u8 se_idx) | ||
957 | { | ||
958 | int rc; | ||
959 | |||
960 | pr_debug("connectivity: %x\n", se_idx); | ||
961 | |||
962 | device_lock(&dev->dev); | ||
963 | rc = nfc_genl_se_connectivity(dev, se_idx); | ||
964 | device_unlock(&dev->dev); | ||
965 | return rc; | ||
966 | } | ||
967 | EXPORT_SYMBOL(nfc_se_connectivity); | ||
968 | |||
956 | static void nfc_release(struct device *d) | 969 | static void nfc_release(struct device *d) |
957 | { | 970 | { |
958 | struct nfc_dev *dev = to_nfc_dev(d); | 971 | struct nfc_dev *dev = to_nfc_dev(d); |
diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c index 23c2a118ac9f..dd9003f38822 100644 --- a/net/nfc/digital_core.c +++ b/net/nfc/digital_core.c | |||
@@ -20,7 +20,8 @@ | |||
20 | #include "digital.h" | 20 | #include "digital.h" |
21 | 21 | ||
22 | #define DIGITAL_PROTO_NFCA_RF_TECH \ | 22 | #define DIGITAL_PROTO_NFCA_RF_TECH \ |
23 | (NFC_PROTO_JEWEL_MASK | NFC_PROTO_MIFARE_MASK | NFC_PROTO_NFC_DEP_MASK) | 23 | (NFC_PROTO_JEWEL_MASK | NFC_PROTO_MIFARE_MASK | \ |
24 | NFC_PROTO_NFC_DEP_MASK | NFC_PROTO_ISO14443_MASK) | ||
24 | 25 | ||
25 | #define DIGITAL_PROTO_NFCB_RF_TECH NFC_PROTO_ISO14443_B_MASK | 26 | #define DIGITAL_PROTO_NFCB_RF_TECH NFC_PROTO_ISO14443_B_MASK |
26 | 27 | ||
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index 10c99a578421..fbb7a2b57b44 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c | |||
@@ -610,14 +610,14 @@ int nci_core_conn_create(struct nci_dev *ndev, u8 destination_type, | |||
610 | struct nci_core_conn_create_cmd *cmd; | 610 | struct nci_core_conn_create_cmd *cmd; |
611 | struct core_conn_create_data data; | 611 | struct core_conn_create_data data; |
612 | 612 | ||
613 | if (!number_destination_params) | ||
614 | return -EINVAL; | ||
615 | |||
613 | data.length = params_len + sizeof(struct nci_core_conn_create_cmd); | 616 | data.length = params_len + sizeof(struct nci_core_conn_create_cmd); |
614 | cmd = kzalloc(data.length, GFP_KERNEL); | 617 | cmd = kzalloc(data.length, GFP_KERNEL); |
615 | if (!cmd) | 618 | if (!cmd) |
616 | return -ENOMEM; | 619 | return -ENOMEM; |
617 | 620 | ||
618 | if (!number_destination_params) | ||
619 | return -EINVAL; | ||
620 | |||
621 | cmd->destination_type = destination_type; | 621 | cmd->destination_type = destination_type; |
622 | cmd->number_destination_params = number_destination_params; | 622 | cmd->number_destination_params = number_destination_params; |
623 | memcpy(cmd->params, params, params_len); | 623 | memcpy(cmd->params, params, params_len); |
diff --git a/net/nfc/nci/hci.c b/net/nfc/nci/hci.c index 2aedac15cb59..a0ab26d535dc 100644 --- a/net/nfc/nci/hci.c +++ b/net/nfc/nci/hci.c | |||
@@ -676,7 +676,7 @@ int nci_hci_connect_gate(struct nci_dev *ndev, | |||
676 | break; | 676 | break; |
677 | default: | 677 | default: |
678 | pipe = nci_hci_create_pipe(ndev, dest_host, dest_gate, &r); | 678 | pipe = nci_hci_create_pipe(ndev, dest_host, dest_gate, &r); |
679 | if (pipe < 0) | 679 | if (pipe == NCI_HCI_INVALID_PIPE) |
680 | return r; | 680 | return r; |
681 | pipe_created = true; | 681 | pipe_created = true; |
682 | break; | 682 | break; |
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index f58c1fba1026..ea023b35f1c2 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -552,6 +552,43 @@ free_msg: | |||
552 | return -EMSGSIZE; | 552 | return -EMSGSIZE; |
553 | } | 553 | } |
554 | 554 | ||
555 | int nfc_genl_se_connectivity(struct nfc_dev *dev, u8 se_idx) | ||
556 | { | ||
557 | struct nfc_se *se; | ||
558 | struct sk_buff *msg; | ||
559 | void *hdr; | ||
560 | |||
561 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); | ||
562 | if (!msg) | ||
563 | return -ENOMEM; | ||
564 | |||
565 | hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, | ||
566 | NFC_EVENT_SE_CONNECTIVITY); | ||
567 | if (!hdr) | ||
568 | goto free_msg; | ||
569 | |||
570 | se = nfc_find_se(dev, se_idx); | ||
571 | if (!se) | ||
572 | goto free_msg; | ||
573 | |||
574 | if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx) || | ||
575 | nla_put_u32(msg, NFC_ATTR_SE_INDEX, se_idx) || | ||
576 | nla_put_u8(msg, NFC_ATTR_SE_TYPE, se->type)) | ||
577 | goto nla_put_failure; | ||
578 | |||
579 | genlmsg_end(msg, hdr); | ||
580 | |||
581 | genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); | ||
582 | |||
583 | return 0; | ||
584 | |||
585 | nla_put_failure: | ||
586 | genlmsg_cancel(msg, hdr); | ||
587 | free_msg: | ||
588 | nlmsg_free(msg); | ||
589 | return -EMSGSIZE; | ||
590 | } | ||
591 | |||
555 | static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, | 592 | static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, |
556 | u32 portid, u32 seq, | 593 | u32 portid, u32 seq, |
557 | struct netlink_callback *cb, | 594 | struct netlink_callback *cb, |
diff --git a/net/nfc/nfc.h b/net/nfc/nfc.h index c20b784ad720..6c6f76b370b1 100644 --- a/net/nfc/nfc.h +++ b/net/nfc/nfc.h | |||
@@ -105,6 +105,7 @@ int nfc_genl_se_added(struct nfc_dev *dev, u32 se_idx, u16 type); | |||
105 | int nfc_genl_se_removed(struct nfc_dev *dev, u32 se_idx); | 105 | int nfc_genl_se_removed(struct nfc_dev *dev, u32 se_idx); |
106 | int nfc_genl_se_transaction(struct nfc_dev *dev, u8 se_idx, | 106 | int nfc_genl_se_transaction(struct nfc_dev *dev, u8 se_idx, |
107 | struct nfc_evt_transaction *evt_transaction); | 107 | struct nfc_evt_transaction *evt_transaction); |
108 | int nfc_genl_se_connectivity(struct nfc_dev *dev, u8 se_idx); | ||
108 | 109 | ||
109 | struct nfc_dev *nfc_get_device(unsigned int idx); | 110 | struct nfc_dev *nfc_get_device(unsigned int idx); |
110 | 111 | ||