nfc: Logging updates
Subsystems (3)
cover nfc: Logging updates
Use the standard logging styles
Joe Perches (4):
nfc: Use standard logging styles
nfc: Convert nfc_dbg to pr_debug
nfc: Remove unused nfc_printk and nfc_<level> macros
nfc: Remove function tracer like entry messages
net/nfc/core.c | 60 +++++++++++++----------------------- net/nfc/nci/core.c | 84 +++++++++++++++++++++------------------------------ net/nfc/nci/data.c | 30 ++++++++++-------- net/nfc/nci/ntf.c | 83 ++++++++++++++++++++++++++------------------------- net/nfc/nci/rsp.c | 84 ++++++++++++++++++++++++++------------------------- net/nfc/netlink.c | 32 ++------------------ net/nfc/nfc.h | 7 ---- net/nfc/rawsock.c | 28 +++++++++-------- 8 files changed, 176 insertions(+), 232 deletions(-)
Signature · 1 line
1.7.6.405.gc1be0
PATCH 1/4 nfc: Use standard logging styles
Using the normal logging styles is preferred over subsystem specific styles when the subsystem does not take a specific struct.
Convert nfc_<level> specific messages to pr_<level> Add newlines to uses.
--- net/nfc/core.c | 4 +++- net/nfc/nci/core.c | 28 +++++++++++++++------------- net/nfc/nci/data.c | 8 +++++--- net/nfc/nci/ntf.c | 16 +++++++++------- net/nfc/nci/rsp.c | 4 +++- net/nfc/rawsock.c | 4 +++- 6 files changed, 38 insertions(+), 26 deletions(-)
net/nfc/core.c +3 -1
@@ -21,6 +21,8 @@* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/init.h> #include <linux/kernel.h> #include <linux/module.h>
@@ -500,7 +502,7 @@ static int __init nfc_init(void) {int rc; -nfc_info ("NFC Core ver %s" ,VERSION ); +pr_info ("NFC Core ver %s\n" ,VERSION ); rc =class_register (&nfc_class);if (rc)
net/nfc/nci/core.c +15 -13
@@ -25,6 +25,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/types.h> #include <linux/workqueue.h> #include <linux/completion.h>
@@ -96,8 +98,8 @@ static int __nci_request(struct nci_dev *ndev,break ; } }else { -nfc_err ("wait_for_completion_interruptible_timeout failed %ld" , - completion_rc); +pr_err ("wait_for_completion_interruptible_timeout failed %ld\n" , + completion_rc); rc = ((completion_rc ==0 ) ? (-ETIMEDOUT ) : (completion_rc)); }
@@ -355,12 +357,12 @@ static int nci_start_poll(struct nfc_dev *nfc_dev, __u32 protocols)nfc_dbg ("entry" );if (test_bit (NCI_DISCOVERY , &ndev->flags)) { -nfc_err ("unable to start poll, since poll is already active" ); +pr_err ("unable to start poll, since poll is already active\n" );return -EBUSY ; }if (ndev->target_active_prot) { -nfc_err ("there is an active target" ); +pr_err ("there is an active target\n" );return -EBUSY ; }
@@ -389,7 +391,7 @@ static void nci_stop_poll(struct nfc_dev *nfc_dev)nfc_dbg ("entry" );if (!test_bit (NCI_DISCOVERY , &ndev->flags)) { -nfc_err ("unable to stop poll, since poll is not active" ); +pr_err ("unable to stop poll, since poll is not active\n" );return ; }
@@ -405,18 +407,18 @@ static int nci_activate_target(struct nfc_dev *nfc_dev, __u32 target_idx,nfc_dbg ("entry, target_idx %d, protocol 0x%x" , target_idx, protocol);if (!test_bit (NCI_POLL_ACTIVE , &ndev->flags)) { -nfc_err ("there is no available target to activate" ); +pr_err ("there is no available target to activate\n" );return -EINVAL ; }if (ndev->target_active_prot) { -nfc_err ("there is already an active target" ); +pr_err ("there is already an active target\n" );return -EBUSY ; }if (!(ndev->target_available_prots & (1 << protocol))) { -nfc_err ("target does not support the requested protocol 0x%x" , - protocol); +pr_err ("target does not support the requested protocol 0x%x\n" , + protocol);return -EINVAL ; }
@@ -433,7 +435,7 @@ static void nci_deactivate_target(struct nfc_dev *nfc_dev, __u32 target_idx)nfc_dbg ("entry, target_idx %d" , target_idx);if (!ndev->target_active_prot) { -nfc_err ("unable to deactivate target, no active target" ); +pr_err ("unable to deactivate target, no active target\n" );return ; }
@@ -456,7 +458,7 @@ static int nci_data_exchange(struct nfc_dev *nfc_dev, __u32 target_idx,nfc_dbg ("entry, target_idx %d, len %d" , target_idx, skb->len);if (!ndev->target_active_prot) { -nfc_err ("unable to exchange data, no active target" ); +pr_err ("unable to exchange data, no active target\n" );return -EINVAL ; }
@@ -685,7 +687,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload) skb =nci_skb_alloc (ndev, (NCI_CTRL_HDR_SIZE + plen),GFP_KERNEL );if (!skb) { -nfc_err ("no memory for command" ); +pr_err ("no memory for command\n" );return -ENOMEM ; }
@@ -760,7 +762,7 @@ static void nci_rx_work(struct work_struct *work)break ;default : -nfc_err ("unknown MT 0x%x" ,nci_mt (skb->data)); +pr_err ("unknown MT 0x%x\n" ,nci_mt (skb->data));kfree_skb (skb);break ; }
net/nfc/nci/data.c +5 -3
@@ -21,6 +21,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/types.h> #include <linux/interrupt.h> #include <linux/wait.h>
@@ -49,7 +51,7 @@ void nci_data_exchange_complete(struct nci_dev *ndev,/* forward skb to nfc core */ cb (cb_context, skb, err); }else if (skb) { -nfc_err ("no rx callback, dropping rx data..." ); +pr_err ("no rx callback, dropping rx data...\n" );/* no waiting callback, free skb */ kfree_skb (skb);
@@ -161,7 +163,7 @@ int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb)/* fragment packet and queue the fragments */ rc =nci_queue_tx_data_frags (ndev, conn_id, skb);if (rc) { -nfc_err ("failed to fragment tx data packet" ); +pr_err ("failed to fragment tx data packet\n" ); goto free_exit; } }
@@ -191,7 +193,7 @@ static void nci_add_rx_data_frag(struct nci_dev *ndev,/* first, make enough room for the already accumulated data */ if (skb_cow_head (skb, reassembly_len)) { -nfc_err ("error adding room for accumulated rx data" ); +pr_err ("error adding room for accumulated rx data\n" );kfree_skb (skb); skb =0 ;
net/nfc/nci/ntf.c +9 -7
@@ -25,6 +25,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/types.h> #include <linux/interrupt.h> #include <linux/bitops.h>
@@ -114,8 +116,8 @@ static int nci_extract_activation_params_iso_dep(struct nci_dev *ndev,break ;default : -nfc_err ("unsupported activation_rf_tech_and_mode 0x%x" , - ntf->activation_rf_tech_and_mode); +pr_err ("unsupported activation_rf_tech_and_mode 0x%x\n" , + ntf->activation_rf_tech_and_mode);return -EPROTO ; }
@@ -182,8 +184,8 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,break ;default : -nfc_err ("unsupported activation_rf_tech_and_mode 0x%x" , - ntf.activation_rf_tech_and_mode); +pr_err ("unsupported activation_rf_tech_and_mode 0x%x\n" , + ntf.activation_rf_tech_and_mode);return ; } }
@@ -214,8 +216,8 @@ static void nci_rf_intf_activated_ntf_packet(struct nci_dev *ndev,break ;default : -nfc_err ("unsupported rf_interface_type 0x%x" , - ntf.rf_interface_type); +pr_err ("unsupported rf_interface_type 0x%x\n" , + ntf.rf_interface_type);return ; } }
@@ -278,7 +280,7 @@ void nci_ntf_packet(struct nci_dev *ndev, struct sk_buff *skb)break ;default : -nfc_err ("unknown ntf opcode 0x%x" , ntf_opcode); +pr_err ("unknown ntf opcode 0x%x\n" , ntf_opcode);break ; }
net/nfc/nci/rsp.c +3 -1
@@ -25,6 +25,8 @@* */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/types.h> #include <linux/interrupt.h> #include <linux/bitops.h>
@@ -200,7 +202,7 @@ void nci_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)break ;default : -nfc_err ("unknown rsp opcode 0x%x" , rsp_opcode); +pr_err ("unknown rsp opcode 0x%x\n" , rsp_opcode);break ; }
net/nfc/rawsock.c +3 -1
@@ -21,6 +21,8 @@* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <net/tcp_states.h> #include <linux/nfc.h> #include <linux/export.h>
@@ -294,7 +296,7 @@ static void rawsock_destruct(struct sock *sk)skb_queue_purge (&sk->sk_receive_queue);if (!sock_flag (sk,SOCK_DEAD )) { -nfc_err ("Freeing alive NFC raw socket %p" , sk); +pr_err ("Freeing alive NFC raw socket %p\n" , sk);return ; } }
Signature · 1 line
1.7.6.405.gc1be0
Re: [PATCH 1/4] nfc: Use standard logging styles
Hi Joe,
Quoted 7 lines · Joe Perches
Using the normal logging styles is preferred over subsystem specific styles when the subsystem does not take a specific struct.
Convert nfc_<level> specific messages to pr_<level> Add newlines to uses.
I would be fine with moving to pr_debug, but I'd like the pr_fmt() routine to include the function name as well.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH 1/4] nfc: Use standard logging styles
Quoted 1 line · Samuel Ortiz
Hi Joe,
Hello Samuel.
Quoted 8 lines · Joe Perches
Quoted 5 lines
Using the normal logging styles is preferred over subsystem specific styles when the subsystem does not take a specific struct.
Convert nfc_<level> specific messages to pr_<level> Add newlines to uses.I would be fine with moving to
pr_debug, but I'd like thepr_fmt()routine to include the function name as well.
If you really want it I can add it back but
if you are not aware, dynamic debug can add this by using:
echo "module nfc +fp" > <debugfs>/dynamic_debug/control echo "module nci +fp" > <debugfs>/dynamic_debug/control
If you're getting dmesg logs from customers that's a bit harder to track though.
Re: [PATCH 1/4] nfc: Use standard logging styles
Hi Joe,
Quoted 9 lines · Joe Perches
Quoted 2 lines
I would be fine with moving to
pr_debug, but I'd like thepr_fmt()routine to include the function name as well.If you really want it I can add it back but
if you are not aware, dynamic debug can add this by using:echo "module nfc +fp" > <debugfs>/dynamic_debug/control echo "module nci +fp" > <debugfs>/dynamic_debug/control
Yes, I'm aware of that.
Quoted 2 lines
If you're getting dmesg logs from customers that's a bit harder to track though.
Exactly. I'd prefer to have the __func__ being part of the pr_fmt().
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
PATCH 2/4 nfc: Convert nfc_dbg to pr_debug
In reply to Joe PerchesUsing the standard debugging mechanisms is better than subsystem specific ones when the subsystem doesn't use a specific struct.
Coalesce long formats.
--- net/nfc/core.c | 37 ++++++++++++----------- net/nfc/nci/core.c | 56 ++++++++++++++++++------------------ net/nfc/nci/data.c | 22 +++++++------- net/nfc/nci/ntf.c | 67 +++++++++++++++++++++---------------------- net/nfc/nci/rsp.c | 80 ++++++++++++++++++++++++++-------------------------- net/nfc/netlink.c | 32 +++++++++++---------- net/nfc/rawsock.c | 24 ++++++++-------- 7 files changed, 160 insertions(+), 158 deletions(-)
net/nfc/core.c +19 -18
@@ -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);
@@ -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);
@@ -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 ;
@@ -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);
@@ -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);
@@ -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);
@@ -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);
@@ -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;
@@ -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);
@@ -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++;
@@ -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 ; }
@@ -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++;
@@ -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);
net/nfc/nci/core.c +28 -28
182 lines not on this page · raw message
net/nfc/nci/data.c +11 -11
@@ -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 ;
@@ -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);
@@ -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 */
@@ -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) {
@@ -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 )); }
net/nfc/nci/ntf.c +33 -34
124 lines not on this page · raw message
net/nfc/nci/rsp.c +40 -40
125 lines not on this page · raw message
net/nfc/netlink.c +17 -15
@@ -21,6 +21,8 @@* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <net/genetlink.h> #include <linux/nfc.h> #include <linux/slab.h>
@@ -51,7 +53,7 @@ static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target, {void *hdr; -nfc_dbg ("entry" ); +pr_debug ("entry\n" ); hdr =genlmsg_put (msg,NETLINK_CB (cb->skb).pid, cb->nlh->nlmsg_seq, &nfc_genl_family, flags,NFC_CMD_GET_TARGET );
@@ -105,7 +107,7 @@ static int nfc_genl_dump_targets(struct sk_buff *skb,struct nfc_dev *dev = (struct nfc_dev *) cb->args[1 ];int rc; -nfc_dbg ("entry" ); +pr_debug ("entry\n" );if (!dev) { dev =__get_device_from_cb (cb);
@@ -139,7 +141,7 @@ static int nfc_genl_dump_targets_done(struct netlink_callback *cb) {struct nfc_dev *dev = (struct nfc_dev *) cb->args[1 ]; -nfc_dbg ("entry" ); +pr_debug ("entry\n" );if (dev)nfc_put_device (dev);
@@ -152,7 +154,7 @@ int nfc_genl_targets_found(struct nfc_dev *dev)struct sk_buff *msg;void *hdr; -nfc_dbg ("entry" ); +pr_debug ("entry\n" ); dev->genl_data.poll_req_pid =0 ;
@@ -183,7 +185,7 @@ int nfc_genl_device_added(struct nfc_dev *dev)struct sk_buff *msg;void *hdr; -nfc_dbg ("entry" ); +pr_debug ("entry\n" ); msg =nlmsg_new (NLMSG_GOODSIZE ,GFP_KERNEL );if (!msg)
@@ -216,7 +218,7 @@ int nfc_genl_device_removed(struct nfc_dev *dev)struct sk_buff *msg;void *hdr; -nfc_dbg ("entry" ); +pr_debug ("entry\n" ); msg =nlmsg_new (NLMSG_GOODSIZE ,GFP_KERNEL );if (!msg)
@@ -249,7 +251,7 @@ static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, {void *hdr; -nfc_dbg ("entry" ); +pr_debug ("entry\n" ); hdr =genlmsg_put (msg, pid, seq, &nfc_genl_family, flags,NFC_CMD_GET_DEVICE );
@@ -277,7 +279,7 @@ static int nfc_genl_dump_devices(struct sk_buff *skb,struct nfc_dev *dev = (struct nfc_dev *) cb->args[1 ];bool first_call = false; -nfc_dbg ("entry" ); +pr_debug ("entry\n" );if (!iter) { first_call = true;
@@ -319,7 +321,7 @@ static int nfc_genl_dump_devices_done(struct netlink_callback *cb) {struct class_dev_iter *iter = (struct class_dev_iter *) cb->args[0 ]; -nfc_dbg ("entry" ); +pr_debug ("entry\n" );nfc_device_iter_exit (iter);kfree (iter);
@@ -334,7 +336,7 @@ static int nfc_genl_get_device(struct sk_buff *skb, struct genl_info *info)u32 idx;int rc = -ENOBUFS ; -nfc_dbg ("entry" ); +pr_debug ("entry\n" );if (!info->attrs[NFC_ATTR_DEVICE_INDEX ])return -EINVAL ;
@@ -373,7 +375,7 @@ static int nfc_genl_dev_up(struct sk_buff *skb, struct genl_info *info)int rc;u32 idx; -nfc_dbg ("entry" ); +pr_debug ("entry\n" );if (!info->attrs[NFC_ATTR_DEVICE_INDEX ])return -EINVAL ;
@@ -396,7 +398,7 @@ static int nfc_genl_dev_down(struct sk_buff *skb, struct genl_info *info)int rc;u32 idx; -nfc_dbg ("entry" ); +pr_debug ("entry\n" );if (!info->attrs[NFC_ATTR_DEVICE_INDEX ])return -EINVAL ;
@@ -420,7 +422,7 @@ static int nfc_genl_start_poll(struct sk_buff *skb, struct genl_info *info)u32 idx;u32 protocols; -nfc_dbg ("entry" ); +pr_debug ("entry\n" );if (!info->attrs[NFC_ATTR_DEVICE_INDEX ] || !info->attrs[NFC_ATTR_PROTOCOLS ])
@@ -451,7 +453,7 @@ static int nfc_genl_stop_poll(struct sk_buff *skb, struct genl_info *info)int rc;u32 idx; -nfc_dbg ("entry" ); +pr_debug ("entry\n" );if (!info->attrs[NFC_ATTR_DEVICE_INDEX ])return -EINVAL ;
@@ -524,7 +526,7 @@ static int nfc_genl_rcv_nl_event(struct notifier_block *this,if (event !=NETLINK_URELEASE || n->protocol !=NETLINK_GENERIC ) goto out; -nfc_dbg ("NETLINK_URELEASE event from id %d" , n->pid); +pr_debug ("NETLINK_URELEASE event from id %d\n" , n->pid);nfc_device_iter_init (&iter); dev =nfc_device_iter_next (&iter);
net/nfc/rawsock.c +12 -12
@@ -31,7 +31,7 @@static void rawsock_write_queue_purge (struct sock *sk) { -nfc_dbg ("sk=%p" , sk); +pr_debug ("sk=%p\n" , sk);spin_lock_bh (&sk->sk_write_queue.lock);__skb_queue_purge (&sk->sk_write_queue);
@@ -41,7 +41,7 @@ static void rawsock_write_queue_purge(struct sock *sk)static void rawsock_report_error (struct sock *sk,int err) { -nfc_dbg ("sk=%p err=%d" , sk, err); +pr_debug ("sk=%p err=%d\n" , sk, err); sk->sk_shutdown =SHUTDOWN_MASK ; sk->sk_err = -err;
@@ -54,7 +54,7 @@ static int rawsock_release(struct socket *sock) {struct sock *sk = sock->sk; -nfc_dbg ("sock=%p" , sock); +pr_debug ("sock=%p\n" , sock);sock_orphan (sk);sock_put (sk);
@@ -70,14 +70,14 @@ static int rawsock_connect(struct socket *sock, struct sockaddr *_addr,struct nfc_dev *dev;int rc =0 ; -nfc_dbg ("sock=%p sk=%p flags=%d" , sock, sk, flags); +pr_debug ("sock=%p sk=%p flags=%d\n" , sock, sk, flags);if (!addr || len <sizeof (struct sockaddr_nfc ) || addr->sa_family !=AF_NFC )return -EINVAL ; -nfc_dbg ("addr dev_idx=%u target_idx=%u protocol=%u" , addr->dev_idx, - addr->target_idx, addr->nfc_protocol); +pr_debug ("addr dev_idx=%u target_idx=%u protocol=%u\n" , + addr->dev_idx, addr->target_idx, addr->nfc_protocol);lock_sock (sk);
@@ -138,7 +138,7 @@ static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb,BUG_ON (in_irq ()); -nfc_dbg ("sk=%p err=%d" , sk, err); +pr_debug ("sk=%p err=%d\n" , sk, err);if (err) goto error;
@@ -174,7 +174,7 @@ static void rawsock_tx_work(struct work_struct *work)struct sk_buff *skb;int rc; -nfc_dbg ("sk=%p target_idx=%u" , sk, target_idx); +pr_debug ("sk=%p target_idx=%u\n" , sk, target_idx);if (sk->sk_shutdown &SEND_SHUTDOWN ) {rawsock_write_queue_purge (sk);
@@ -200,7 +200,7 @@ static int rawsock_sendmsg(struct kiocb *iocb, struct socket *sock,struct sk_buff *skb;int rc; -nfc_dbg ("sock=%p sk=%p len=%zu" , sock, sk, len); +pr_debug ("sock=%p sk=%p len=%zu\n" , sock, sk, len);if (msg->msg_namelen)return -EOPNOTSUPP ;
@@ -241,7 +241,7 @@ static int rawsock_recvmsg(struct kiocb *iocb, struct socket *sock,int copied;int rc; -nfc_dbg ("sock=%p sk=%p len=%zu flags=%d" , sock, sk, len, flags); +pr_debug ("sock=%p sk=%p len=%zu flags=%d\n" , sock, sk, len, flags); skb =skb_recv_datagram (sk, flags, noblock, &rc);if (!skb)
@@ -285,7 +285,7 @@ static const struct proto_ops rawsock_ops = {static void rawsock_destruct (struct sock *sk) { -nfc_dbg ("sk=%p" , sk); +pr_debug ("sk=%p\n" , sk);if (sk->sk_state ==TCP_ESTABLISHED ) { nfc_deactivate_target(nfc_rawsock(sk)->dev,
@@ -306,7 +306,7 @@ static int rawsock_create(struct net *net, struct socket *sock, {struct sock *sk; -nfc_dbg ("sock=%p" , sock); +pr_debug ("sock=%p\n" , sock);if (sock->type !=SOCK_SEQPACKET )return -ESOCKTNOSUPPORT ;
Signature · 1 line
1.7.6.405.gc1be0
PATCH 3/4 nfc: Remove unused nfc_printk and nfc_<level> macros
In reply to Joe PerchesAll uses have been removed, so killing what's not necessary.
--- net/nfc/core.c | 19 ------------------- net/nfc/nfc.h | 7 ------- 2 files changed, 0 insertions(+), 26 deletions(-)
net/nfc/core.c +0 -19
@@ -35,25 +35,6 @@int nfc_devlist_generation;DEFINE_MUTEX (nfc_devlist_mutex); -int nfc_printk (const char *level,const char *format, ...) -{ -struct va_format vaf; -va_list args; -int r; - -va_start (args, format); - - vaf.fmt = format; - vaf.va = &args; - - r =printk ("%sNFC: %pV\n" , level, &vaf); - -va_end (args); - -return r; -} -EXPORT_SYMBOL (nfc_printk); -/** * nfc_dev_up - turn on the NFC device *
net/nfc/nfc.h +0 -7
@@ -27,13 +27,6 @@#include <net/nfc/nfc.h> #include <net/sock.h> -__printf(2, 3) -int nfc_printk (const char *level,const char *fmt, ...); - -#define nfc_info(fmt, arg...) nfc_printk(KERN_INFO, fmt, ##arg) -#define nfc_err(fmt, arg...) nfc_printk(KERN_ERR, fmt, ##arg) -#define nfc_dbg(fmt, arg...) pr_debug(fmt "\n", ##arg) -struct nfc_protocol {int id;struct proto *proto;
Signature · 1 line
1.7.6.405.gc1be0
PATCH 4/4 nfc: Remove function tracer like entry messages
In reply to Joe PerchesLogging messages that mimic function tracer enter/exit aren't necessary. Just remove them.
--- net/nfc/nci/core.c | 34 +++++++++------------------------- net/nfc/nci/data.c | 8 ++++---- net/nfc/nci/ntf.c | 2 +- net/nfc/nci/rsp.c | 10 +++++----- net/nfc/netlink.c | 28 ---------------------------- 5 files changed, 19 insertions(+), 63 deletions(-)
net/nfc/nci/core.c +9 -25
@@ -325,8 +325,6 @@ static void nci_cmd_timer(unsigned long arg) {struct nci_dev *ndev = (void *) arg; -pr_debug ("entry\n" ); -atomic_set (&ndev->cmd_cnt,1 );queue_work (ndev->cmd_wq, &ndev->cmd_work); }
@@ -335,8 +333,6 @@ static int nci_dev_up(struct nfc_dev *nfc_dev) {struct nci_dev *ndev =nfc_get_drvdata (nfc_dev); -pr_debug ("entry\n" ); -return nci_open_device (ndev); }
@@ -344,8 +340,6 @@ static int nci_dev_down(struct nfc_dev *nfc_dev) {struct nci_dev *ndev =nfc_get_drvdata (nfc_dev); -pr_debug ("entry\n" ); -return nci_close_device (ndev); }
@@ -354,8 +348,6 @@ static int nci_start_poll(struct nfc_dev *nfc_dev, __u32 protocols)struct nci_dev *ndev =nfc_get_drvdata (nfc_dev);int rc; -pr_debug ("entry\n" ); -if (test_bit (NCI_DISCOVERY , &ndev->flags)) {pr_err ("unable to start poll, since poll is already active\n" );return -EBUSY ;
@@ -388,8 +380,6 @@ static void nci_stop_poll(struct nfc_dev *nfc_dev) {struct nci_dev *ndev =nfc_get_drvdata (nfc_dev); -pr_debug ("entry\n" ); -if (!test_bit (NCI_DISCOVERY , &ndev->flags)) {pr_err ("unable to stop poll, since poll is not active\n" );return ;
@@ -404,7 +394,7 @@ static int nci_activate_target(struct nfc_dev *nfc_dev, __u32 target_idx, {struct nci_dev *ndev =nfc_get_drvdata (nfc_dev); -pr_debug ("entry, target_idx %d, protocol 0x%x\n" , target_idx, protocol); +pr_debug ("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" );
@@ -432,7 +422,7 @@ static void nci_deactivate_target(struct nfc_dev *nfc_dev, __u32 target_idx) {struct nci_dev *ndev =nfc_get_drvdata (nfc_dev); -pr_debug ("entry, target_idx %d\n" , target_idx); +pr_debug ("target_idx %d\n" , target_idx);if (!ndev->target_active_prot) {pr_err ("unable to deactivate target, no active target\n" );
@@ -455,7 +445,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; -pr_debug ("entry, target_idx %d, len %d\n" , target_idx, skb->len); +pr_debug ("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" );
@@ -501,7 +491,7 @@ struct nci_dev *nci_allocate_device(struct nci_ops *ops, {struct nci_dev *ndev; -pr_debug ("entry, supported_protocols 0x%x\n" , supported_protocols); +pr_debug ("supported_protocols 0x%x\n" , supported_protocols);if (!ops->open || !ops->close || !ops->send)return NULL ;
@@ -541,8 +531,6 @@ EXPORT_SYMBOL(nci_allocate_device);*/ void nci_free_device (struct nci_dev *ndev) { -pr_debug ("entry\n" ); -nfc_free_device (ndev->nfc_dev);kfree (ndev); }
@@ -559,8 +547,6 @@ int nci_register_device(struct nci_dev *ndev)struct device *dev = &ndev->nfc_dev->dev;char name[32 ]; -pr_debug ("entry\n" ); - rc =nfc_register_device (ndev->nfc_dev);if (rc) goto exit;
@@ -623,8 +609,6 @@ EXPORT_SYMBOL(nci_register_device);*/ void nci_unregister_device (struct nci_dev *ndev) { -pr_debug ("entry\n" ); -nci_close_device (ndev);destroy_workqueue (ndev->cmd_wq);
@@ -644,7 +628,7 @@ int nci_recv_frame(struct sk_buff *skb) {struct nci_dev *ndev = (struct nci_dev *) skb->dev; -pr_debug ("entry, len %d\n" , skb->len); +pr_debug ("len %d\n" , skb->len);if (!ndev || (!test_bit (NCI_UP , &ndev->flags) && !test_bit (NCI_INIT , &ndev->flags))) {
@@ -664,7 +648,7 @@ static int nci_send_frame(struct sk_buff *skb) {struct nci_dev *ndev = (struct nci_dev *) skb->dev; -pr_debug ("entry, len %d\n" , skb->len); +pr_debug ("len %d\n" , skb->len);if (!ndev) {kfree_skb (skb);
@@ -683,7 +667,7 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload)struct nci_ctrl_hdr *hdr;struct sk_buff *skb; -pr_debug ("entry, opcode 0x%x, plen %d\n" , opcode, plen); +pr_debug ("opcode 0x%x, plen %d\n" , opcode, plen); skb =nci_skb_alloc (ndev, (NCI_CTRL_HDR_SIZE + plen),GFP_KERNEL );if (!skb) {
@@ -717,7 +701,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; -pr_debug ("entry, credits_cnt %d\n" ,atomic_read (&ndev->credits_cnt)); +pr_debug ("credits_cnt %d\n" ,atomic_read (&ndev->credits_cnt));/* Send queued tx data */ while (atomic_read (&ndev->credits_cnt)) {
@@ -776,7 +760,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; -pr_debug ("entry, cmd_cnt %d\n" ,atomic_read (&ndev->cmd_cnt)); +pr_debug ("cmd_cnt %d\n" ,atomic_read (&ndev->cmd_cnt));/* Send queued command */ if (atomic_read (&ndev->cmd_cnt)) {
net/nfc/nci/data.c +4 -4
@@ -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; -pr_debug ("entry, len %d, err %d\n" , skb ? skb->len :0 , err); +pr_debug ("len %d, err %d\n" , skb ? skb->len :0 , err);if (cb) { ndev->data_exchange_cb =NULL ;
@@ -92,7 +92,7 @@ static int nci_queue_tx_data_frags(struct nci_dev *ndev,int frag_len;int rc =0 ; -pr_debug ("entry, conn_id 0x%x, total_len %d\n" , conn_id, total_len); +pr_debug ("conn_id 0x%x, total_len %d\n" , conn_id, total_len);__skb_queue_head_init (&frags_q);
@@ -151,7 +151,7 @@ int nci_send_data(struct nci_dev *ndev, __u8 conn_id, struct sk_buff *skb) {int rc =0 ; -pr_debug ("entry, conn_id 0x%x, plen %d\n" , conn_id, skb->len); +pr_debug ("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) {
@@ -230,7 +230,7 @@ void nci_rx_data_packet(struct nci_dev *ndev, struct sk_buff *skb) {__u8 pbf =nci_pbf (skb->data); -pr_debug ("entry, len %d\n" , skb->len); +pr_debug ("len %d\n" , skb->len); pr_debug("NCI RX: MT=data, PBF=%d, conn_id=%d, plen=%d\n", nci_pbf(skb->data),
net/nfc/nci/ntf.c +1 -1
@@ -45,7 +45,7 @@ static void nci_core_conn_credits_ntf_packet(struct nci_dev *ndev,struct nci_core_conn_credit_ntf *ntf = (void *) skb->data;int i; -pr_debug ("entry, num_entries %d\n" , ntf->num_entries); +pr_debug ("num_entries %d\n" , ntf->num_entries);if (ntf->num_entries >NCI_MAX_NUM_CONN ) ntf->num_entries =NCI_MAX_NUM_CONN ;
net/nfc/nci/rsp.c +5 -5
@@ -42,7 +42,7 @@ static void nci_core_reset_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) {struct nci_core_reset_rsp *rsp = (void *) skb->data; -pr_debug ("entry, status 0x%x\n" , rsp->status); +pr_debug ("status 0x%x\n" , rsp->status);if (rsp->status ==NCI_STATUS_OK ) { ndev->nci_ver = rsp->nci_ver;
@@ -58,7 +58,7 @@ static void nci_core_init_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb)struct nci_core_init_rsp_1 *rsp_1 = (void *) skb->data;struct nci_core_init_rsp_2 *rsp_2; -pr_debug ("entry, status 0x%x\n" , rsp_1->status); +pr_debug ("status 0x%x\n" , rsp_1->status);if (rsp_1->status !=NCI_STATUS_OK ) goto exit;
@@ -135,7 +135,7 @@ static void nci_rf_disc_map_rsp_packet(struct nci_dev *ndev, {__u8 status = skb->data[0 ]; -pr_debug ("entry, status 0x%x\n" , status); +pr_debug ("status 0x%x\n" , status);nci_req_complete (ndev, status); }
@@ -144,7 +144,7 @@ static void nci_rf_disc_rsp_packet(struct nci_dev *ndev, struct sk_buff *skb) {__u8 status = skb->data[0 ]; -pr_debug ("entry, status 0x%x\n" , status); +pr_debug ("status 0x%x\n" , status);if (status ==NCI_STATUS_OK )set_bit (NCI_DISCOVERY , &ndev->flags);
@@ -157,7 +157,7 @@ static void nci_rf_deactivate_rsp_packet(struct nci_dev *ndev, {__u8 status = skb->data[0 ]; -pr_debug ("entry, status 0x%x\n" , status); +pr_debug ("status 0x%x\n" , status);clear_bit (NCI_DISCOVERY , &ndev->flags);
net/nfc/netlink.c +0 -28
@@ -53,8 +53,6 @@ static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target, {void *hdr; -pr_debug ("entry\n" ); - hdr =genlmsg_put (msg,NETLINK_CB (cb->skb).pid, cb->nlh->nlmsg_seq, &nfc_genl_family, flags,NFC_CMD_GET_TARGET );if (!hdr)
@@ -107,8 +105,6 @@ static int nfc_genl_dump_targets(struct sk_buff *skb,struct nfc_dev *dev = (struct nfc_dev *) cb->args[1 ];int rc; -pr_debug ("entry\n" ); -if (!dev) { dev =__get_device_from_cb (cb);if (IS_ERR (dev))
@@ -141,8 +137,6 @@ static int nfc_genl_dump_targets_done(struct netlink_callback *cb) {struct nfc_dev *dev = (struct nfc_dev *) cb->args[1 ]; -pr_debug ("entry\n" ); -if (dev)nfc_put_device (dev);
@@ -154,8 +148,6 @@ int nfc_genl_targets_found(struct nfc_dev *dev)struct sk_buff *msg;void *hdr; -pr_debug ("entry\n" ); - dev->genl_data.poll_req_pid =0 ; msg =nlmsg_new (NLMSG_GOODSIZE ,GFP_ATOMIC );
@@ -185,8 +177,6 @@ int nfc_genl_device_added(struct nfc_dev *dev)struct sk_buff *msg;void *hdr; -pr_debug ("entry\n" ); - msg =nlmsg_new (NLMSG_GOODSIZE ,GFP_KERNEL );if (!msg)return -ENOMEM ;
@@ -218,8 +208,6 @@ int nfc_genl_device_removed(struct nfc_dev *dev)struct sk_buff *msg;void *hdr; -pr_debug ("entry\n" ); - msg =nlmsg_new (NLMSG_GOODSIZE ,GFP_KERNEL );if (!msg)return -ENOMEM ;
@@ -251,8 +239,6 @@ static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev, {void *hdr; -pr_debug ("entry\n" ); - hdr =genlmsg_put (msg, pid, seq, &nfc_genl_family, flags,NFC_CMD_GET_DEVICE );if (!hdr)
@@ -279,8 +265,6 @@ static int nfc_genl_dump_devices(struct sk_buff *skb,struct nfc_dev *dev = (struct nfc_dev *) cb->args[1 ];bool first_call = false; -pr_debug ("entry\n" ); -if (!iter) { first_call = true; iter =kmalloc (sizeof (struct class_dev_iter ),GFP_KERNEL );
@@ -321,8 +305,6 @@ static int nfc_genl_dump_devices_done(struct netlink_callback *cb) {struct class_dev_iter *iter = (struct class_dev_iter *) cb->args[0 ]; -pr_debug ("entry\n" ); -nfc_device_iter_exit (iter);kfree (iter);
@@ -336,8 +318,6 @@ static int nfc_genl_get_device(struct sk_buff *skb, struct genl_info *info)u32 idx;int rc = -ENOBUFS ; -pr_debug ("entry\n" ); -if (!info->attrs[NFC_ATTR_DEVICE_INDEX ])return -EINVAL ;
@@ -375,8 +355,6 @@ static int nfc_genl_dev_up(struct sk_buff *skb, struct genl_info *info)int rc;u32 idx; -pr_debug ("entry\n" ); -if (!info->attrs[NFC_ATTR_DEVICE_INDEX ])return -EINVAL ;
@@ -398,8 +376,6 @@ static int nfc_genl_dev_down(struct sk_buff *skb, struct genl_info *info)int rc;u32 idx; -pr_debug ("entry\n" ); -if (!info->attrs[NFC_ATTR_DEVICE_INDEX ])return -EINVAL ;
@@ -422,8 +398,6 @@ static int nfc_genl_start_poll(struct sk_buff *skb, struct genl_info *info)u32 idx;u32 protocols; -pr_debug ("entry\n" ); -if (!info->attrs[NFC_ATTR_DEVICE_INDEX ] || !info->attrs[NFC_ATTR_PROTOCOLS ])return -EINVAL ;
@@ -453,8 +427,6 @@ static int nfc_genl_stop_poll(struct sk_buff *skb, struct genl_info *info)int rc;u32 idx; -pr_debug ("entry\n" ); -if (!info->attrs[NFC_ATTR_DEVICE_INDEX ])return -EINVAL ;
Signature · 1 line
1.7.6.405.gc1be0
Re: [PATCH 4/4] nfc: Remove function tracer like entry messages
Hi Joe,
Quoted 4 lines · Joe Perches
Logging messages that mimic function tracer enter/exit aren't necessary. Just remove them.
Signed-off-by Joe Perches <[email protected]>
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/