提交 073a625f 编写于 作者: J Joe Perches 提交者: Samuel Ortiz

NFC: Convert nfc_dev_info and nfc_dev_err to nfc_<level>

Use a more standard kernel style macro logging name.

Standardize the spacing of the "NFC: " prefix.
Add \n to uses, remove from macro.
Fix the defective uses that already had a \n.
Signed-off-by: NJoe Perches <joe@perches.com>
Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
上级 b4834839
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <linux/nfc.h> #include <linux/nfc.h>
#include <net/nfc/nfc.h> #include <net/nfc/nfc.h>
#define DEV_ERR(_dev, fmt, args...) nfc_dev_err(&_dev->nfc_dev->dev, \ #define DEV_ERR(_dev, fmt, args...) nfc_err(&_dev->nfc_dev->dev, \
"%s: " fmt, __func__, ## args) "%s: " fmt, __func__, ## args)
#define DEV_DBG(_dev, fmt, args...) dev_dbg(&_dev->nfc_dev->dev, \ #define DEV_DBG(_dev, fmt, args...) dev_dbg(&_dev->nfc_dev->dev, \
...@@ -143,7 +143,7 @@ static int nfcsim_dep_link_up(struct nfc_dev *nfc_dev, ...@@ -143,7 +143,7 @@ static int nfcsim_dep_link_up(struct nfc_dev *nfc_dev,
remote_gb = nfc_get_local_general_bytes(peer->nfc_dev, &remote_gb_len); remote_gb = nfc_get_local_general_bytes(peer->nfc_dev, &remote_gb_len);
if (!remote_gb) { if (!remote_gb) {
DEV_ERR(peer, "Can't get remote general bytes"); DEV_ERR(peer, "Can't get remote general bytes\n");
mutex_unlock(&peer->lock); mutex_unlock(&peer->lock);
return -EINVAL; return -EINVAL;
...@@ -155,7 +155,7 @@ static int nfcsim_dep_link_up(struct nfc_dev *nfc_dev, ...@@ -155,7 +155,7 @@ static int nfcsim_dep_link_up(struct nfc_dev *nfc_dev,
rc = nfc_set_remote_general_bytes(nfc_dev, remote_gb, remote_gb_len); rc = nfc_set_remote_general_bytes(nfc_dev, remote_gb, remote_gb_len);
if (rc) { if (rc) {
DEV_ERR(dev, "Can't set remote general bytes"); DEV_ERR(dev, "Can't set remote general bytes\n");
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
return rc; return rc;
} }
...@@ -188,7 +188,7 @@ static int nfcsim_start_poll(struct nfc_dev *nfc_dev, ...@@ -188,7 +188,7 @@ static int nfcsim_start_poll(struct nfc_dev *nfc_dev,
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
if (dev->polling_mode != NFCSIM_POLL_NONE) { if (dev->polling_mode != NFCSIM_POLL_NONE) {
DEV_ERR(dev, "Already in polling mode"); DEV_ERR(dev, "Already in polling mode\n");
rc = -EBUSY; rc = -EBUSY;
goto exit; goto exit;
} }
...@@ -200,7 +200,7 @@ static int nfcsim_start_poll(struct nfc_dev *nfc_dev, ...@@ -200,7 +200,7 @@ static int nfcsim_start_poll(struct nfc_dev *nfc_dev,
dev->polling_mode |= NFCSIM_POLL_TARGET; dev->polling_mode |= NFCSIM_POLL_TARGET;
if (dev->polling_mode == NFCSIM_POLL_NONE) { if (dev->polling_mode == NFCSIM_POLL_NONE) {
DEV_ERR(dev, "Unsupported polling mode"); DEV_ERR(dev, "Unsupported polling mode\n");
rc = -EINVAL; rc = -EINVAL;
goto exit; goto exit;
} }
...@@ -267,7 +267,7 @@ static void nfcsim_wq_recv(struct work_struct *work) ...@@ -267,7 +267,7 @@ static void nfcsim_wq_recv(struct work_struct *work)
if (dev->initiator) { if (dev->initiator) {
if (!dev->cb) { if (!dev->cb) {
DEV_ERR(dev, "Null recv callback"); DEV_ERR(dev, "Null recv callback\n");
dev_kfree_skb(dev->clone_skb); dev_kfree_skb(dev->clone_skb);
goto exit; goto exit;
} }
...@@ -310,7 +310,7 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct nfc_target *target, ...@@ -310,7 +310,7 @@ static int nfcsim_tx(struct nfc_dev *nfc_dev, struct nfc_target *target,
peer->clone_skb = skb_clone(skb, GFP_KERNEL); peer->clone_skb = skb_clone(skb, GFP_KERNEL);
if (!peer->clone_skb) { if (!peer->clone_skb) {
DEV_ERR(dev, "skb_clone failed"); DEV_ERR(dev, "skb_clone failed\n");
mutex_unlock(&peer->lock); mutex_unlock(&peer->lock);
err = -ENOMEM; err = -ENOMEM;
goto exit; goto exit;
......
...@@ -149,8 +149,8 @@ static int nfcwilink_get_bts_file_name(struct nfcwilink *drv, char *file_name) ...@@ -149,8 +149,8 @@ static int nfcwilink_get_bts_file_name(struct nfcwilink *drv, char *file_name)
skb = nfcwilink_skb_alloc(sizeof(struct nci_vs_nfcc_info_cmd), skb = nfcwilink_skb_alloc(sizeof(struct nci_vs_nfcc_info_cmd),
GFP_KERNEL); GFP_KERNEL);
if (!skb) { if (!skb) {
nfc_dev_err(&drv->pdev->dev, nfc_err(&drv->pdev->dev,
"no memory for nci_vs_nfcc_info_cmd"); "no memory for nci_vs_nfcc_info_cmd\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -180,8 +180,7 @@ static int nfcwilink_get_bts_file_name(struct nfcwilink *drv, char *file_name) ...@@ -180,8 +180,7 @@ static int nfcwilink_get_bts_file_name(struct nfcwilink *drv, char *file_name)
drv->nfcc_info.plen, drv->nfcc_info.status); drv->nfcc_info.plen, drv->nfcc_info.status);
if ((drv->nfcc_info.plen != 5) || (drv->nfcc_info.status != 0)) { if ((drv->nfcc_info.plen != 5) || (drv->nfcc_info.status != 0)) {
nfc_dev_err(&drv->pdev->dev, nfc_err(&drv->pdev->dev, "invalid nci_vs_nfcc_info_rsp\n");
"invalid nci_vs_nfcc_info_rsp");
return -EINVAL; return -EINVAL;
} }
...@@ -192,7 +191,7 @@ static int nfcwilink_get_bts_file_name(struct nfcwilink *drv, char *file_name) ...@@ -192,7 +191,7 @@ static int nfcwilink_get_bts_file_name(struct nfcwilink *drv, char *file_name)
drv->nfcc_info.sw_ver_z, drv->nfcc_info.sw_ver_z,
drv->nfcc_info.patch_id); drv->nfcc_info.patch_id);
nfc_dev_info(&drv->pdev->dev, "nfcwilink FW file name: %s", file_name); nfc_info(&drv->pdev->dev, "nfcwilink FW file name: %s\n", file_name);
return 0; return 0;
} }
...@@ -209,8 +208,8 @@ static int nfcwilink_send_bts_cmd(struct nfcwilink *drv, __u8 *data, int len) ...@@ -209,8 +208,8 @@ static int nfcwilink_send_bts_cmd(struct nfcwilink *drv, __u8 *data, int len)
(len > BTS_FILE_CMD_MAX_LEN) || (len > BTS_FILE_CMD_MAX_LEN) ||
(hdr->chnl != NFCWILINK_CHNL) || (hdr->chnl != NFCWILINK_CHNL) ||
(hdr->opcode != NFCWILINK_OPCODE)) { (hdr->opcode != NFCWILINK_OPCODE)) {
nfc_dev_err(&drv->pdev->dev, nfc_err(&drv->pdev->dev,
"ignoring invalid bts cmd, len %d, chnl %d, opcode %d", "ignoring invalid bts cmd, len %d, chnl %d, opcode %d\n",
len, hdr->chnl, hdr->opcode); len, hdr->chnl, hdr->opcode);
return 0; return 0;
} }
...@@ -221,7 +220,7 @@ static int nfcwilink_send_bts_cmd(struct nfcwilink *drv, __u8 *data, int len) ...@@ -221,7 +220,7 @@ static int nfcwilink_send_bts_cmd(struct nfcwilink *drv, __u8 *data, int len)
skb = nfcwilink_skb_alloc(len, GFP_KERNEL); skb = nfcwilink_skb_alloc(len, GFP_KERNEL);
if (!skb) { if (!skb) {
nfc_dev_err(&drv->pdev->dev, "no memory for bts cmd"); nfc_err(&drv->pdev->dev, "no memory for bts cmd\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -236,8 +235,8 @@ static int nfcwilink_send_bts_cmd(struct nfcwilink *drv, __u8 *data, int len) ...@@ -236,8 +235,8 @@ static int nfcwilink_send_bts_cmd(struct nfcwilink *drv, __u8 *data, int len)
dev_dbg(&drv->pdev->dev, "wait_for_completion_timeout returned %ld\n", dev_dbg(&drv->pdev->dev, "wait_for_completion_timeout returned %ld\n",
comp_ret); comp_ret);
if (comp_ret == 0) { if (comp_ret == 0) {
nfc_dev_err(&drv->pdev->dev, nfc_err(&drv->pdev->dev,
"timeout on wait_for_completion_timeout"); "timeout on wait_for_completion_timeout\n");
return -ETIMEDOUT; return -ETIMEDOUT;
} }
...@@ -260,7 +259,7 @@ static int nfcwilink_download_fw(struct nfcwilink *drv) ...@@ -260,7 +259,7 @@ static int nfcwilink_download_fw(struct nfcwilink *drv)
rc = request_firmware(&fw, file_name, &drv->pdev->dev); rc = request_firmware(&fw, file_name, &drv->pdev->dev);
if (rc) { if (rc) {
nfc_dev_err(&drv->pdev->dev, "request_firmware failed %d", rc); nfc_err(&drv->pdev->dev, "request_firmware failed %d\n", rc);
/* if the file is not found, don't exit with failure */ /* if the file is not found, don't exit with failure */
if (rc == -ENOENT) if (rc == -ENOENT)
...@@ -280,7 +279,7 @@ static int nfcwilink_download_fw(struct nfcwilink *drv) ...@@ -280,7 +279,7 @@ static int nfcwilink_download_fw(struct nfcwilink *drv)
if (__le32_to_cpu(((struct bts_file_hdr *)ptr)->magic) != if (__le32_to_cpu(((struct bts_file_hdr *)ptr)->magic) !=
BTS_FILE_HDR_MAGIC) { BTS_FILE_HDR_MAGIC) {
nfc_dev_err(&drv->pdev->dev, "wrong bts magic number"); nfc_err(&drv->pdev->dev, "wrong bts magic number\n");
rc = -EINVAL; rc = -EINVAL;
goto release_fw; goto release_fw;
} }
...@@ -361,7 +360,7 @@ static long nfcwilink_receive(void *priv_data, struct sk_buff *skb) ...@@ -361,7 +360,7 @@ static long nfcwilink_receive(void *priv_data, struct sk_buff *skb)
/* Forward skb to NCI core layer */ /* Forward skb to NCI core layer */
rc = nci_recv_frame(drv->ndev, skb); rc = nci_recv_frame(drv->ndev, skb);
if (rc < 0) { if (rc < 0) {
nfc_dev_err(&drv->pdev->dev, "nci_recv_frame failed %d", rc); nfc_err(&drv->pdev->dev, "nci_recv_frame failed %d\n", rc);
return rc; return rc;
} }
...@@ -414,13 +413,12 @@ static int nfcwilink_open(struct nci_dev *ndev) ...@@ -414,13 +413,12 @@ static int nfcwilink_open(struct nci_dev *ndev)
goto clear_exit; goto clear_exit;
} else if (drv->st_register_cb_status != 0) { } else if (drv->st_register_cb_status != 0) {
rc = drv->st_register_cb_status; rc = drv->st_register_cb_status;
nfc_dev_err(&drv->pdev->dev, nfc_err(&drv->pdev->dev,
"st_register_cb failed %d", rc); "st_register_cb failed %d\n", rc);
goto clear_exit; goto clear_exit;
} }
} else { } else {
nfc_dev_err(&drv->pdev->dev, nfc_err(&drv->pdev->dev, "st_register failed %d\n", rc);
"st_register failed %d", rc);
goto clear_exit; goto clear_exit;
} }
} }
...@@ -430,8 +428,8 @@ static int nfcwilink_open(struct nci_dev *ndev) ...@@ -430,8 +428,8 @@ static int nfcwilink_open(struct nci_dev *ndev)
drv->st_write = nfcwilink_proto.write; drv->st_write = nfcwilink_proto.write;
if (nfcwilink_download_fw(drv)) { if (nfcwilink_download_fw(drv)) {
nfc_dev_err(&drv->pdev->dev, "nfcwilink_download_fw failed %d", nfc_err(&drv->pdev->dev, "nfcwilink_download_fw failed %d\n",
rc); rc);
/* open should succeed, even if the FW download failed */ /* open should succeed, even if the FW download failed */
} }
...@@ -454,7 +452,7 @@ static int nfcwilink_close(struct nci_dev *ndev) ...@@ -454,7 +452,7 @@ static int nfcwilink_close(struct nci_dev *ndev)
rc = st_unregister(&nfcwilink_proto); rc = st_unregister(&nfcwilink_proto);
if (rc) if (rc)
nfc_dev_err(&drv->pdev->dev, "st_unregister failed %d", rc); nfc_err(&drv->pdev->dev, "st_unregister failed %d\n", rc);
drv->st_write = NULL; drv->st_write = NULL;
...@@ -485,7 +483,7 @@ static int nfcwilink_send(struct nci_dev *ndev, struct sk_buff *skb) ...@@ -485,7 +483,7 @@ static int nfcwilink_send(struct nci_dev *ndev, struct sk_buff *skb)
len = drv->st_write(skb); len = drv->st_write(skb);
if (len < 0) { if (len < 0) {
kfree_skb(skb); kfree_skb(skb);
nfc_dev_err(&drv->pdev->dev, "st_write failed %ld", len); nfc_err(&drv->pdev->dev, "st_write failed %ld\n", len);
return -EFAULT; return -EFAULT;
} }
...@@ -523,7 +521,7 @@ static int nfcwilink_probe(struct platform_device *pdev) ...@@ -523,7 +521,7 @@ static int nfcwilink_probe(struct platform_device *pdev)
NFCWILINK_HDR_LEN, NFCWILINK_HDR_LEN,
0); 0);
if (!drv->ndev) { if (!drv->ndev) {
nfc_dev_err(&pdev->dev, "nci_allocate_device failed"); nfc_err(&pdev->dev, "nci_allocate_device failed\n");
rc = -ENOMEM; rc = -ENOMEM;
goto exit; goto exit;
} }
...@@ -533,7 +531,7 @@ static int nfcwilink_probe(struct platform_device *pdev) ...@@ -533,7 +531,7 @@ static int nfcwilink_probe(struct platform_device *pdev)
rc = nci_register_device(drv->ndev); rc = nci_register_device(drv->ndev);
if (rc < 0) { if (rc < 0) {
nfc_dev_err(&pdev->dev, "nci_register_device failed %d", rc); nfc_err(&pdev->dev, "nci_register_device failed %d\n", rc);
goto free_dev_exit; goto free_dev_exit;
} }
......
...@@ -728,8 +728,8 @@ static void pn533_recv_response(struct urb *urb) ...@@ -728,8 +728,8 @@ static void pn533_recv_response(struct urb *urb)
goto sched_wq; goto sched_wq;
case -ESHUTDOWN: case -ESHUTDOWN:
default: default:
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Urb failure (status %d)", urb->status); "Urb failure (status %d)\n", urb->status);
goto sched_wq; goto sched_wq;
} }
...@@ -740,14 +740,14 @@ static void pn533_recv_response(struct urb *urb) ...@@ -740,14 +740,14 @@ static void pn533_recv_response(struct urb *urb)
dev->ops->rx_frame_size(in_frame), false); dev->ops->rx_frame_size(in_frame), false);
if (!dev->ops->rx_is_frame_valid(in_frame, dev)) { if (!dev->ops->rx_is_frame_valid(in_frame, dev)) {
nfc_dev_err(&dev->interface->dev, "Received an invalid frame"); nfc_err(&dev->interface->dev, "Received an invalid frame\n");
cmd->status = -EIO; cmd->status = -EIO;
goto sched_wq; goto sched_wq;
} }
if (!pn533_rx_frame_is_cmd_response(dev, in_frame)) { if (!pn533_rx_frame_is_cmd_response(dev, in_frame)) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"It it not the response to the last command"); "It it not the response to the last command\n");
cmd->status = -EIO; cmd->status = -EIO;
goto sched_wq; goto sched_wq;
} }
...@@ -783,23 +783,23 @@ static void pn533_recv_ack(struct urb *urb) ...@@ -783,23 +783,23 @@ static void pn533_recv_ack(struct urb *urb)
goto sched_wq; goto sched_wq;
case -ESHUTDOWN: case -ESHUTDOWN:
default: default:
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Urb failure (status %d)", urb->status); "Urb failure (status %d)\n", urb->status);
goto sched_wq; goto sched_wq;
} }
in_frame = dev->in_urb->transfer_buffer; in_frame = dev->in_urb->transfer_buffer;
if (!pn533_std_rx_frame_is_ack(in_frame)) { if (!pn533_std_rx_frame_is_ack(in_frame)) {
nfc_dev_err(&dev->interface->dev, "Received an invalid ack"); nfc_err(&dev->interface->dev, "Received an invalid ack\n");
cmd->status = -EIO; cmd->status = -EIO;
goto sched_wq; goto sched_wq;
} }
rc = pn533_submit_urb_for_response(dev, GFP_ATOMIC); rc = pn533_submit_urb_for_response(dev, GFP_ATOMIC);
if (rc) { if (rc) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"usb_submit_urb failed with result %d", rc); "usb_submit_urb failed with result %d\n", rc);
cmd->status = rc; cmd->status = rc;
goto sched_wq; goto sched_wq;
} }
...@@ -1172,8 +1172,8 @@ static void pn533_send_complete(struct urb *urb) ...@@ -1172,8 +1172,8 @@ static void pn533_send_complete(struct urb *urb)
break; break;
case -ESHUTDOWN: case -ESHUTDOWN:
default: default:
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev, "Urb failure (status %d)\n",
"Urb failure (status %d)", urb->status); urb->status);
} }
} }
...@@ -1473,8 +1473,8 @@ static int pn533_target_found(struct pn533 *dev, u8 tg, u8 *tgdata, ...@@ -1473,8 +1473,8 @@ static int pn533_target_found(struct pn533 *dev, u8 tg, u8 *tgdata,
rc = pn533_target_found_type_b(&nfc_tgt, tgdata, tgdata_len); rc = pn533_target_found_type_b(&nfc_tgt, tgdata, tgdata_len);
break; break;
default: default:
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Unknown current poll modulation"); "Unknown current poll modulation\n");
return -EPROTO; return -EPROTO;
} }
...@@ -1695,8 +1695,8 @@ static int pn533_init_target_complete(struct pn533 *dev, struct sk_buff *resp) ...@@ -1695,8 +1695,8 @@ static int pn533_init_target_complete(struct pn533 *dev, struct sk_buff *resp)
rc = nfc_tm_activated(dev->nfc_dev, NFC_PROTO_NFC_DEP_MASK, rc = nfc_tm_activated(dev->nfc_dev, NFC_PROTO_NFC_DEP_MASK,
comm_mode, gb, gb_len); comm_mode, gb, gb_len);
if (rc < 0) { if (rc < 0) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Error when signaling target activation"); "Error when signaling target activation\n");
return rc; return rc;
} }
...@@ -1730,8 +1730,7 @@ static int pn533_rf_complete(struct pn533 *dev, void *arg, ...@@ -1730,8 +1730,7 @@ static int pn533_rf_complete(struct pn533 *dev, void *arg,
if (IS_ERR(resp)) { if (IS_ERR(resp)) {
rc = PTR_ERR(resp); rc = PTR_ERR(resp);
nfc_dev_err(&dev->interface->dev, "%s RF setting error %d", nfc_err(&dev->interface->dev, "RF setting error %d", rc);
__func__, rc);
return rc; return rc;
} }
...@@ -1762,7 +1761,7 @@ static void pn533_wq_rf(struct work_struct *work) ...@@ -1762,7 +1761,7 @@ static void pn533_wq_rf(struct work_struct *work)
pn533_rf_complete, NULL); pn533_rf_complete, NULL);
if (rc < 0) { if (rc < 0) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
nfc_dev_err(&dev->interface->dev, "RF setting error %d", rc); nfc_err(&dev->interface->dev, "RF setting error %d\n", rc);
} }
return; return;
...@@ -1779,8 +1778,8 @@ static int pn533_poll_complete(struct pn533 *dev, void *arg, ...@@ -1779,8 +1778,8 @@ static int pn533_poll_complete(struct pn533 *dev, void *arg,
if (IS_ERR(resp)) { if (IS_ERR(resp)) {
rc = PTR_ERR(resp); rc = PTR_ERR(resp);
nfc_dev_err(&dev->interface->dev, "%s Poll complete error %d", nfc_err(&dev->interface->dev, "%s Poll complete error %d\n",
__func__, rc); __func__, rc);
if (rc == -ENOENT) { if (rc == -ENOENT) {
if (dev->poll_mod_count != 0) if (dev->poll_mod_count != 0)
...@@ -1788,8 +1787,8 @@ static int pn533_poll_complete(struct pn533 *dev, void *arg, ...@@ -1788,8 +1787,8 @@ static int pn533_poll_complete(struct pn533 *dev, void *arg,
else else
goto stop_poll; goto stop_poll;
} else if (rc < 0) { } else if (rc < 0) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Error %d when running poll", rc); "Error %d when running poll\n", rc);
goto stop_poll; goto stop_poll;
} }
} }
...@@ -1821,7 +1820,7 @@ static int pn533_poll_complete(struct pn533 *dev, void *arg, ...@@ -1821,7 +1820,7 @@ static int pn533_poll_complete(struct pn533 *dev, void *arg,
return rc; return rc;
stop_poll: stop_poll:
nfc_dev_err(&dev->interface->dev, "Polling operation has been stopped"); nfc_err(&dev->interface->dev, "Polling operation has been stopped\n");
pn533_poll_reset_mod_list(dev); pn533_poll_reset_mod_list(dev);
dev->poll_protocols = 0; dev->poll_protocols = 0;
...@@ -1863,7 +1862,7 @@ static int pn533_send_poll_frame(struct pn533 *dev) ...@@ -1863,7 +1862,7 @@ static int pn533_send_poll_frame(struct pn533 *dev)
} }
if (!skb) { if (!skb) {
nfc_dev_err(&dev->interface->dev, "Failed to allocate skb."); nfc_err(&dev->interface->dev, "Failed to allocate skb\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -1871,7 +1870,7 @@ static int pn533_send_poll_frame(struct pn533 *dev) ...@@ -1871,7 +1870,7 @@ static int pn533_send_poll_frame(struct pn533 *dev)
NULL); NULL);
if (rc < 0) { if (rc < 0) {
dev_kfree_skb(skb); dev_kfree_skb(skb);
nfc_dev_err(&dev->interface->dev, "Polling loop error %d", rc); nfc_err(&dev->interface->dev, "Polling loop error %d\n", rc);
} }
return rc; return rc;
...@@ -1915,14 +1914,14 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev, ...@@ -1915,14 +1914,14 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev,
__func__, im_protocols, tm_protocols); __func__, im_protocols, tm_protocols);
if (dev->tgt_active_prot) { if (dev->tgt_active_prot) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Cannot poll with a target already activated"); "Cannot poll with a target already activated\n");
return -EBUSY; return -EBUSY;
} }
if (dev->tgt_mode) { if (dev->tgt_mode) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Cannot poll while already being activated"); "Cannot poll while already being activated\n");
return -EBUSY; return -EBUSY;
} }
...@@ -1985,8 +1984,8 @@ static int pn533_activate_target_nfcdep(struct pn533 *dev) ...@@ -1985,8 +1984,8 @@ static int pn533_activate_target_nfcdep(struct pn533 *dev)
rsp = (struct pn533_cmd_activate_response *)resp->data; rsp = (struct pn533_cmd_activate_response *)resp->data;
rc = rsp->status & PN533_CMD_RET_MASK; rc = rsp->status & PN533_CMD_RET_MASK;
if (rc != PN533_CMD_RET_SUCCESS) { if (rc != PN533_CMD_RET_SUCCESS) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Target activation failed (error 0x%x)", rc); "Target activation failed (error 0x%x)\n", rc);
dev_kfree_skb(resp); dev_kfree_skb(resp);
return -EIO; return -EIO;
} }
...@@ -2009,35 +2008,35 @@ static int pn533_activate_target(struct nfc_dev *nfc_dev, ...@@ -2009,35 +2008,35 @@ static int pn533_activate_target(struct nfc_dev *nfc_dev,
__func__, protocol); __func__, protocol);
if (dev->poll_mod_count) { if (dev->poll_mod_count) {
dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Cannot activate while polling\n"); "Cannot activate while polling\n");
return -EBUSY; return -EBUSY;
} }
if (dev->tgt_active_prot) { if (dev->tgt_active_prot) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"There is already an active target"); "There is already an active target\n");
return -EBUSY; return -EBUSY;
} }
if (!dev->tgt_available_prots) { if (!dev->tgt_available_prots) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"There is no available target to activate"); "There is no available target to activate\n");
return -EINVAL; return -EINVAL;
} }
if (!(dev->tgt_available_prots & (1 << protocol))) { if (!(dev->tgt_available_prots & (1 << protocol))) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Target doesn't support requested proto %u", "Target doesn't support requested proto %u\n",
protocol); protocol);
return -EINVAL; return -EINVAL;
} }
if (protocol == NFC_PROTO_NFC_DEP) { if (protocol == NFC_PROTO_NFC_DEP) {
rc = pn533_activate_target_nfcdep(dev); rc = pn533_activate_target_nfcdep(dev);
if (rc) { if (rc) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Activating target with DEP failed %d", rc); "Activating target with DEP failed %d\n", rc);
return rc; return rc;
} }
} }
...@@ -2059,7 +2058,7 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev, ...@@ -2059,7 +2058,7 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev,
dev_dbg(&dev->interface->dev, "%s\n", __func__); dev_dbg(&dev->interface->dev, "%s\n", __func__);
if (!dev->tgt_active_prot) { if (!dev->tgt_active_prot) {
nfc_dev_err(&dev->interface->dev, "There is no active target"); nfc_err(&dev->interface->dev, "There is no active target\n");
return; return;
} }
...@@ -2078,8 +2077,8 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev, ...@@ -2078,8 +2077,8 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev,
rc = resp->data[0] & PN533_CMD_RET_MASK; rc = resp->data[0] & PN533_CMD_RET_MASK;
if (rc != PN533_CMD_RET_SUCCESS) if (rc != PN533_CMD_RET_SUCCESS)
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Error 0x%x when releasing the target", rc); "Error 0x%x when releasing the target\n", rc);
dev_kfree_skb(resp); dev_kfree_skb(resp);
return; return;
...@@ -2101,8 +2100,8 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, ...@@ -2101,8 +2100,8 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
if (dev->tgt_available_prots && if (dev->tgt_available_prots &&
!(dev->tgt_available_prots & (1 << NFC_PROTO_NFC_DEP))) { !(dev->tgt_available_prots & (1 << NFC_PROTO_NFC_DEP))) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"The target does not support DEP"); "The target does not support DEP\n");
rc = -EINVAL; rc = -EINVAL;
goto error; goto error;
} }
...@@ -2111,8 +2110,8 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, ...@@ -2111,8 +2110,8 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
rc = rsp->status & PN533_CMD_RET_MASK; rc = rsp->status & PN533_CMD_RET_MASK;
if (rc != PN533_CMD_RET_SUCCESS) { if (rc != PN533_CMD_RET_SUCCESS) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Bringing DEP link up failed (error 0x%x)", rc); "Bringing DEP link up failed (error 0x%x)\n", rc);
goto error; goto error;
} }
...@@ -2161,14 +2160,14 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, ...@@ -2161,14 +2160,14 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
dev_dbg(&dev->interface->dev, "%s\n", __func__); dev_dbg(&dev->interface->dev, "%s\n", __func__);
if (dev->poll_mod_count) { if (dev->poll_mod_count) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Cannot bring the DEP link up while polling"); "Cannot bring the DEP link up while polling\n");
return -EBUSY; return -EBUSY;
} }
if (dev->tgt_active_prot) { if (dev->tgt_active_prot) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"There is already an active target"); "There is already an active target\n");
return -EBUSY; return -EBUSY;
} }
...@@ -2318,8 +2317,8 @@ static int pn533_data_exchange_complete(struct pn533 *dev, void *_arg, ...@@ -2318,8 +2317,8 @@ static int pn533_data_exchange_complete(struct pn533 *dev, void *_arg,
skb_pull(resp, sizeof(status)); skb_pull(resp, sizeof(status));
if (ret != PN533_CMD_RET_SUCCESS) { if (ret != PN533_CMD_RET_SUCCESS) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Exchanging data failed (error 0x%x)", ret); "Exchanging data failed (error 0x%x)\n", ret);
rc = -EIO; rc = -EIO;
goto error; goto error;
} }
...@@ -2412,8 +2411,8 @@ static int pn533_transceive(struct nfc_dev *nfc_dev, ...@@ -2412,8 +2411,8 @@ static int pn533_transceive(struct nfc_dev *nfc_dev,
dev_dbg(&dev->interface->dev, "%s\n", __func__); dev_dbg(&dev->interface->dev, "%s\n", __func__);
if (!dev->tgt_active_prot) { if (!dev->tgt_active_prot) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Can't exchange data if there is no active target"); "Can't exchange data if there is no active target\n");
rc = -EINVAL; rc = -EINVAL;
goto error; goto error;
} }
...@@ -2506,9 +2505,9 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb) ...@@ -2506,9 +2505,9 @@ static int pn533_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb)
dev_dbg(&dev->interface->dev, "%s\n", __func__); dev_dbg(&dev->interface->dev, "%s\n", __func__);
if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) { if (skb->len > PN533_CMD_DATAEXCH_DATA_MAXLEN) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Data length greater than the max allowed: %d", "Data length greater than the max allowed: %d\n",
PN533_CMD_DATAEXCH_DATA_MAXLEN); PN533_CMD_DATAEXCH_DATA_MAXLEN);
return -ENOSYS; return -ENOSYS;
} }
...@@ -2558,8 +2557,8 @@ static void pn533_wq_mi_recv(struct work_struct *work) ...@@ -2558,8 +2557,8 @@ static void pn533_wq_mi_recv(struct work_struct *work)
if (rc == 0) /* success */ if (rc == 0) /* success */
return; return;
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Error %d when trying to perform data_exchange", rc); "Error %d when trying to perform data_exchange\n", rc);
dev_kfree_skb(skb); dev_kfree_skb(skb);
kfree(dev->cmd_complete_mi_arg); kfree(dev->cmd_complete_mi_arg);
...@@ -2613,8 +2612,8 @@ static void pn533_wq_mi_send(struct work_struct *work) ...@@ -2613,8 +2612,8 @@ static void pn533_wq_mi_send(struct work_struct *work)
if (rc == 0) /* success */ if (rc == 0) /* success */
return; return;
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Error %d when trying to perform data_exchange", rc); "Error %d when trying to perform data_exchange\n", rc);
dev_kfree_skb(skb); dev_kfree_skb(skb);
kfree(dev->cmd_complete_dep_arg); kfree(dev->cmd_complete_dep_arg);
...@@ -2742,16 +2741,15 @@ static int pn533_acr122_poweron_rdr(struct pn533 *dev) ...@@ -2742,16 +2741,15 @@ static int pn533_acr122_poweron_rdr(struct pn533 *dev)
rc = usb_submit_urb(dev->out_urb, GFP_KERNEL); rc = usb_submit_urb(dev->out_urb, GFP_KERNEL);
if (rc) { if (rc) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Reader power on cmd error %d", rc); "Reader power on cmd error %d\n", rc);
return rc; return rc;
} }
rc = usb_submit_urb(dev->in_urb, GFP_KERNEL); rc = usb_submit_urb(dev->in_urb, GFP_KERNEL);
if (rc) { if (rc) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Can't submit for reader power on cmd response %d", "Can't submit reader poweron cmd response %d\n", rc);
rc);
return rc; return rc;
} }
...@@ -2772,8 +2770,7 @@ static int pn533_rf_field(struct nfc_dev *nfc_dev, u8 rf) ...@@ -2772,8 +2770,7 @@ static int pn533_rf_field(struct nfc_dev *nfc_dev, u8 rf)
rc = pn533_set_configuration(dev, PN533_CFGITEM_RF_FIELD, rc = pn533_set_configuration(dev, PN533_CFGITEM_RF_FIELD,
(u8 *)&rf_field, 1); (u8 *)&rf_field, 1);
if (rc) { if (rc) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev, "Error on setting RF field\n");
"Error on setting RF field");
return rc; return rc;
} }
...@@ -2826,16 +2823,16 @@ static int pn533_setup(struct pn533 *dev) ...@@ -2826,16 +2823,16 @@ static int pn533_setup(struct pn533 *dev)
break; break;
default: default:
nfc_dev_err(&dev->interface->dev, "Unknown device type %d\n", nfc_err(&dev->interface->dev, "Unknown device type %d\n",
dev->device_type); dev->device_type);
return -EINVAL; return -EINVAL;
} }
rc = pn533_set_configuration(dev, PN533_CFGITEM_MAX_RETRIES, rc = pn533_set_configuration(dev, PN533_CFGITEM_MAX_RETRIES,
(u8 *)&max_retries, sizeof(max_retries)); (u8 *)&max_retries, sizeof(max_retries));
if (rc) { if (rc) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Error on setting MAX_RETRIES config"); "Error on setting MAX_RETRIES config\n");
return rc; return rc;
} }
...@@ -2843,8 +2840,7 @@ static int pn533_setup(struct pn533 *dev) ...@@ -2843,8 +2840,7 @@ static int pn533_setup(struct pn533 *dev)
rc = pn533_set_configuration(dev, PN533_CFGITEM_TIMING, rc = pn533_set_configuration(dev, PN533_CFGITEM_TIMING,
(u8 *)&timing, sizeof(timing)); (u8 *)&timing, sizeof(timing));
if (rc) { if (rc) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev, "Error on setting RF timings\n");
"Error on setting RF timings");
return rc; return rc;
} }
...@@ -2858,8 +2854,8 @@ static int pn533_setup(struct pn533 *dev) ...@@ -2858,8 +2854,8 @@ static int pn533_setup(struct pn533 *dev)
rc = pn533_set_configuration(dev, PN533_CFGITEM_PASORI, rc = pn533_set_configuration(dev, PN533_CFGITEM_PASORI,
pasori_cfg, 3); pasori_cfg, 3);
if (rc) { if (rc) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Error while settings PASORI config"); "Error while settings PASORI config\n");
return rc; return rc;
} }
...@@ -2904,8 +2900,8 @@ static int pn533_probe(struct usb_interface *interface, ...@@ -2904,8 +2900,8 @@ static int pn533_probe(struct usb_interface *interface,
} }
if (!in_endpoint || !out_endpoint) { if (!in_endpoint || !out_endpoint) {
nfc_dev_err(&interface->dev, nfc_err(&interface->dev,
"Could not find bulk-in or bulk-out endpoint"); "Could not find bulk-in or bulk-out endpoint\n");
rc = -ENODEV; rc = -ENODEV;
goto error; goto error;
} }
...@@ -2965,16 +2961,15 @@ static int pn533_probe(struct usb_interface *interface, ...@@ -2965,16 +2961,15 @@ static int pn533_probe(struct usb_interface *interface,
rc = pn533_acr122_poweron_rdr(dev); rc = pn533_acr122_poweron_rdr(dev);
if (rc < 0) { if (rc < 0) {
nfc_dev_err(&dev->interface->dev, nfc_err(&dev->interface->dev,
"Couldn't poweron the reader (error %d)", "Couldn't poweron the reader (error %d)\n", rc);
rc);
goto destroy_wq; goto destroy_wq;
} }
break; break;
default: default:
nfc_dev_err(&dev->interface->dev, "Unknown device type %d\n", nfc_err(&dev->interface->dev, "Unknown device type %d\n",
dev->device_type); dev->device_type);
rc = -EINVAL; rc = -EINVAL;
goto destroy_wq; goto destroy_wq;
} }
...@@ -2984,9 +2979,9 @@ static int pn533_probe(struct usb_interface *interface, ...@@ -2984,9 +2979,9 @@ static int pn533_probe(struct usb_interface *interface,
if (rc < 0) if (rc < 0)
goto destroy_wq; goto destroy_wq;
nfc_dev_info(&dev->interface->dev, nfc_info(&dev->interface->dev,
"NXP PN5%02X firmware ver %d.%d now attached", "NXP PN5%02X firmware ver %d.%d now attached\n",
fw_ver.ic, fw_ver.ver, fw_ver.rev); fw_ver.ic, fw_ver.ver, fw_ver.rev);
dev->nfc_dev = nfc_allocate_device(&pn533_nfc_ops, protocols, dev->nfc_dev = nfc_allocate_device(&pn533_nfc_ops, protocols,
...@@ -3057,7 +3052,7 @@ static void pn533_disconnect(struct usb_interface *interface) ...@@ -3057,7 +3052,7 @@ static void pn533_disconnect(struct usb_interface *interface)
usb_free_urb(dev->out_urb); usb_free_urb(dev->out_urb);
kfree(dev); kfree(dev);
nfc_dev_info(&interface->dev, "NXP PN533 NFC device disconnected"); nfc_info(&interface->dev, "NXP PN533 NFC device disconnected\n");
} }
static struct usb_driver pn533_driver = { static struct usb_driver pn533_driver = {
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#define nfc_dev_info(dev, fmt, arg...) dev_info((dev), "NFC: " fmt "\n", ## arg) #define nfc_info(dev, fmt, ...) dev_info((dev), "NFC: " fmt, ##__VA_ARGS__)
#define nfc_dev_err(dev, fmt, arg...) dev_err((dev), "NFC: " fmt "\n", ## arg) #define nfc_err(dev, fmt, ...) dev_err((dev), "NFC: " fmt, ##__VA_ARGS__)
struct nfc_dev; struct nfc_dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册