diff options
Diffstat (limited to 'net/nfc/nci/rsp.c')
-rw-r--r-- | net/nfc/nci/rsp.c | 83 |
1 files changed, 35 insertions, 48 deletions
diff --git a/net/nfc/nci/rsp.c b/net/nfc/nci/rsp.c index 0403d4cd0917..0591f5aff89f 100644 --- a/net/nfc/nci/rsp.c +++ b/net/nfc/nci/rsp.c | |||
@@ -42,10 +42,11 @@ static void nci_core_reset_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
42 | 42 | ||
43 | nfc_dbg("entry, status 0x%x", rsp->status); | 43 | nfc_dbg("entry, status 0x%x", rsp->status); |
44 | 44 | ||
45 | if (rsp->status == NCI_STATUS_OK) | 45 | if (rsp->status == NCI_STATUS_OK) { |
46 | ndev->nci_ver = rsp->nci_ver; | 46 | ndev->nci_ver = rsp->nci_ver; |
47 | 47 | nfc_dbg("nci_ver 0x%x, config_status 0x%x", | |
48 | nfc_dbg("nci_ver 0x%x", ndev->nci_ver); | 48 | rsp->nci_ver, rsp->config_status); |
49 | } | ||
49 | 50 | ||
50 | nci_req_complete(ndev, rsp->status); | 51 | nci_req_complete(ndev, rsp->status); |
51 | } | 52 | } |
@@ -58,13 +59,13 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
58 | nfc_dbg("entry, status 0x%x", rsp_1->status); | 59 | nfc_dbg("entry, status 0x%x", rsp_1->status); |
59 | 60 | ||
60 | if (rsp_1->status != NCI_STATUS_OK) | 61 | if (rsp_1->status != NCI_STATUS_OK) |
61 | return; | 62 | goto exit; |
62 | 63 | ||
63 | ndev->nfcc_features = __le32_to_cpu(rsp_1->nfcc_features); | 64 | ndev->nfcc_features = __le32_to_cpu(rsp_1->nfcc_features); |
64 | ndev->num_supported_rf_interfaces = rsp_1->num_supported_rf_interfaces; | 65 | ndev->num_supported_rf_interfaces = rsp_1->num_supported_rf_interfaces; |
65 | 66 | ||
66 | if (ndev->num_supported_rf_interfaces > | 67 | if (ndev->num_supported_rf_interfaces > |
67 | NCI_MAX_SUPPORTED_RF_INTERFACES) { | 68 | NCI_MAX_SUPPORTED_RF_INTERFACES) { |
68 | ndev->num_supported_rf_interfaces = | 69 | ndev->num_supported_rf_interfaces = |
69 | NCI_MAX_SUPPORTED_RF_INTERFACES; | 70 | NCI_MAX_SUPPORTED_RF_INTERFACES; |
70 | } | 71 | } |
@@ -73,20 +74,26 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
73 | rsp_1->supported_rf_interfaces, | 74 | rsp_1->supported_rf_interfaces, |
74 | ndev->num_supported_rf_interfaces); | 75 | ndev->num_supported_rf_interfaces); |
75 | 76 | ||
76 | rsp_2 = (void *) (skb->data + 6 + ndev->num_supported_rf_interfaces); | 77 | rsp_2 = (void *) (skb->data + 6 + rsp_1->num_supported_rf_interfaces); |
77 | 78 | ||
78 | ndev->max_logical_connections = | 79 | ndev->max_logical_connections = |
79 | rsp_2->max_logical_connections; | 80 | rsp_2->max_logical_connections; |
80 | ndev->max_routing_table_size = | 81 | ndev->max_routing_table_size = |
81 | __le16_to_cpu(rsp_2->max_routing_table_size); | 82 | __le16_to_cpu(rsp_2->max_routing_table_size); |
82 | ndev->max_control_packet_payload_length = | 83 | ndev->max_ctrl_pkt_payload_len = |
83 | rsp_2->max_control_packet_payload_length; | 84 | rsp_2->max_ctrl_pkt_payload_len; |
84 | ndev->rf_sending_buffer_size = | 85 | ndev->max_size_for_large_params = |
85 | __le16_to_cpu(rsp_2->rf_sending_buffer_size); | 86 | __le16_to_cpu(rsp_2->max_size_for_large_params); |
86 | ndev->rf_receiving_buffer_size = | 87 | ndev->max_data_pkt_payload_size = |
87 | __le16_to_cpu(rsp_2->rf_receiving_buffer_size); | 88 | rsp_2->max_data_pkt_payload_size; |
88 | ndev->manufacturer_id = | 89 | ndev->initial_num_credits = |
89 | __le16_to_cpu(rsp_2->manufacturer_id); | 90 | rsp_2->initial_num_credits; |
91 | ndev->manufact_id = | ||
92 | rsp_2->manufact_id; | ||
93 | ndev->manufact_specific_info = | ||
94 | __le32_to_cpu(rsp_2->manufact_specific_info); | ||
95 | |||
96 | atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); | ||
90 | 97 | ||
91 | nfc_dbg("nfcc_features 0x%x", | 98 | nfc_dbg("nfcc_features 0x%x", |
92 | ndev->nfcc_features); | 99 | ndev->nfcc_features); |
@@ -104,39 +111,23 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
104 | ndev->max_logical_connections); | 111 | ndev->max_logical_connections); |
105 | nfc_dbg("max_routing_table_size %d", | 112 | nfc_dbg("max_routing_table_size %d", |
106 | ndev->max_routing_table_size); | 113 | ndev->max_routing_table_size); |
107 | nfc_dbg("max_control_packet_payload_length %d", | 114 | nfc_dbg("max_ctrl_pkt_payload_len %d", |
108 | ndev->max_control_packet_payload_length); | 115 | ndev->max_ctrl_pkt_payload_len); |
109 | nfc_dbg("rf_sending_buffer_size %d", | 116 | nfc_dbg("max_size_for_large_params %d", |
110 | ndev->rf_sending_buffer_size); | 117 | ndev->max_size_for_large_params); |
111 | nfc_dbg("rf_receiving_buffer_size %d", | 118 | nfc_dbg("max_data_pkt_payload_size %d", |
112 | ndev->rf_receiving_buffer_size); | 119 | ndev->max_data_pkt_payload_size); |
113 | nfc_dbg("manufacturer_id 0x%x", | 120 | nfc_dbg("initial_num_credits %d", |
114 | ndev->manufacturer_id); | 121 | ndev->initial_num_credits); |
115 | 122 | nfc_dbg("manufact_id 0x%x", | |
123 | ndev->manufact_id); | ||
124 | nfc_dbg("manufact_specific_info 0x%x", | ||
125 | ndev->manufact_specific_info); | ||
126 | |||
127 | exit: | ||
116 | nci_req_complete(ndev, rsp_1->status); | 128 | nci_req_complete(ndev, rsp_1->status); |
117 | } | 129 | } |
118 | 130 | ||
119 | static void nci_core_conn_create_rsp_packet(struct nci_dev *ndev, | ||
120 | struct sk_buff *skb) | ||
121 | { | ||
122 | struct nci_core_conn_create_rsp *rsp = (void *) skb->data; | ||
123 | |||
124 | nfc_dbg("entry, status 0x%x", rsp->status); | ||
125 | |||
126 | if (rsp->status != NCI_STATUS_OK) | ||
127 | return; | ||
128 | |||
129 | ndev->max_pkt_payload_size = rsp->max_pkt_payload_size; | ||
130 | ndev->initial_num_credits = rsp->initial_num_credits; | ||
131 | ndev->conn_id = rsp->conn_id; | ||
132 | |||
133 | atomic_set(&ndev->credits_cnt, ndev->initial_num_credits); | ||
134 | |||
135 | nfc_dbg("max_pkt_payload_size %d", ndev->max_pkt_payload_size); | ||
136 | nfc_dbg("initial_num_credits %d", ndev->initial_num_credits); | ||
137 | nfc_dbg("conn_id %d", ndev->conn_id); | ||
138 | } | ||
139 | |||
140 | static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev, | 131 | static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev, |
141 | struct sk_buff *skb) | 132 | struct sk_buff *skb) |
142 | { | 133 | { |
@@ -196,10 +187,6 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) | |||
196 | nci_core_init_rsp_packet(ndev, skb); | 187 | nci_core_init_rsp_packet(ndev, skb); |
197 | break; | 188 | break; |
198 | 189 | ||
199 | case NCI_OP_CORE_CONN_CREATE_RSP: | ||
200 | nci_core_conn_create_rsp_packet(ndev, skb); | ||
201 | break; | ||
202 | |||
203 | case NCI_OP_RF_DISCOVER_MAP_RSP: | 190 | case NCI_OP_RF_DISCOVER_MAP_RSP: |
204 | nci_rf_disc_map_rsp_packet(ndev, skb); | 191 | nci_rf_disc_map_rsp_packet(ndev, skb); |
205 | break; | 192 | break; |