Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfp: update nfp_X logging definitions

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Dylan Muller and committed by
David S. Miller
9386ebcc 735cb16b

+20 -6
+20 -6
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_cpp.h
··· 13 13 #include <linux/ctype.h> 14 14 #include <linux/types.h> 15 15 #include <linux/sizes.h> 16 + #include <linux/stringify.h> 16 17 17 18 #ifndef NFP_SUBSYS 18 19 #define NFP_SUBSYS "nfp" 19 20 #endif 20 21 21 - #define nfp_err(cpp, fmt, args...) \ 22 + #define string_format(x) __FILE__ ":" __stringify(__LINE__) ": " x 23 + 24 + #define __nfp_err(cpp, fmt, args...) \ 22 25 dev_err(nfp_cpp_device(cpp)->parent, NFP_SUBSYS ": " fmt, ## args) 23 - #define nfp_warn(cpp, fmt, args...) \ 26 + #define __nfp_warn(cpp, fmt, args...) \ 24 27 dev_warn(nfp_cpp_device(cpp)->parent, NFP_SUBSYS ": " fmt, ## args) 25 - #define nfp_info(cpp, fmt, args...) \ 28 + #define __nfp_info(cpp, fmt, args...) \ 26 29 dev_info(nfp_cpp_device(cpp)->parent, NFP_SUBSYS ": " fmt, ## args) 27 - #define nfp_dbg(cpp, fmt, args...) \ 30 + #define __nfp_dbg(cpp, fmt, args...) \ 28 31 dev_dbg(nfp_cpp_device(cpp)->parent, NFP_SUBSYS ": " fmt, ## args) 32 + #define __nfp_printk(level, cpp, fmt, args...) \ 33 + dev_printk(level, nfp_cpp_device(cpp)->parent, \ 34 + NFP_SUBSYS ": " fmt, ## args) 35 + 36 + #define nfp_err(cpp, fmt, args...) \ 37 + __nfp_err(cpp, string_format(fmt), ## args) 38 + #define nfp_warn(cpp, fmt, args...) \ 39 + __nfp_warn(cpp, string_format(fmt), ## args) 40 + #define nfp_info(cpp, fmt, args...) \ 41 + __nfp_info(cpp, string_format(fmt), ## args) 42 + #define nfp_dbg(cpp, fmt, args...) \ 43 + __nfp_dbg(cpp, string_format(fmt), ## args) 29 44 #define nfp_printk(level, cpp, fmt, args...) \ 30 - dev_printk(level, nfp_cpp_device(cpp)->parent, \ 31 - NFP_SUBSYS ": " fmt, ## args) 45 + __nfp_printk(level, cpp, string_format(fmt), ## args) 32 46 33 47 #define PCI_64BIT_BAR_COUNT 3 34 48