netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] nfp: update nfp_X logging definitions
@ 2022-04-12 15:26 Simon Horman
  2022-04-12 15:46 ` Jakub Kicinski
  2022-04-13 13:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Simon Horman @ 2022-04-12 15:26 UTC (permalink / raw)
  To: David Miller, Jakub Kicinski
  Cc: netdev, oss-drivers, Dylan Muller, Simon Horman

From: Dylan Muller <dylan.muller@corigine.com>

Previously it was not possible to determine which code path was responsible
for generating a certain message after a call to the nfp_X messaging
definitions for cases of duplicate strings. We therefore modify nfp_err,
nfp_warn, nfp_info, nfp_dbg and nfp_printk to print the corresponding file
and line number where the nfp_X definition is used.

Signed-off-by: Dylan Muller <dylan.muller@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
---
 .../ethernet/netronome/nfp/nfpcore/nfp_cpp.h  | 26 ++++++++++++++-----
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cpp.h b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cpp.h
index 3d379e937184..ddb34bfb9bef 100644
--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cpp.h
+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cpp.h
@@ -13,22 +13,36 @@
 #include <linux/ctype.h>
 #include <linux/types.h>
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 
 #ifndef NFP_SUBSYS
 #define NFP_SUBSYS "nfp"
 #endif
 
-#define nfp_err(cpp, fmt, args...) \
+#define string_format(x) __FILE__ ":" __stringify(__LINE__) ": " x
+
+#define __nfp_err(cpp, fmt, args...) \
 	dev_err(nfp_cpp_device(cpp)->parent, NFP_SUBSYS ": " fmt, ## args)
-#define nfp_warn(cpp, fmt, args...) \
+#define __nfp_warn(cpp, fmt, args...) \
 	dev_warn(nfp_cpp_device(cpp)->parent, NFP_SUBSYS ": " fmt, ## args)
-#define nfp_info(cpp, fmt, args...) \
+#define __nfp_info(cpp, fmt, args...) \
 	dev_info(nfp_cpp_device(cpp)->parent, NFP_SUBSYS ": " fmt, ## args)
-#define nfp_dbg(cpp, fmt, args...) \
+#define __nfp_dbg(cpp, fmt, args...) \
 	dev_dbg(nfp_cpp_device(cpp)->parent, NFP_SUBSYS ": " fmt, ## args)
+#define __nfp_printk(level, cpp, fmt, args...) \
+	dev_printk(level, nfp_cpp_device(cpp)->parent,  \
+		   NFP_SUBSYS ": " fmt, ## args)
+
+#define nfp_err(cpp, fmt, args...) \
+	__nfp_err(cpp, string_format(fmt), ## args)
+#define nfp_warn(cpp, fmt, args...) \
+	__nfp_warn(cpp, string_format(fmt), ## args)
+#define nfp_info(cpp, fmt, args...) \
+	__nfp_info(cpp, string_format(fmt), ## args)
+#define nfp_dbg(cpp, fmt, args...) \
+	__nfp_dbg(cpp, string_format(fmt), ## args)
 #define nfp_printk(level, cpp, fmt, args...) \
-	dev_printk(level, nfp_cpp_device(cpp)->parent,	\
-		   NFP_SUBSYS ": " fmt,	## args)
+	__nfp_printk(level, cpp, string_format(fmt), ## args)
 
 #define PCI_64BIT_BAR_COUNT             3
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] nfp: update nfp_X logging definitions
  2022-04-12 15:26 [PATCH net-next] nfp: update nfp_X logging definitions Simon Horman
@ 2022-04-12 15:46 ` Jakub Kicinski
  2022-04-13 13:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2022-04-12 15:46 UTC (permalink / raw)
  To: Simon Horman, Dylan Muller; +Cc: David Miller, netdev, oss-drivers

On Tue, 12 Apr 2022 17:26:00 +0200 Simon Horman wrote:
> From: Dylan Muller <dylan.muller@corigine.com>
> 
> Previously it was not possible to determine which code path was responsible
> for generating a certain message after a call to the nfp_X messaging
> definitions for cases of duplicate strings. We therefore modify nfp_err,
> nfp_warn, nfp_info, nfp_dbg and nfp_printk to print the corresponding file
> and line number where the nfp_X definition is used.
> 
> Signed-off-by: Dylan Muller <dylan.muller@corigine.com>
> Signed-off-by: Simon Horman <simon.horman@corigine.com>

Examples? The messages are usually unique. Unless you also print 
the kernel version the line numbers are meaningless in real life.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] nfp: update nfp_X logging definitions
  2022-04-12 15:26 [PATCH net-next] nfp: update nfp_X logging definitions Simon Horman
  2022-04-12 15:46 ` Jakub Kicinski
@ 2022-04-13 13:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-13 13:50 UTC (permalink / raw)
  To: Simon Horman; +Cc: davem, kuba, netdev, oss-drivers, dylan.muller

Hello:

This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:

On Tue, 12 Apr 2022 17:26:00 +0200 you wrote:
> From: Dylan Muller <dylan.muller@corigine.com>
> 
> Previously it was not possible to determine which code path was responsible
> for generating a certain message after a call to the nfp_X messaging
> definitions for cases of duplicate strings. We therefore modify nfp_err,
> nfp_warn, nfp_info, nfp_dbg and nfp_printk to print the corresponding file
> and line number where the nfp_X definition is used.
> 
> [...]

Here is the summary with links:
  - [net-next] nfp: update nfp_X logging definitions
    https://git.kernel.org/netdev/net-next/c/9386ebccfc59

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-13 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-12 15:26 [PATCH net-next] nfp: update nfp_X logging definitions Simon Horman
2022-04-12 15:46 ` Jakub Kicinski
2022-04-13 13:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).