TI Ethernet driver warnings fixes
Subsystems (3)
cover TI Ethernet driver warnings fixes
Hi all,
This patch series attempts to fix properly the warnings observed with turning on COMPILE_TEST and TI Ethernet drivers on 64-bit hosts.
Since I don't have any of this hardware, please review carefully for possible breakage!
Thank you!
Florian Fainelli (5):
ti: ethernet: cpdma: Use correct format for genpool_*
net: ethernet: ti: cpts: Fix timestamp print
net: ethernet: ti: cpsw: Fix cpsw_add_ch_strings() printk format
net: ethernet: davinci_emac: Fix printing of base address
ti: ethernet: davinci: Fix cast to int warnings
drivers/net/ethernet/ti/cpsw.c | 4 ++-- drivers/net/ethernet/ti/cpts.c | 3 ++- drivers/net/ethernet/ti/davinci_cpdma.c | 10 +++++----- drivers/net/ethernet/ti/davinci_emac.c | 4 ++-- 4 files changed, 11 insertions(+), 10 deletions(-)
Signature · 1 line
2.14.1
PATCH 1/5 ti: ethernet: cpdma: Use correct format for genpool_*
Now that we can compile davinci_cpdma.c on 64-bit hosts, we can see that the format used for printing a size_t type is incorrect, use %zd accordingly.
--- drivers/net/ethernet/ti/davinci_cpdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/davinci_cpdma.c +1 -1
@@ -191,7 +191,7 @@ static void cpdma_desc_pool_destroy(struct cpdma_ctlr *ctlr)return ;WARN (gen_pool_size (pool->gen_pool) !=gen_pool_avail (pool->gen_pool), -"cpdma_desc_pool size %d != avail %d" , +"cpdma_desc_pool size %zd != avail %zd" ,gen_pool_size (pool->gen_pool),gen_pool_avail (pool->gen_pool));if (pool->cpumap)
Signature · 1 line
2.14.1
PATCH 2/5 net: ethernet: ti: cpts: Fix timestamp print
In reply to Florian FainelliOn 64-bit hosts we will get the following warning:
drivers/net/ethernet/ti/cpts.c: In function 'cpts_overflow_check':drivers/net/ethernet/ti/cpts.c:297:11: warning: format '%lld' expects argument of type 'long long int', but argument 3 has type '__kernel_time_t {aka long int}' [-Wformat=]
pr_debug("cpts overflow check at %lld.%09lu\n", ts.tv_sec,
ts.tv_nsec);
Fix this by using an appropriate casting that works on all bit sizes.
--- drivers/net/ethernet/ti/cpts.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/ti/cpts.c +2 -1
@@ -294,7 +294,8 @@ static long cpts_overflow_check(struct ptp_clock_info *ptp) delay =CPTS_SKB_TX_WORK_TIMEOUT ;spin_unlock_irqrestore (&cpts->lock, flags); -pr_debug ("cpts overflow check at %lld.%09lu\n" , ts.tv_sec, ts.tv_nsec); +pr_debug ("cpts overflow check at %lld.%09ld\n" , + (long long )ts.tv_sec, ts.tv_nsec);return (long )delay; }
Signature · 1 line
2.14.1
PATCH 3/5 net: ethernet: ti: cpsw: Fix cpsw_add_ch_strings() printk format
In reply to Florian FainelliWhen building on a 64-bit host we will get the following warning:
drivers/net/ethernet/ti/cpsw.c: In function 'cpsw_add_ch_strings':drivers/net/ethernet/ti/cpsw.c:1284:19: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
"%s DMA chan %d: %s", rx_dir ? "Rx" : "Tx",
~^
%ldFix this by using an %ld format and casting to long.
--- drivers/net/ethernet/ti/cpsw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/cpsw.c +2 -2
@@ -1281,8 +1281,8 @@ static void cpsw_add_ch_strings(u8 **p, int ch_num, int rx_dir)for (i =0 ; i < ch_stats_len; i++) { line = i %CPSW_STATS_CH_LEN ;snprintf (*p,ETH_GSTRING_LEN , -"%s DMA chan %d: %s" , rx_dir ?"Rx" :"Tx" , - i /CPSW_STATS_CH_LEN , +"%s DMA chan %ld: %s" , rx_dir ?"Rx" :"Tx" , + (long )(i /CPSW_STATS_CH_LEN ), cpsw_gstrings_ch_stats[line].stat_string); *p +=ETH_GSTRING_LEN ; }
Signature · 1 line
2.14.1
PATCH 4/5 net: ethernet: davinci_emac: Fix printing of base address
In reply to Florian FainelliUse %pa which is the correct formatter to print a physical address, instead of %p which is just a pointer.
--- drivers/net/ethernet/ti/davinci_emac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/davinci_emac.c +2 -2
@@ -1930,8 +1930,8 @@ static int davinci_emac_probe(struct platform_device *pdev)if (netif_msg_probe (priv)) {dev_notice (&pdev->dev,"DaVinci EMAC Probe found device " -"(regs: %p, irq: %d)\n" , - (void *)priv->emac_base_phys, ndev->irq); +"(regs: %pa, irq: %d)\n" , + &priv->emac_base_phys, ndev->irq); }pm_runtime_put (&pdev->dev);
Signature · 1 line
2.14.1
PATCH 5/5 ti: ethernet: davinci: Fix cast to int warnings
In reply to Florian FainelliNow that we can compile test this driver on 64-bit hosts, we get some warnings about how a pointer/address is written/read to/from a register (sw_token). Fix this by doing the appropriate conversions, we cannot possibly have the driver work on 64-bit hosts the way the tokens are managed though, since the registers being written to a 32-bit only.
--- drivers/net/ethernet/ti/davinci_cpdma.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/ti/davinci_cpdma.c +4 -4
@@ -1080,7 +1080,7 @@ int cpdma_chan_submit(struct cpdma_chan *chan, void *token, void *data,writel_relaxed (buffer, &desc->hw_buffer);writel_relaxed (len, &desc->hw_len);writel_relaxed (mode | len, &desc->hw_mode); -writel_relaxed (token, &desc->sw_token); +writel_relaxed ((uintptr_t )token, &desc->sw_token);writel_relaxed (buffer, &desc->sw_buffer);writel_relaxed (len, &desc->sw_len);desc_read (desc, sw_len);
@@ -1121,15 +1121,15 @@ static void __cpdma_chan_free(struct cpdma_chan *chan,struct cpdma_desc_pool *pool = ctlr->pool;dma_addr_t buff_dma;int origlen; -void *token; +uintptr_t token; - token = (void *)desc_read (desc, sw_token); + token =desc_read (desc, sw_token); buff_dma =desc_read (desc, sw_buffer); origlen =desc_read (desc, sw_len);dma_unmap_single (ctlr->dev, buff_dma, origlen, chan->dir);cpdma_desc_free (pool, desc,1 ); - (*chan->handler)(token, outlen, status); + (*chan->handler)((void *)token, outlen, status); }static int __cpdma_chan_process (struct cpdma_chan *chan)
Signature · 1 line
2.14.1
David Miller
maintainerFrom: Florian Fainelli <[email protected]>
Date: Mon, 21 May 2018 11:45:50 -0700
Quoted 7 lines
Hi all,
This patch series attempts to fix properly the warnings observed with turning on
COMPILE_TESTand TI Ethernet drivers on 64-bit hosts.Since I don't have any of this hardware, please review carefully for possible breakage!
These seem extremely safe to me, and since I have a vested interest in seeing these warning disappear from my tree....
Series applied, thanks :-)