aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/nfc/digital.h6
-rw-r--r--net/nfc/digital_core.c34
-rw-r--r--net/nfc/digital_dep.c14
-rw-r--r--net/nfc/digital_technology.c4
4 files changed, 31 insertions, 27 deletions
diff --git a/net/nfc/digital.h b/net/nfc/digital.h
index 586075a3feed..08b29b55ea63 100644
--- a/net/nfc/digital.h
+++ b/net/nfc/digital.h
@@ -22,10 +22,8 @@
22#include <linux/crc-ccitt.h> 22#include <linux/crc-ccitt.h>
23#include <linux/crc-itu-t.h> 23#include <linux/crc-itu-t.h>
24 24
25#define PR_DBG(fmt, ...) pr_debug("%s: " fmt "\n", __func__, ##__VA_ARGS__) 25#define PROTOCOL_ERR(req) pr_err("%d: NFC Digital Protocol error: %s\n", \
26#define PR_ERR(fmt, ...) pr_err("%s: " fmt "\n", __func__, ##__VA_ARGS__) 26 __LINE__, req)
27#define PROTOCOL_ERR(req) pr_err("%s:%d: NFC Digital Protocol error: %s\n", \
28 __func__, __LINE__, req)
29 27
30#define DIGITAL_CMD_IN_SEND 0 28#define DIGITAL_CMD_IN_SEND 0
31#define DIGITAL_CMD_TG_SEND 1 29#define DIGITAL_CMD_TG_SEND 1
diff --git a/net/nfc/digital_core.c b/net/nfc/digital_core.c
index 66151fc5d990..6f563d09b520 100644
--- a/net/nfc/digital_core.c
+++ b/net/nfc/digital_core.c
@@ -13,6 +13,8 @@
13 * 13 *
14 */ 14 */
15 15
16#define pr_fmt(fmt) "digital: %s: " fmt, __func__
17
16#include <linux/module.h> 18#include <linux/module.h>
17 19
18#include "digital.h" 20#include "digital.h"
@@ -196,14 +198,14 @@ static void digital_wq_cmd(struct work_struct *work)
196 break; 198 break;
197 199
198 default: 200 default:
199 PR_ERR("Unknown cmd type %d", cmd->type); 201 pr_err("Unknown cmd type %d", cmd->type);
200 return; 202 return;
201 } 203 }
202 204
203 if (!rc) 205 if (!rc)
204 return; 206 return;
205 207
206 PR_ERR("in_send_command returned err %d", rc); 208 pr_err("in_send_command returned err %d", rc);
207 209
208 mutex_lock(&ddev->cmd_lock); 210 mutex_lock(&ddev->cmd_lock);
209 list_del(&cmd->queue); 211 list_del(&cmd->queue);
@@ -250,7 +252,7 @@ int digital_in_configure_hw(struct nfc_digital_dev *ddev, int type, int param)
250 252
251 rc = ddev->ops->in_configure_hw(ddev, type, param); 253 rc = ddev->ops->in_configure_hw(ddev, type, param);
252 if (rc) 254 if (rc)
253 PR_ERR("in_configure_hw failed: %d", rc); 255 pr_err("in_configure_hw failed: %d", rc);
254 256
255 return rc; 257 return rc;
256} 258}
@@ -261,7 +263,7 @@ int digital_tg_configure_hw(struct nfc_digital_dev *ddev, int type, int param)
261 263
262 rc = ddev->ops->tg_configure_hw(ddev, type, param); 264 rc = ddev->ops->tg_configure_hw(ddev, type, param);
263 if (rc) 265 if (rc)
264 PR_ERR("tg_configure_hw failed: %d", rc); 266 pr_err("tg_configure_hw failed: %d", rc);
265 267
266 return rc; 268 return rc;
267} 269}
@@ -330,11 +332,11 @@ int digital_target_found(struct nfc_digital_dev *ddev,
330 break; 332 break;
331 333
332 default: 334 default:
333 PR_ERR("Invalid protocol %d", protocol); 335 pr_err("Invalid protocol %d", protocol);
334 return -EINVAL; 336 return -EINVAL;
335 } 337 }
336 338
337 PR_DBG("rf_tech=%d, protocol=%d", rf_tech, protocol); 339 pr_debug("rf_tech=%d, protocol=%d", rf_tech, protocol);
338 340
339 ddev->curr_rf_tech = rf_tech; 341 ddev->curr_rf_tech = rf_tech;
340 ddev->curr_protocol = protocol; 342 ddev->curr_protocol = protocol;
@@ -432,24 +434,24 @@ static int digital_start_poll(struct nfc_dev *nfc_dev, __u32 im_protocols,
432 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev); 434 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
433 u32 matching_im_protocols, matching_tm_protocols; 435 u32 matching_im_protocols, matching_tm_protocols;
434 436
435 PR_DBG("protocols: im 0x%x, tm 0x%x, supported 0x%x", im_protocols, 437 pr_debug("protocols: im 0x%x, tm 0x%x, supported 0x%x", im_protocols,
436 tm_protocols, ddev->protocols); 438 tm_protocols, ddev->protocols);
437 439
438 matching_im_protocols = ddev->protocols & im_protocols; 440 matching_im_protocols = ddev->protocols & im_protocols;
439 matching_tm_protocols = ddev->protocols & tm_protocols; 441 matching_tm_protocols = ddev->protocols & tm_protocols;
440 442
441 if (!matching_im_protocols && !matching_tm_protocols) { 443 if (!matching_im_protocols && !matching_tm_protocols) {
442 PR_ERR("No known protocol"); 444 pr_err("No known protocol");
443 return -EINVAL; 445 return -EINVAL;
444 } 446 }
445 447
446 if (ddev->poll_tech_count) { 448 if (ddev->poll_tech_count) {
447 PR_ERR("Already polling"); 449 pr_err("Already polling");
448 return -EBUSY; 450 return -EBUSY;
449 } 451 }
450 452
451 if (ddev->curr_protocol) { 453 if (ddev->curr_protocol) {
452 PR_ERR("A target is already active"); 454 pr_err("A target is already active");
453 return -EBUSY; 455 return -EBUSY;
454 } 456 }
455 457
@@ -485,7 +487,7 @@ static int digital_start_poll(struct nfc_dev *nfc_dev, __u32 im_protocols,
485 } 487 }
486 488
487 if (!ddev->poll_tech_count) { 489 if (!ddev->poll_tech_count) {
488 PR_ERR("Unsupported protocols: im=0x%x, tm=0x%x", 490 pr_err("Unsupported protocols: im=0x%x, tm=0x%x",
489 matching_im_protocols, matching_tm_protocols); 491 matching_im_protocols, matching_tm_protocols);
490 return -EINVAL; 492 return -EINVAL;
491 } 493 }
@@ -502,7 +504,7 @@ static void digital_stop_poll(struct nfc_dev *nfc_dev)
502 mutex_lock(&ddev->poll_lock); 504 mutex_lock(&ddev->poll_lock);
503 505
504 if (!ddev->poll_tech_count) { 506 if (!ddev->poll_tech_count) {
505 PR_ERR("Polling operation was not running"); 507 pr_err("Polling operation was not running");
506 mutex_unlock(&ddev->poll_lock); 508 mutex_unlock(&ddev->poll_lock);
507 return; 509 return;
508 } 510 }
@@ -609,7 +611,7 @@ static int digital_in_send(struct nfc_dev *nfc_dev, struct nfc_target *target,
609 611
610 data_exch = kzalloc(sizeof(struct digital_data_exch), GFP_KERNEL); 612 data_exch = kzalloc(sizeof(struct digital_data_exch), GFP_KERNEL);
611 if (!data_exch) { 613 if (!data_exch) {
612 PR_ERR("Failed to allocate data_exch struct"); 614 pr_err("Failed to allocate data_exch struct");
613 return -ENOMEM; 615 return -ENOMEM;
614 } 616 }
615 617
@@ -652,7 +654,7 @@ struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops,
652 654
653 ddev = kzalloc(sizeof(struct nfc_digital_dev), GFP_KERNEL); 655 ddev = kzalloc(sizeof(struct nfc_digital_dev), GFP_KERNEL);
654 if (!ddev) { 656 if (!ddev) {
655 PR_ERR("kzalloc failed"); 657 pr_err("kzalloc failed");
656 return NULL; 658 return NULL;
657 } 659 }
658 660
@@ -684,7 +686,7 @@ struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops,
684 ddev->tx_headroom, 686 ddev->tx_headroom,
685 ddev->tx_tailroom); 687 ddev->tx_tailroom);
686 if (!ddev->nfc_dev) { 688 if (!ddev->nfc_dev) {
687 PR_ERR("nfc_allocate_device failed"); 689 pr_err("nfc_allocate_device failed");
688 goto free_dev; 690 goto free_dev;
689 } 691 }
690 692
diff --git a/net/nfc/digital_dep.c b/net/nfc/digital_dep.c
index 810d00c9cd5d..15f140ae9099 100644
--- a/net/nfc/digital_dep.c
+++ b/net/nfc/digital_dep.c
@@ -13,6 +13,8 @@
13 * 13 *
14 */ 14 */
15 15
16#define pr_fmt(fmt) "digital: %s: " fmt, __func__
17
16#include "digital.h" 18#include "digital.h"
17 19
18#define DIGITAL_NFC_DEP_FRAME_DIR_OUT 0xD4 20#define DIGITAL_NFC_DEP_FRAME_DIR_OUT 0xD4
@@ -313,7 +315,7 @@ static void digital_in_recv_dep_res(struct nfc_digital_dev *ddev, void *arg,
313 break; 315 break;
314 316
315 case DIGITAL_NFC_DEP_PFB_ACK_NACK_PDU: 317 case DIGITAL_NFC_DEP_PFB_ACK_NACK_PDU:
316 PR_ERR("Received a ACK/NACK PDU"); 318 pr_err("Received a ACK/NACK PDU");
317 rc = -EIO; 319 rc = -EIO;
318 goto error; 320 goto error;
319 321
@@ -332,7 +334,7 @@ static void digital_in_recv_dep_res(struct nfc_digital_dev *ddev, void *arg,
332 } 334 }
333 335
334 if (DIGITAL_NFC_DEP_MI_BIT_SET(pfb)) { 336 if (DIGITAL_NFC_DEP_MI_BIT_SET(pfb)) {
335 PR_ERR("MI bit set. Chained PDU not supported."); 337 pr_err("MI bit set. Chained PDU not supported.");
336 rc = -EIO; 338 rc = -EIO;
337 goto error; 339 goto error;
338 } 340 }
@@ -424,16 +426,16 @@ static void digital_tg_recv_dep_req(struct nfc_digital_dev *ddev, void *arg,
424 426
425 switch (DIGITAL_NFC_DEP_PFB_TYPE(dep_req->pfb)) { 427 switch (DIGITAL_NFC_DEP_PFB_TYPE(dep_req->pfb)) {
426 case DIGITAL_NFC_DEP_PFB_I_PDU: 428 case DIGITAL_NFC_DEP_PFB_I_PDU:
427 PR_DBG("DIGITAL_NFC_DEP_PFB_I_PDU"); 429 pr_debug("DIGITAL_NFC_DEP_PFB_I_PDU");
428 ddev->curr_nfc_dep_pni = DIGITAL_NFC_DEP_PFB_PNI(dep_req->pfb); 430 ddev->curr_nfc_dep_pni = DIGITAL_NFC_DEP_PFB_PNI(dep_req->pfb);
429 break; 431 break;
430 case DIGITAL_NFC_DEP_PFB_ACK_NACK_PDU: 432 case DIGITAL_NFC_DEP_PFB_ACK_NACK_PDU:
431 PR_ERR("Received a ACK/NACK PDU"); 433 pr_err("Received a ACK/NACK PDU");
432 rc = -EINVAL; 434 rc = -EINVAL;
433 goto exit; 435 goto exit;
434 break; 436 break;
435 case DIGITAL_NFC_DEP_PFB_SUPERVISOR_PDU: 437 case DIGITAL_NFC_DEP_PFB_SUPERVISOR_PDU:
436 PR_ERR("Received a SUPERVISOR PDU"); 438 pr_err("Received a SUPERVISOR PDU");
437 rc = -EINVAL; 439 rc = -EINVAL;
438 goto exit; 440 goto exit;
439 break; 441 break;
@@ -561,7 +563,7 @@ static void digital_tg_recv_psl_req(struct nfc_digital_dev *ddev, void *arg,
561 rf_tech = NFC_DIGITAL_RF_TECH_424F; 563 rf_tech = NFC_DIGITAL_RF_TECH_424F;
562 break; 564 break;
563 default: 565 default:
564 PR_ERR("Unsuported dsi value %d", dsi); 566 pr_err("Unsuported dsi value %d", dsi);
565 goto exit; 567 goto exit;
566 } 568 }
567 569
diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c
index 564735fbbd8f..5a13e1bb1e68 100644
--- a/net/nfc/digital_technology.c
+++ b/net/nfc/digital_technology.c
@@ -13,6 +13,8 @@
13 * 13 *
14 */ 14 */
15 15
16#define pr_fmt(fmt) "digital: %s: " fmt, __func__
17
16#include "digital.h" 18#include "digital.h"
17 19
18#define DIGITAL_CMD_SENS_REQ 0x26 20#define DIGITAL_CMD_SENS_REQ 0x26
@@ -258,7 +260,7 @@ static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev,
258 260
259 skb = digital_skb_alloc(ddev, 2); 261 skb = digital_skb_alloc(ddev, 2);
260 if (!skb) { 262 if (!skb) {
261 PR_ERR("alloc_skb failed"); 263 pr_err("alloc_skb failed");
262 return -ENOMEM; 264 return -ENOMEM;
263 } 265 }
264 266