Skip to content

Commit

Permalink
nfc: Convert nfc_dbg to pr_debug
Browse files Browse the repository at this point in the history
Using the standard debugging mechanisms is better than
subsystem specific ones when the subsystem doesn't use
a specific struct.

Coalesce long formats.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Joe Perches authored and John W. Linville committed Nov 30, 2011
1 parent ed1e0ad commit 20c239c
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 158 deletions.
37 changes: 19 additions & 18 deletions net/nfc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int nfc_dev_up(struct nfc_dev *dev)
{
int rc = 0;

nfc_dbg("dev_name=%s", dev_name(&dev->dev));
pr_debug("dev_name=%s\n", dev_name(&dev->dev));

device_lock(&dev->dev);

Expand Down Expand Up @@ -99,7 +99,7 @@ int nfc_dev_down(struct nfc_dev *dev)
{
int rc = 0;

nfc_dbg("dev_name=%s", dev_name(&dev->dev));
pr_debug("dev_name=%s\n", dev_name(&dev->dev));

device_lock(&dev->dev);

Expand Down Expand Up @@ -141,7 +141,8 @@ int nfc_start_poll(struct nfc_dev *dev, u32 protocols)
{
int rc;

nfc_dbg("dev_name=%s protocols=0x%x", dev_name(&dev->dev), protocols);
pr_debug("dev_name=%s protocols=0x%x\n",
dev_name(&dev->dev), protocols);

if (!protocols)
return -EINVAL;
Expand Down Expand Up @@ -176,7 +177,7 @@ int nfc_stop_poll(struct nfc_dev *dev)
{
int rc = 0;

nfc_dbg("dev_name=%s", dev_name(&dev->dev));
pr_debug("dev_name=%s\n", dev_name(&dev->dev));

device_lock(&dev->dev);

Expand Down Expand Up @@ -209,8 +210,8 @@ int nfc_activate_target(struct nfc_dev *dev, u32 target_idx, u32 protocol)
{
int rc;

nfc_dbg("dev_name=%s target_idx=%u protocol=%u", dev_name(&dev->dev),
target_idx, protocol);
pr_debug("dev_name=%s target_idx=%u protocol=%u\n",
dev_name(&dev->dev), target_idx, protocol);

device_lock(&dev->dev);

Expand Down Expand Up @@ -238,7 +239,8 @@ int nfc_deactivate_target(struct nfc_dev *dev, u32 target_idx)
{
int rc = 0;

nfc_dbg("dev_name=%s target_idx=%u", dev_name(&dev->dev), target_idx);
pr_debug("dev_name=%s target_idx=%u\n",
dev_name(&dev->dev), target_idx);

device_lock(&dev->dev);

Expand Down Expand Up @@ -273,8 +275,8 @@ int nfc_data_exchange(struct nfc_dev *dev, u32 target_idx,
{
int rc;

nfc_dbg("dev_name=%s target_idx=%u skb->len=%u", dev_name(&dev->dev),
target_idx, skb->len);
pr_debug("dev_name=%s target_idx=%u skb->len=%u\n",
dev_name(&dev->dev), target_idx, skb->len);

device_lock(&dev->dev);

Expand Down Expand Up @@ -328,7 +330,7 @@ int nfc_targets_found(struct nfc_dev *dev, struct nfc_target *targets,
{
int i;

nfc_dbg("dev_name=%s n_targets=%d", dev_name(&dev->dev), n_targets);
pr_debug("dev_name=%s n_targets=%d\n", dev_name(&dev->dev), n_targets);

dev->polling = false;

Expand Down Expand Up @@ -362,7 +364,7 @@ static void nfc_release(struct device *d)
{
struct nfc_dev *dev = to_nfc_dev(d);

nfc_dbg("dev_name=%s", dev_name(&dev->dev));
pr_debug("dev_name=%s\n", dev_name(&dev->dev));

nfc_genl_data_exit(&dev->genl_data);
kfree(dev->targets);
Expand Down Expand Up @@ -448,7 +450,7 @@ int nfc_register_device(struct nfc_dev *dev)
{
int rc;

nfc_dbg("dev_name=%s", dev_name(&dev->dev));
pr_debug("dev_name=%s\n", dev_name(&dev->dev));

mutex_lock(&nfc_devlist_mutex);
nfc_devlist_generation++;
Expand All @@ -460,9 +462,8 @@ int nfc_register_device(struct nfc_dev *dev)

rc = nfc_genl_device_added(dev);
if (rc)
nfc_dbg("The userspace won't be notified that the device %s was"
" added", dev_name(&dev->dev));

pr_debug("The userspace won't be notified that the device %s was added\n",
dev_name(&dev->dev));

return 0;
}
Expand All @@ -477,7 +478,7 @@ void nfc_unregister_device(struct nfc_dev *dev)
{
int rc;

nfc_dbg("dev_name=%s", dev_name(&dev->dev));
pr_debug("dev_name=%s\n", dev_name(&dev->dev));

mutex_lock(&nfc_devlist_mutex);
nfc_devlist_generation++;
Expand All @@ -492,8 +493,8 @@ void nfc_unregister_device(struct nfc_dev *dev)

rc = nfc_genl_device_removed(dev);
if (rc)
nfc_dbg("The userspace won't be notified that the device %s"
" was removed", dev_name(&dev->dev));
pr_debug("The userspace won't be notified that the device %s was removed\n",
dev_name(&dev->dev));

}
EXPORT_SYMBOL(nfc_unregister_device);
Expand Down
56 changes: 28 additions & 28 deletions net/nfc/nci/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static int __nci_request(struct nci_dev *ndev,
&ndev->req_completion,
timeout);

nfc_dbg("wait_for_completion return %ld", completion_rc);
pr_debug("wait_for_completion return %ld\n", completion_rc);

if (completion_rc > 0) {
switch (ndev->req_status) {
Expand Down Expand Up @@ -325,7 +325,7 @@ static void nci_cmd_timer(unsigned long arg)
{
struct nci_dev *ndev = (void *) arg;

nfc_dbg("entry");
pr_debug("entry\n");

atomic_set(&ndev->cmd_cnt, 1);
queue_work(ndev->cmd_wq, &ndev->cmd_work);
Expand All @@ -335,7 +335,7 @@ static int nci_dev_up(struct nfc_dev *nfc_dev)
{
struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);

nfc_dbg("entry");
pr_debug("entry\n");

return nci_open_device(ndev);
}
Expand All @@ -344,7 +344,7 @@ static int nci_dev_down(struct nfc_dev *nfc_dev)
{
struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);

nfc_dbg("entry");
pr_debug("entry\n");

return nci_close_device(ndev);
}
Expand All @@ -354,7 +354,7 @@ static int nci_start_poll(struct nfc_dev *nfc_dev, __u32 protocols)
struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
int rc;

nfc_dbg("entry");
pr_debug("entry\n");

if (test_bit(NCI_DISCOVERY, &ndev->flags)) {
pr_err("unable to start poll, since poll is already active\n");
Expand All @@ -367,7 +367,7 @@ static int nci_start_poll(struct nfc_dev *nfc_dev, __u32 protocols)
}

if (test_bit(NCI_POLL_ACTIVE, &ndev->flags)) {
nfc_dbg("target is active, implicitly deactivate...");
pr_debug("target is active, implicitly deactivate...\n");

rc = nci_request(ndev, nci_rf_deactivate_req, 0,
msecs_to_jiffies(NCI_RF_DEACTIVATE_TIMEOUT));
Expand All @@ -388,7 +388,7 @@ static void nci_stop_poll(struct nfc_dev *nfc_dev)
{
struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);

nfc_dbg("entry");
pr_debug("entry\n");

if (!test_bit(NCI_DISCOVERY, &ndev->flags)) {
pr_err("unable to stop poll, since poll is not active\n");
Expand All @@ -404,7 +404,7 @@ static int nci_activate_target(struct nfc_dev *nfc_dev, __u32 target_idx,
{
struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);

nfc_dbg("entry, target_idx %d, protocol 0x%x", target_idx, protocol);
pr_debug("entry, target_idx %d, protocol 0x%x\n", target_idx, protocol);

if (!test_bit(NCI_POLL_ACTIVE, &ndev->flags)) {
pr_err("there is no available target to activate\n");
Expand Down Expand Up @@ -432,7 +432,7 @@ static void nci_deactivate_target(struct nfc_dev *nfc_dev, __u32 target_idx)
{
struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);

nfc_dbg("entry, target_idx %d", target_idx);
pr_debug("entry, target_idx %d\n", target_idx);

if (!ndev->target_active_prot) {
pr_err("unable to deactivate target, no active target\n");
Expand All @@ -455,7 +455,7 @@ static int nci_data_exchange(struct nfc_dev *nfc_dev, __u32 target_idx,
struct nci_dev *ndev = nfc_get_drvdata(nfc_dev);
int rc;

nfc_dbg("entry, target_idx %d, len %d", target_idx, skb->len);
pr_debug("entry, target_idx %d, len %d\n", target_idx, skb->len);

if (!ndev->target_active_prot) {
pr_err("unable to exchange data, no active target\n");
Expand Down Expand Up @@ -501,7 +501,7 @@ struct nci_dev *nci_allocate_device(struct nci_ops *ops,
{
struct nci_dev *ndev;

nfc_dbg("entry, supported_protocols 0x%x", supported_protocols);
pr_debug("entry, supported_protocols 0x%x\n", supported_protocols);

if (!ops->open || !ops->close || !ops->send)
return NULL;
Expand Down Expand Up @@ -541,7 +541,7 @@ EXPORT_SYMBOL(nci_allocate_device);
*/
void nci_free_device(struct nci_dev *ndev)
{
nfc_dbg("entry");
pr_debug("entry\n");

nfc_free_device(ndev->nfc_dev);
kfree(ndev);
Expand All @@ -559,7 +559,7 @@ int nci_register_device(struct nci_dev *ndev)
struct device *dev = &ndev->nfc_dev->dev;
char name[32];

nfc_dbg("entry");
pr_debug("entry\n");

rc = nfc_register_device(ndev->nfc_dev);
if (rc)
Expand Down Expand Up @@ -623,7 +623,7 @@ EXPORT_SYMBOL(nci_register_device);
*/
void nci_unregister_device(struct nci_dev *ndev)
{
nfc_dbg("entry");
pr_debug("entry\n");

nci_close_device(ndev);

Expand All @@ -644,7 +644,7 @@ int nci_recv_frame(struct sk_buff *skb)
{
struct nci_dev *ndev = (struct nci_dev *) skb->dev;

nfc_dbg("entry, len %d", skb->len);
pr_debug("entry, len %d\n", skb->len);

if (!ndev || (!test_bit(NCI_UP, &ndev->flags)
&& !test_bit(NCI_INIT, &ndev->flags))) {
Expand All @@ -664,7 +664,7 @@ static int nci_send_frame(struct sk_buff *skb)
{
struct nci_dev *ndev = (struct nci_dev *) skb->dev;

nfc_dbg("entry, len %d", skb->len);
pr_debug("entry, len %d\n", skb->len);

if (!ndev) {
kfree_skb(skb);
Expand All @@ -683,7 +683,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload)
struct nci_ctrl_hdr *hdr;
struct sk_buff *skb;

nfc_dbg("entry, opcode 0x%x, plen %d", opcode, plen);
pr_debug("entry, opcode 0x%x, plen %d\n", opcode, plen);

skb = nci_skb_alloc(ndev, (NCI_CTRL_HDR_SIZE + plen), GFP_KERNEL);
if (!skb) {
Expand Down Expand Up @@ -717,7 +717,7 @@ static void nci_tx_work(struct work_struct *work)
struct nci_dev *ndev = container_of(work, struct nci_dev, tx_work);
struct sk_buff *skb;

nfc_dbg("entry, credits_cnt %d", atomic_read(&ndev->credits_cnt));
pr_debug("entry, credits_cnt %d\n", atomic_read(&ndev->credits_cnt));

/* Send queued tx data */
while (atomic_read(&ndev->credits_cnt)) {
Expand All @@ -730,10 +730,10 @@ static void nci_tx_work(struct work_struct *work)
NCI_DATA_FLOW_CONTROL_NOT_USED)
atomic_dec(&ndev->credits_cnt);

nfc_dbg("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d",
nci_pbf(skb->data),
nci_conn_id(skb->data),
nci_plen(skb->data));
pr_debug("NCI TX: MT=data, PBF=%d, conn_id=%d, plen=%d\n",
nci_pbf(skb->data),
nci_conn_id(skb->data),
nci_plen(skb->data));

nci_send_frame(skb);
}
Expand Down Expand Up @@ -776,7 +776,7 @@ static void nci_cmd_work(struct work_struct *work)
struct nci_dev *ndev = container_of(work, struct nci_dev, cmd_work);
struct sk_buff *skb;

nfc_dbg("entry, cmd_cnt %d", atomic_read(&ndev->cmd_cnt));
pr_debug("entry, cmd_cnt %d\n", atomic_read(&ndev->cmd_cnt));

/* Send queued command */
if (atomic_read(&ndev->cmd_cnt)) {
Expand All @@ -786,11 +786,11 @@ static void nci_cmd_work(struct work_struct *work)

atomic_dec(&ndev->cmd_cnt);

nfc_dbg("NCI TX: MT=cmd, PBF=%d, GID=0x%x, OID=0x%x, plen=%d",
nci_pbf(skb->data),
nci_opcode_gid(nci_opcode(skb->data)),
nci_opcode_oid(nci_opcode(skb->data)),
nci_plen(skb->data));
pr_debug("NCI TX: MT=cmd, PBF=%d, GID=0x%x, OID=0x%x, plen=%d\n",
nci_pbf(skb->data),
nci_opcode_gid(nci_opcode(skb->data)),
nci_opcode_oid(nci_opcode(skb->data)),
nci_plen(skb->data));

nci_send_frame(skb);

Expand Down
22 changes: 11 additions & 11 deletions net/nfc/nci/data.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void nci_data_exchange_complete(struct nci_dev *ndev,
data_exchange_cb_t cb = ndev->data_exchange_cb;
void *cb_context = ndev->data_exchange_cb_context;

nfc_dbg("entry, len %d, err %d", ((skb) ? (skb->len) : (0)), err);
pr_debug("entry, len %d, err %d\n", skb ? skb->len : 0, err);

if (cb) {
ndev->data_exchange_cb = NULL;
Expand Down Expand Up @@ -92,7 +92,7 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
int frag_len;
int rc = 0;

nfc_dbg("entry, conn_id 0x%x, total_len %d", conn_id, total_len);
pr_debug("entry, conn_id 0x%x, total_len %d\n", conn_id, total_len);

__skb_queue_head_init(&frags_q);

Expand Down Expand Up @@ -121,8 +121,8 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,
data += frag_len;
total_len -= frag_len;

nfc_dbg("frag_len %d, remaining total_len %d",
frag_len, total_len);
pr_debug("frag_len %d, remaining total_len %d\n",
frag_len, total_len);
}

/* queue all fragments atomically */
Expand Down Expand Up @@ -151,7 +151,7 @@ int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb)
{
int rc = 0;

nfc_dbg("entry, conn_id 0x%x, plen %d", conn_id, skb->len);
pr_debug("entry, conn_id 0x%x, plen %d\n", conn_id, skb->len);

/* check if the packet need to be fragmented */
if (skb->len <= ndev->max_data_pkt_payload_size) {
Expand Down Expand Up @@ -230,19 +230,19 @@ void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb)
{
__u8 pbf = nci_pbf(skb->data);

nfc_dbg("entry, len %d", skb->len);
pr_debug("entry, len %d\n", skb->len);

nfc_dbg("NCI RX: MT=data, PBF=%d, conn_id=%d, plen=%d",
nci_pbf(skb->data),
nci_conn_id(skb->data),
nci_plen(skb->data));
pr_debug("NCI RX: MT=data, PBF=%d, conn_id=%d, plen=%d\n",
nci_pbf(skb->data),
nci_conn_id(skb->data),
nci_plen(skb->data));

/* strip the nci data header */
skb_pull(skb, NCI_DATA_HDR_SIZE);

if (ndev->target_active_prot == NFC_PROTO_MIFARE) {
/* frame I/F => remove the status byte */
nfc_dbg("NFC_PROTO_MIFARE => remove the status byte");
pr_debug("NFC_PROTO_MIFARE => remove the status byte\n");
skb_trim(skb, (skb->len - 1));
}

Expand Down
Loading

0 comments on commit 20c239c

Please sign in to comment.