aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/nci/ntf.c
diff options
context:
space:
mode:
authorSamuel Ortiz <sameo@linux.intel.com>2012-03-04 19:03:54 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-03-06 15:16:25 -0500
commiteb9bc6e9a0ac668d2283b8fea1534f8ba31d1692 (patch)
tree91e9c684e967a7959cce3ae6de256d0f9ac51f85 /net/nfc/nci/ntf.c
parent0a40acb24602783fcf6881f915659148aa9807d7 (diff)
NFC: NCI code identation fixes
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/nfc/nci/ntf.c')
-rw-r--r--net/nfc/nci/ntf.c75
1 files changed, 35 insertions, 40 deletions
diff --git a/net/nfc/nci/ntf.c b/net/nfc/nci/ntf.c
index 03e7b4626a3e..2e3dee42196d 100644
--- a/net/nfc/nci/ntf.c
+++ b/net/nfc/nci/ntf.c
@@ -40,7 +40,7 @@
40/* Handle NCI Notification packets */ 40/* Handle NCI Notification packets */
41 41
42static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev, 42static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,
43 struct sk_buff *skb) 43 struct sk_buff *skb)
44{ 44{
45 struct nci_core_conn_credit_ntf *ntf = (void *) skb->data; 45 struct nci_core_conn_credit_ntf *ntf = (void *) skb->data;
46 int i; 46 int i;
@@ -62,7 +62,7 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,
62 if (ntf->conn_entries[i].conn_id == NCI_STATIC_RF_CONN_ID) { 62 if (ntf->conn_entries[i].conn_id == NCI_STATIC_RF_CONN_ID) {
63 /* found static rf connection */ 63 /* found static rf connection */
64 atomic_add(ntf->conn_entries[i].credits, 64 atomic_add(ntf->conn_entries[i].credits,
65 &ndev->credits_cnt); 65 &ndev->credits_cnt);
66 } 66 }
67 } 67 }
68 68
@@ -72,7 +72,7 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,
72} 72}
73 73
74static void nci_core_generic_error_ntf_packet(struct nci_dev *ndev, 74static void nci_core_generic_error_ntf_packet(struct nci_dev *ndev,
75 struct sk_buff *skb) 75 struct sk_buff *skb)
76{ 76{
77 __u8 status = skb->data[0]; 77 __u8 status = skb->data[0];
78 78
@@ -80,7 +80,7 @@ static void nci_core_generic_error_ntf_packet(struct nci_dev *ndev,
80 80
81 if (atomic_read(&ndev->state) == NCI_W4_HOST_SELECT) { 81 if (atomic_read(&ndev->state) == NCI_W4_HOST_SELECT) {
82 /* Activation failed, so complete the request 82 /* Activation failed, so complete the request
83 (the state remains the same) */ 83 (the state remains the same) */
84 nci_req_complete(ndev, status); 84 nci_req_complete(ndev, status);
85 } 85 }
86} 86}
@@ -101,7 +101,7 @@ static void nci_core_conn_intf_error_ntf_packet(struct nci_dev *ndev,
101 101
102static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev, 102static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
103 struct rf_tech_specific_params_nfca_poll *nfca_poll, 103 struct rf_tech_specific_params_nfca_poll *nfca_poll,
104 __u8 *data) 104 __u8 *data)
105{ 105{
106 nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data)); 106 nfca_poll->sens_res = __le16_to_cpu(*((__u16 *)data));
107 data += 2; 107 data += 2;
@@ -128,7 +128,7 @@ static __u8 *nci_extract_rf_params_nfca_passive_poll(struct nci_dev *ndev,
128 128
129static __u8 *nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev, 129static __u8 *nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev,
130 struct rf_tech_specific_params_nfcb_poll *nfcb_poll, 130 struct rf_tech_specific_params_nfcb_poll *nfcb_poll,
131 __u8 *data) 131 __u8 *data)
132{ 132{
133 nfcb_poll->sensb_res_len = *data++; 133 nfcb_poll->sensb_res_len = *data++;
134 134
@@ -142,13 +142,13 @@ static __u8 *nci_extract_rf_params_nfcb_passive_poll(struct nci_dev *ndev,
142 142
143static __u8 *nci_extract_rf_params_nfcf_passive_poll(struct nci_dev *ndev, 143static __u8 *nci_extract_rf_params_nfcf_passive_poll(struct nci_dev *ndev,
144 struct rf_tech_specific_params_nfcf_poll *nfcf_poll, 144 struct rf_tech_specific_params_nfcf_poll *nfcf_poll,
145 __u8 *data) 145 __u8 *data)
146{ 146{
147 nfcf_poll->bit_rate = *data++; 147 nfcf_poll->bit_rate = *data++;
148 nfcf_poll->sensf_res_len = *data++; 148 nfcf_poll->sensf_res_len = *data++;
149 149
150 pr_debug("bit_rate %d, sensf_res_len %d\n", 150 pr_debug("bit_rate %d, sensf_res_len %d\n",
151 nfcf_poll->bit_rate, nfcf_poll->sensf_res_len); 151 nfcf_poll->bit_rate, nfcf_poll->sensf_res_len);
152 152
153 memcpy(nfcf_poll->sensf_res, data, nfcf_poll->sensf_res_len); 153 memcpy(nfcf_poll->sensf_res, data, nfcf_poll->sensf_res_len);
154 data += nfcf_poll->sensf_res_len; 154 data += nfcf_poll->sensf_res_len;
@@ -189,7 +189,7 @@ static int nci_add_new_protocol(struct nci_dev *ndev,
189 target->nfcid1_len = nfca_poll->nfcid1_len; 189 target->nfcid1_len = nfca_poll->nfcid1_len;
190 if (target->nfcid1_len > 0) { 190 if (target->nfcid1_len > 0) {
191 memcpy(target->nfcid1, nfca_poll->nfcid1, 191 memcpy(target->nfcid1, nfca_poll->nfcid1,
192 target->nfcid1_len); 192 target->nfcid1_len);
193 } 193 }
194 } else if (rf_tech_and_mode == NCI_NFC_B_PASSIVE_POLL_MODE) { 194 } else if (rf_tech_and_mode == NCI_NFC_B_PASSIVE_POLL_MODE) {
195 nfcb_poll = (struct rf_tech_specific_params_nfcb_poll *)params; 195 nfcb_poll = (struct rf_tech_specific_params_nfcb_poll *)params;
@@ -197,7 +197,7 @@ static int nci_add_new_protocol(struct nci_dev *ndev,
197 target->sensb_res_len = nfcb_poll->sensb_res_len; 197 target->sensb_res_len = nfcb_poll->sensb_res_len;
198 if (target->sensb_res_len > 0) { 198 if (target->sensb_res_len > 0) {
199 memcpy(target->sensb_res, nfcb_poll->sensb_res, 199 memcpy(target->sensb_res, nfcb_poll->sensb_res,
200 target->sensb_res_len); 200 target->sensb_res_len);
201 } 201 }
202 } else if (rf_tech_and_mode == NCI_NFC_F_PASSIVE_POLL_MODE) { 202 } else if (rf_tech_and_mode == NCI_NFC_F_PASSIVE_POLL_MODE) {
203 nfcf_poll = (struct rf_tech_specific_params_nfcf_poll *)params; 203 nfcf_poll = (struct rf_tech_specific_params_nfcf_poll *)params;
@@ -205,7 +205,7 @@ static int nci_add_new_protocol(struct nci_dev *ndev,
205 target->sensf_res_len = nfcf_poll->sensf_res_len; 205 target->sensf_res_len = nfcf_poll->sensf_res_len;
206 if (target->sensf_res_len > 0) { 206 if (target->sensf_res_len > 0) {
207 memcpy(target->sensf_res, nfcf_poll->sensf_res, 207 memcpy(target->sensf_res, nfcf_poll->sensf_res,
208 target->sensf_res_len); 208 target->sensf_res_len);
209 } 209 }
210 } else { 210 } else {
211 pr_err("unsupported rf_tech_and_mode 0x%x\n", rf_tech_and_mode); 211 pr_err("unsupported rf_tech_and_mode 0x%x\n", rf_tech_and_mode);
@@ -220,7 +220,7 @@ static int nci_add_new_protocol(struct nci_dev *ndev,
220} 220}
221 221
222static void nci_add_new_target(struct nci_dev *ndev, 222static void nci_add_new_target(struct nci_dev *ndev,
223 struct nci_rf_discover_ntf *ntf) 223 struct nci_rf_discover_ntf *ntf)
224{ 224{
225 struct nfc_target *target; 225 struct nfc_target *target;
226 int i, rc; 226 int i, rc;
@@ -230,8 +230,8 @@ static void nci_add_new_target(struct nci_dev *ndev,
230 if (target->idx == ntf->rf_discovery_id) { 230 if (target->idx == ntf->rf_discovery_id) {
231 /* This target already exists, add the new protocol */ 231 /* This target already exists, add the new protocol */
232 nci_add_new_protocol(ndev, target, ntf->rf_protocol, 232 nci_add_new_protocol(ndev, target, ntf->rf_protocol,
233 ntf->rf_tech_and_mode, 233 ntf->rf_tech_and_mode,
234 &ntf->rf_tech_specific_params); 234 &ntf->rf_tech_specific_params);
235 return; 235 return;
236 } 236 }
237 } 237 }
@@ -245,27 +245,27 @@ static void nci_add_new_target(struct nci_dev *ndev,
245 target = &ndev->targets[ndev->n_targets]; 245 target = &ndev->targets[ndev->n_targets];
246 246
247 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, 247 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol,
248 ntf->rf_tech_and_mode, 248 ntf->rf_tech_and_mode,
249 &ntf->rf_tech_specific_params); 249 &ntf->rf_tech_specific_params);
250 if (!rc) { 250 if (!rc) {
251 target->idx = ntf->rf_discovery_id; 251 target->idx = ntf->rf_discovery_id;
252 ndev->n_targets++; 252 ndev->n_targets++;
253 253
254 pr_debug("target_idx %d, n_targets %d\n", target->idx, 254 pr_debug("target_idx %d, n_targets %d\n", target->idx,
255 ndev->n_targets); 255 ndev->n_targets);
256 } 256 }
257} 257}
258 258
259void nci_clear_target_list(struct nci_dev *ndev) 259void nci_clear_target_list(struct nci_dev *ndev)
260{ 260{
261 memset(ndev->targets, 0, 261 memset(ndev->targets, 0,
262 (sizeof(struct nfc_target)*NCI_MAX_DISCOVERED_TARGETS)); 262 (sizeof(struct nfc_target)*NCI_MAX_DISCOVERED_TARGETS));
263 263
264 ndev->n_targets = 0; 264 ndev->n_targets = 0;
265} 265}
266 266
267static void nci_rf_discover_ntf_packet(struct nci_dev *ndev, 267static void nci_rf_discover_ntf_packet(struct nci_dev *ndev,
268 struct sk_buff *skb) 268 struct sk_buff *skb)
269{ 269{
270 struct nci_rf_discover_ntf ntf; 270 struct nci_rf_discover_ntf ntf;
271 __u8 *data = skb->data; 271 __u8 *data = skb->data;
@@ -280,7 +280,7 @@ static void nci_rf_discover_ntf_packet(struct nci_dev *ndev,
280 pr_debug("rf_protocol 0x%x\n", ntf.rf_protocol); 280 pr_debug("rf_protocol 0x%x\n", ntf.rf_protocol);
281 pr_debug("rf_tech_and_mode 0x%x\n", ntf.rf_tech_and_mode); 281 pr_debug("rf_tech_and_mode 0x%x\n", ntf.rf_tech_and_mode);
282 pr_debug("rf_tech_specific_params_len %d\n", 282 pr_debug("rf_tech_specific_params_len %d\n",
283 ntf.rf_tech_specific_params_len); 283 ntf.rf_tech_specific_params_len);
284 284
285 if (ntf.rf_tech_specific_params_len > 0) { 285 if (ntf.rf_tech_specific_params_len > 0) {
286 switch (ntf.rf_tech_and_mode) { 286 switch (ntf.rf_tech_and_mode) {
@@ -318,7 +318,7 @@ static void nci_rf_discover_ntf_packet(struct nci_dev *ndev,
318 } else { 318 } else {
319 atomic_set(&ndev->state, NCI_W4_HOST_SELECT); 319 atomic_set(&ndev->state, NCI_W4_HOST_SELECT);
320 nfc_targets_found(ndev->nfc_dev, ndev->targets, 320 nfc_targets_found(ndev->nfc_dev, ndev->targets,
321 ndev->n_targets); 321 ndev->n_targets);
322 } 322 }
323} 323}
324 324
@@ -335,20 +335,17 @@ static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
335 pr_debug("rats_res_len %d\n", nfca_poll->rats_res_len); 335 pr_debug("rats_res_len %d\n", nfca_poll->rats_res_len);
336 if (nfca_poll->rats_res_len > 0) { 336 if (nfca_poll->rats_res_len > 0) {
337 memcpy(nfca_poll->rats_res, 337 memcpy(nfca_poll->rats_res,
338 data, 338 data, nfca_poll->rats_res_len);
339 nfca_poll->rats_res_len);
340 } 339 }
341 break; 340 break;
342 341
343 case NCI_NFC_B_PASSIVE_POLL_MODE: 342 case NCI_NFC_B_PASSIVE_POLL_MODE:
344 nfcb_poll = &ntf->activation_params.nfcb_poll_iso_dep; 343 nfcb_poll = &ntf->activation_params.nfcb_poll_iso_dep;
345 nfcb_poll->attrib_res_len = *data++; 344 nfcb_poll->attrib_res_len = *data++;
346 pr_debug("attrib_res_len %d\n", 345 pr_debug("attrib_res_len %d\n", nfcb_poll->attrib_res_len);
347 nfcb_poll->attrib_res_len);
348 if (nfcb_poll->attrib_res_len > 0) { 346 if (nfcb_poll->attrib_res_len > 0) {
349 memcpy(nfcb_poll->attrib_res, 347 memcpy(nfcb_poll->attrib_res,
350 data, 348 data, nfcb_poll->attrib_res_len);
351 nfcb_poll->attrib_res_len);
352 } 349 }
353 break; 350 break;
354 351
@@ -362,7 +359,7 @@ static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,
362} 359}
363 360
364static void nci_target_auto_activated(struct nci_dev *ndev, 361static void nci_target_auto_activated(struct nci_dev *ndev,
365 struct nci_rf_intf_activated_ntf *ntf) 362 struct nci_rf_intf_activated_ntf *ntf)
366{ 363{
367 struct nfc_target *target; 364 struct nfc_target *target;
368 int rc; 365 int rc;
@@ -370,8 +367,8 @@ static void nci_target_auto_activated(struct nci_dev *ndev,
370 target = &ndev->targets[ndev->n_targets]; 367 target = &ndev->targets[ndev->n_targets];
371 368
372 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol, 369 rc = nci_add_new_protocol(ndev, target, ntf->rf_protocol,
373 ntf->activation_rf_tech_and_mode, 370 ntf->activation_rf_tech_and_mode,
374 &ntf->rf_tech_specific_params); 371 &ntf->rf_tech_specific_params);
375 if (rc) 372 if (rc)
376 return; 373 return;
377 374
@@ -384,7 +381,7 @@ static void nci_target_auto_activated(struct nci_dev *ndev,
384} 381}
385 382
386static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev, 383static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
387 struct sk_buff *skb) 384 struct sk_buff *skb)
388{ 385{
389 struct nci_rf_intf_activated_ntf ntf; 386 struct nci_rf_intf_activated_ntf ntf;
390 __u8 *data = skb->data; 387 __u8 *data = skb->data;
@@ -405,7 +402,8 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
405 ntf.activation_rf_tech_and_mode); 402 ntf.activation_rf_tech_and_mode);
406 pr_debug("max_data_pkt_payload_size 0x%x\n", 403 pr_debug("max_data_pkt_payload_size 0x%x\n",
407 ntf.max_data_pkt_payload_size); 404 ntf.max_data_pkt_payload_size);
408 pr_debug("initial_num_credits 0x%x\n", ntf.initial_num_credits); 405 pr_debug("initial_num_credits 0x%x\n",
406 ntf.initial_num_credits);
409 pr_debug("rf_tech_specific_params_len %d\n", 407 pr_debug("rf_tech_specific_params_len %d\n",
410 ntf.rf_tech_specific_params_len); 408 ntf.rf_tech_specific_params_len);
411 409
@@ -441,18 +439,15 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,
441 439
442 pr_debug("data_exch_rf_tech_and_mode 0x%x\n", 440 pr_debug("data_exch_rf_tech_and_mode 0x%x\n",
443 ntf.data_exch_rf_tech_and_mode); 441 ntf.data_exch_rf_tech_and_mode);
444 pr_debug("data_exch_tx_bit_rate 0x%x\n", 442 pr_debug("data_exch_tx_bit_rate 0x%x\n", ntf.data_exch_tx_bit_rate);
445 ntf.data_exch_tx_bit_rate); 443 pr_debug("data_exch_rx_bit_rate 0x%x\n", ntf.data_exch_rx_bit_rate);
446 pr_debug("data_exch_rx_bit_rate 0x%x\n", 444 pr_debug("activation_params_len %d\n", ntf.activation_params_len);
447 ntf.data_exch_rx_bit_rate);
448 pr_debug("activation_params_len %d\n",
449 ntf.activation_params_len);
450 445
451 if (ntf.activation_params_len > 0) { 446 if (ntf.activation_params_len > 0) {
452 switch (ntf.rf_interface) { 447 switch (ntf.rf_interface) {
453 case NCI_RF_INTERFACE_ISO_DEP: 448 case NCI_RF_INTERFACE_ISO_DEP:
454 err = nci_extract_activation_params_iso_dep(ndev, 449 err = nci_extract_activation_params_iso_dep(ndev,
455 &ntf, data); 450 &ntf, data);
456 break; 451 break;
457 452
458 case NCI_RF_INTERFACE_FRAME: 453 case NCI_RF_INTERFACE_FRAME:
@@ -489,7 +484,7 @@ exit:
489} 484}
490 485
491static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev, 486static void nci_rf_deactivate_ntf_packet(struct nci_dev *ndev,
492 struct sk_buff *skb) 487 struct sk_buff *skb)
493{ 488{
494 struct nci_rf_deactivate_ntf *ntf = (void *) skb->data; 489 struct nci_rf_deactivate_ntf *ntf = (void *) skb->data;
495 490