stmmac: fix sparse warnings
Subsystems (4)
PATCH 1/1 stmmac: fix sparse warnings
This patch fixes the following sparse warnings.
drivers/net/ethernet/stmicro/stmmac/enh_desc.c:381:30: warning: symbol 'enh_desc_ops' was not declared. Should it be static? drivers/net/ethernet/stmicro/stmmac/norm_desc.c:253:30: warning: symbol 'ndesc_ops' was not declared. Should it be static? drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c:141:33: warning: symbol 'stmmac_ptp' was not declared. Should it be static?
There is no functional change.
--- drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 2 ++ 3 files changed, 6 insertions(+)
drivers/net/ethernet/stmicro/stmmac/enh_desc.c +2 -0
@@ -23,8 +23,10 @@*******************************************************************************/ #include <linux/stmmac.h> +#include "common.h" #include "descs_com.h" +#include "stmmac.h" static int enh_desc_get_tx_status (void *data,struct stmmac_extra_stats *x,struct dma_desc *p,void __iomem *ioaddr)
drivers/net/ethernet/stmicro/stmmac/norm_desc.c +2 -0
@@ -23,8 +23,10 @@*******************************************************************************/ #include <linux/stmmac.h> +#include "common.h" #include "descs_com.h" +#include "stmmac.h" static int ndesc_get_tx_status (void *data,struct stmmac_extra_stats *x,struct dma_desc *p,void __iomem *ioaddr)
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +2 -0
@@ -25,8 +25,10 @@#include <linux/io.h> #include <linux/delay.h> +#include "common.h" #include "stmmac_ptp.h" +#include "stmmac.h" static void stmmac_config_hw_tstamping (void __iomem *ioaddr,u32 data) {
Signature · 1 line
2.1.1
PATCH 1/1 stmmac: remove custom implementation of print_hex_dump()
There is a kernel helper to dump buffers in a hexdecimal format. This patch substitutes the open coded function by calling that helper.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -8
@@ -191,14 +191,8 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)static void print_pkt (unsigned char *buf,int len) { -int j; -pr_debug ("len = %d byte, buf addr: 0x%p" , len, buf); -for (j =0 ; j < len; j++) { -if ((j %16 ) ==0 ) -pr_debug ("\n %03x:" , j); -pr_debug (" %02x" , buf[j]); - } -pr_debug ("\n" ); +pr_debug ("len = %d byte, buf addr: 0x%p\n" , len, buf); +print_hex_dump (KERN_DEBUG ," " ,DUMP_PREFIX_OFFSET ,16 ,1 , buf, len,0 ); }/* minimum number of free TX descriptors required to wake up TX process */
Signature · 1 line
2.1.1
Re: [PATCH] stmmac: remove custom implementation of print_hex_dump()
Quoted 2 lines · Andy Shevchenko
There is a kernel helper to dump buffers in a hexdecimal format. This patch substitutes the open coded function by calling that helper.
[]
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Quoted 1 line
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0
[]
Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0@@ -191,14 +191,8 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)static void print_pkt (unsigned char *buf,int len) {
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static void stmmac_clk_csr_set(struct stmmac_priv *priv) · line 195
Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2
-8-int j; -pr_debug ("len = %d byte, buf addr: 0x%p" , len, buf); -for (j =0 ; j < len; j++) { -if ((j %16 ) ==0 ) -pr_debug ("\n %03x:" , j); -pr_debug (" %02x" , buf[j]); - } -pr_debug ("\n" ); +pr_debug ("len = %d byte, buf addr: 0x%p\n" , len, buf); +print_hex_dump (KERN_DEBUG ," " ,DUMP_PREFIX_OFFSET ,16 ,1 , buf, len,0 );
Prefix should be ""
Please use true/false for the last argument
Another (better?) option would be to use:
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);so that it can be dynamically controlled like
the pr_debug statements.
Re: [PATCH] stmmac: remove custom implementation of print_hex_dump()
Quoted 8 lines · Joe Perches
Quoted 2 lines · Andy Shevchenko
There is a kernel helper to dump buffers in a hexdecimal format. This patch substitutes the open coded function by calling that helper.
[]
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Quoted 1 line
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0[]
Quoted 2 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0@@ -191,14 +191,8 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
Quoted 14 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static void stmmac_clk_csr_set(struct stmmac_priv *priv) · line 195
Quoted 12 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2
-8static void print_pkt (unsigned char *buf,int len) { -int j; -pr_debug ("len = %d byte, buf addr: 0x%p" , len, buf); -for (j =0 ; j < len; j++) { -if ((j %16 ) ==0 ) -pr_debug ("\n %03x:" , j); -pr_debug (" %02x" , buf[j]); - } -pr_debug ("\n" ); +pr_debug ("len = %d byte, buf addr: 0x%p\n" , len, buf); +print_hex_dump (KERN_DEBUG ," " ,DUMP_PREFIX_OFFSET ,16 ,1 , buf, len,0 );Prefix should be ""
Oh, initially there is an indentation in one space. Maybe Giuseppe would comment on this.
Quoted 1 line
Please use true/false for the last argument
Okay.
Quoted 7 lines
Another (better?) option would be to use:
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);so that it can be dynamically controlled like
thepr_debugstatements.
Ah, yes, but unfortunately it will print ASCII part always. Giuseppe, what do you think?
P.S. [off topic] Joe, just would like to know if you have you seen my last version of the patch series against hexdump.c which adds seq_hex_dump() call [1]. If so, could you comment on it?
[1] https://lkml.org/lkml/2014/9/4/309
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH] stmmac: remove custom implementation of print_hex_dump()
Quoted 24 lines · Andy Shevchenko
Quoted 8 lines · Joe Perches
Quoted 2 lines · Andy Shevchenko
There is a kernel helper to dump buffers in a hexdecimal format. This patch substitutes the open coded function by calling that helper.
[]
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Quoted 1 line
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0[]
Quoted 2 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +0
-0@@ -191,14 +191,8 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)Quoted 14 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static void stmmac_clk_csr_set(struct stmmac_priv *priv) · line 195
Quoted 12 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2
-8static void print_pkt (unsigned char *buf,int len) { -int j; -pr_debug ("len = %d byte, buf addr: 0x%p" , len, buf); -for (j =0 ; j < len; j++) { -if ((j %16 ) ==0 ) -pr_debug ("\n %03x:" , j); -pr_debug (" %02x" , buf[j]); - } -pr_debug ("\n" ); +pr_debug ("len = %d byte, buf addr: 0x%p\n" , len, buf); +print_hex_dump (KERN_DEBUG ," " ,DUMP_PREFIX_OFFSET ,16 ,1 , buf, len,0 );Prefix should be ""
Quoted 2 lines
Oh, initially there is an indentation in one space. Maybe Giuseppe would comment on this.
I think that's not particularly important.
This changes the output anyway as the the printed offset is now 8 chars wide not 3.
Quoted 9 lines
Quoted 6 lines
Another (better?) option would be to use:
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len);so that it can be dynamically controlled like
thepr_debugstatements.Ah, yes, but unfortunately it will print ASCII part always. Giuseppe, what do you think?
I'm not bothered by logging message output changes. It's not a guaranteed stable output.
Quoted 4 lines
P.S. [off topic] Joe, just would like to know if you have you seen my last version of the patch series againsthexdump.cwhich addsseq_hex_dump()call [1]. If so, could you comment on it?
[1] https://lkml.org/lkml/2014/9/4/309
seq_<foo> output however is guaranteed.
So any conversion to the seq_hex_dump function would need to be exactly the same.
New code could use seq_hex_dump.
Other than that, it seems sensible enough.
Quoted 7 lines · Andy Shevchenko
This patch fixes the following sparse warnings.
drivers/net/ethernet/stmicro/stmmac/enh_desc.c:381:30: warning: symbol 'enh_desc_ops' was not declared. Should it be static?drivers/net/ethernet/stmicro/stmmac/norm_desc.c:253:30: warning: symbol 'ndesc_ops' was not declared. Should it be static?drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c:141:33: warning: symbol 'stmmac_ptp' was not declared. Should it be static?There is no functional change.
Hello Andy
I have never seen this kind of warnings. I prefer to not include the stmmac.h in enh_desc.c and norm_desc.c but eventually to move the following from stmmac.h to common.h:
extern const struct stmmac_desc_ops enh_desc_ops; extern const struct stmmac_desc_ops ndesc_ops;
what do you think?
peppe
Quoted 54 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 2 ++ 3 files changed, 6 insertions(+)drivers/net/ethernet/stmicro/stmmac/enh_desc.c +2
-0@@ -23,8 +23,10 @@*******************************************************************************/ #include <linux/stmmac.h> +#include "common.h" #include "descs_com.h" +#include "stmmac.h" static int enh_desc_get_tx_status (void *data,struct stmmac_extra_stats *x,struct dma_desc *p,void __iomem *ioaddr)drivers/net/ethernet/stmicro/stmmac/norm_desc.c +2
-0@@ -23,8 +23,10 @@*******************************************************************************/ #include <linux/stmmac.h> +#include "common.h" #include "descs_com.h" +#include "stmmac.h" static int ndesc_get_tx_status (void *data,struct stmmac_extra_stats *x,struct dma_desc *p,void __iomem *ioaddr)drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +2
-0@@ -25,8 +25,10 @@#include <linux/io.h> #include <linux/delay.h> +#include "common.h" #include "stmmac_ptp.h" +#include "stmmac.h" static void stmmac_config_hw_tstamping (void __iomem *ioaddr,u32 data) {
David Miller
maintainerFrom: Giuseppe CAVALLARO <[email protected]>
Date: Tue, 4 Nov 2014 17:35:17 +0100
Quoted 10 lines · Andy Shevchenko
Quoted 9 lines
This patch fixes the following sparse warnings.
drivers/net/ethernet/stmicro/stmmac/enh_desc.c:381:30: warning: symbol 'enh_desc_ops' was not declared. Should it be static?drivers/net/ethernet/stmicro/stmmac/norm_desc.c:253:30: warning:
symbol 'ndesc_ops' was not declared. Should it be static?drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c:141:33: warning:
symbol 'stmmac_ptp' was not declared. Should it be static?
Quoted 5 lines
Quoted 1 line
There is no functional change.
Hello Andy
I have never seen this kind of warnings.
Are you running the 'sparse' checker with all options enabled? This is one of the most fundamental warnings it spits out.
Quoted 6 lines
I prefer to not include the
stmmac.hinenh_desc.candnorm_desc.cbut eventually to move the following fromstmmac.htocommon.h:
extern const structstmmac_desc_opsenh_desc_ops; extern const structstmmac_desc_opsndesc_ops;
what do you think?
You two sort this out and submit a new patch, thanks.
Quoted 9 lines · Giuseppe CAVALLARO
Quoted 7 lines · Andy Shevchenko
This patch fixes the following sparse warnings.
drivers/net/ethernet/stmicro/stmmac/enh_desc.c:381:30: warning: symbol 'enh_desc_ops' was not declared. Should it be static?drivers/net/ethernet/stmicro/stmmac/norm_desc.c:253:30: warning: symbol 'ndesc_ops' was not declared. Should it be static?drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c:141:33: warning: symbol 'stmmac_ptp' was not declared. Should it be static?There is no functional change.
Quoted 8 lines
Hello Andy
I have never seen this kind of warnings. I prefer to not include the
stmmac.hinenh_desc.candnorm_desc.cbut eventually to move the following fromstmmac.htocommon.h:extern const struct stmmac_desc_ops enh_desc_ops; extern const struct stmmac_desc_ops ndesc_ops;what do you think?
If it would work I do this way certainly. Thanks for the tip.
Will check soon and resubmit new version.
Quoted 59 lines
peppe
Quoted 54 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 2 ++ 3 files changed, 6 insertions(+)drivers/net/ethernet/stmicro/stmmac/enh_desc.c +2
-0@@ -23,8 +23,10 @@*******************************************************************************/ #include <linux/stmmac.h> +#include "common.h" #include "descs_com.h" +#include "stmmac.h" static int enh_desc_get_tx_status (void *data,struct stmmac_extra_stats *x,struct dma_desc *p,void __iomem *ioaddr)drivers/net/ethernet/stmicro/stmmac/norm_desc.c +2
-0@@ -23,8 +23,10 @@*******************************************************************************/ #include <linux/stmmac.h> +#include "common.h" #include "descs_com.h" +#include "stmmac.h" static int ndesc_get_tx_status (void *data,struct stmmac_extra_stats *x,struct dma_desc *p,void __iomem *ioaddr)drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +2
-0@@ -25,8 +25,10 @@#include <linux/io.h> #include <linux/delay.h> +#include "common.h" #include "stmmac_ptp.h" +#include "stmmac.h" static void stmmac_config_hw_tstamping (void __iomem *ioaddr,u32 data) {
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Quoted 12 lines · Andy Shevchenko
Quoted 11 lines · Giuseppe CAVALLARO
Quoted 7 lines · Andy Shevchenko
This patch fixes the following sparse warnings.
drivers/net/ethernet/stmicro/stmmac/enh_desc.c:381:30: warning: symbol 'enh_desc_ops' was not declared. Should it be static?drivers/net/ethernet/stmicro/stmmac/norm_desc.c:253:30: warning: symbol 'ndesc_ops' was not declared. Should it be static?drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c:141:33: warning: symbol 'stmmac_ptp' was not declared. Should it be static?There is no functional change.
Hello Andy
Quoted 8 lines
Quoted 6 lines
I have never seen this kind of warnings. I prefer to not include the
stmmac.hinenh_desc.candnorm_desc.cbut eventually to move the following fromstmmac.htocommon.h:extern const struct stmmac_desc_ops enh_desc_ops; extern const struct stmmac_desc_ops ndesc_ops;what do you think?
If it would work I do this way certainly. Thanks for the tip.
yes Andy just verified with sparse, pls also fix:
extern const struct stmmac_hwtimestamp stmmac_ptp;
in the same way.
Quoted 2 lines
Will check soon and resubmit new version.
sure and you can add my Acked-by:
peppe
Quoted 62 lines
Quoted 60 lines
peppe
Quoted 54 lines
Signed-off-by Andy Shevchenko <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/enh_desc.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/norm_desc.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c | 2 ++ 3 files changed, 6 insertions(+)drivers/net/ethernet/stmicro/stmmac/enh_desc.c +2
-0@@ -23,8 +23,10 @@*******************************************************************************/ #include <linux/stmmac.h> +#include "common.h" #include "descs_com.h" +#include "stmmac.h" static int enh_desc_get_tx_status (void *data,struct stmmac_extra_stats *x,struct dma_desc *p,void __iomem *ioaddr)drivers/net/ethernet/stmicro/stmmac/norm_desc.c +2
-0@@ -23,8 +23,10 @@*******************************************************************************/ #include <linux/stmmac.h> +#include "common.h" #include "descs_com.h" +#include "stmmac.h" static int ndesc_get_tx_status (void *data,struct stmmac_extra_stats *x,struct dma_desc *p,void __iomem *ioaddr)drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +2
-0@@ -25,8 +25,10 @@#include <linux/io.h> #include <linux/delay.h> +#include "common.h" #include "stmmac_ptp.h" +#include "stmmac.h" static void stmmac_config_hw_tstamping (void __iomem *ioaddr,u32 data) {