All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/5] TI Ethernet driver warnings fixes
@ 2018-05-21 18:45 ` Florian Fainelli
  0 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER (CPSW),
	open list

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(-)

-- 
2.14.1

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

* [PATCH net-next 0/5] TI Ethernet driver warnings fixes
@ 2018-05-21 18:45 ` Florian Fainelli
  0 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER CPSW, open list

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(-)

-- 
2.14.1

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

* [PATCH net-next 1/5] ti: ethernet: cpdma: Use correct format for genpool_*
  2018-05-21 18:45 ` Florian Fainelli
@ 2018-05-21 18:45   ` Florian Fainelli
  -1 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER (CPSW),
	open list

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.

Fixes: aeec3021043b ("net: ethernet: ti: cpdma: remove used_desc counter")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/davinci_cpdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 31ae04117f0a..9ec49213de5e 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -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)
-- 
2.14.1

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

* [PATCH net-next 1/5] ti: ethernet: cpdma: Use correct format for genpool_*
@ 2018-05-21 18:45   ` Florian Fainelli
  0 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER CPSW, open list

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.

Fixes: aeec3021043b ("net: ethernet: ti: cpdma: remove used_desc counter")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/davinci_cpdma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 31ae04117f0a..9ec49213de5e 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -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)
-- 
2.14.1

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

* [PATCH net-next 2/5] net: ethernet: ti: cpts: Fix timestamp print
  2018-05-21 18:45 ` Florian Fainelli
@ 2018-05-21 18:45   ` Florian Fainelli
  -1 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER (CPSW),
	open list

On 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.

Fixes: a5c79c26e168 ("ptp: cpts: convert to the 64 bit get/set time methods.")
Fixes: 87c0e764d43a ("cpts: introduce time stamping code and a PTP hardware clock.")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/cpts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index 7842f094f2ef..6f63c8729afc 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -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;
 }
 
-- 
2.14.1

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

* [PATCH net-next 2/5] net: ethernet: ti: cpts: Fix timestamp print
@ 2018-05-21 18:45   ` Florian Fainelli
  0 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER CPSW, open list

On 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.

Fixes: a5c79c26e168 ("ptp: cpts: convert to the 64 bit get/set time methods.")
Fixes: 87c0e764d43a ("cpts: introduce time stamping code and a PTP hardware clock.")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/cpts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c
index 7842f094f2ef..6f63c8729afc 100644
--- a/drivers/net/ethernet/ti/cpts.c
+++ b/drivers/net/ethernet/ti/cpts.c
@@ -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;
 }
 
-- 
2.14.1

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

* [PATCH net-next 3/5] net: ethernet: ti: cpsw: Fix cpsw_add_ch_strings() printk format
  2018-05-21 18:45 ` Florian Fainelli
@ 2018-05-21 18:45   ` Florian Fainelli
  -1 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER (CPSW),
	open list

When 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",
                  ~^
                  %ld

Fix this by using an %ld format and casting to long.

Fixes: e05107e6b747 ("net: ethernet: ti: cpsw: add multi queue support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/cpsw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index a7285dddfd29..643cd2d9dfb6 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -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;
 	}
-- 
2.14.1

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

* [PATCH net-next 3/5] net: ethernet: ti: cpsw: Fix cpsw_add_ch_strings() printk format
@ 2018-05-21 18:45   ` Florian Fainelli
  0 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER CPSW, open list

When 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",
                  ~^
                  %ld

Fix this by using an %ld format and casting to long.

Fixes: e05107e6b747 ("net: ethernet: ti: cpsw: add multi queue support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/cpsw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index a7285dddfd29..643cd2d9dfb6 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -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;
 	}
-- 
2.14.1

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

* [PATCH net-next 4/5] net: ethernet: davinci_emac: Fix printing of base address
  2018-05-21 18:45 ` Florian Fainelli
@ 2018-05-21 18:45   ` Florian Fainelli
  -1 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER (CPSW),
	open list

Use %pa which is the correct formatter to print a physical address,
instead of %p which is just a pointer.

Fixes: a6286ee630f6 ("net: Add TI DaVinci EMAC driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/davinci_emac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index abceea802ea1..be0fec17d95d 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -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);
 
-- 
2.14.1

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

* [PATCH net-next 4/5] net: ethernet: davinci_emac: Fix printing of base address
@ 2018-05-21 18:45   ` Florian Fainelli
  0 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER CPSW, open list

Use %pa which is the correct formatter to print a physical address,
instead of %p which is just a pointer.

Fixes: a6286ee630f6 ("net: Add TI DaVinci EMAC driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/davinci_emac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
index abceea802ea1..be0fec17d95d 100644
--- a/drivers/net/ethernet/ti/davinci_emac.c
+++ b/drivers/net/ethernet/ti/davinci_emac.c
@@ -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);
 
-- 
2.14.1

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

* [PATCH net-next 5/5] ti: ethernet: davinci: Fix cast to int warnings
  2018-05-21 18:45 ` Florian Fainelli
@ 2018-05-21 18:45   ` Florian Fainelli
  -1 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER (CPSW),
	open list

Now 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.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/davinci_cpdma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 9ec49213de5e..cdbddf16dd29 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -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)
-- 
2.14.1

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

* [PATCH net-next 5/5] ti: ethernet: davinci: Fix cast to int warnings
@ 2018-05-21 18:45   ` Florian Fainelli
  0 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2018-05-21 18:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Andrew Morton, Keerthy, Bhumika Goyal,
	Hernán Gonzalez, Richard Cochran, Lukas Wunner, Rob Herring,
	open list:TI ETHERNET SWITCH DRIVER CPSW, open list

Now 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.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/ti/davinci_cpdma.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ti/davinci_cpdma.c b/drivers/net/ethernet/ti/davinci_cpdma.c
index 9ec49213de5e..cdbddf16dd29 100644
--- a/drivers/net/ethernet/ti/davinci_cpdma.c
+++ b/drivers/net/ethernet/ti/davinci_cpdma.c
@@ -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)
-- 
2.14.1

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

* Re: [PATCH net-next 0/5] TI Ethernet driver warnings fixes
  2018-05-21 18:45 ` Florian Fainelli
                   ` (5 preceding siblings ...)
  (?)
@ 2018-05-21 20:18 ` David Miller
  -1 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2018-05-21 20:18 UTC (permalink / raw)
  To: f.fainelli
  Cc: netdev, grygorii.strashko, ivan.khoronzhuk, akpm, j-keerthy,
	bhumirks, hernan, richardcochran, lukas, robh, linux-omap,
	linux-kernel

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Mon, 21 May 2018 11:45:50 -0700

> 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!

These seem extremely safe to me, and since I have a vested interest in seeing
these warning disappear from my tree....

Series applied, thanks :-)

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

end of thread, other threads:[~2018-05-21 20:18 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-21 18:45 [PATCH net-next 0/5] TI Ethernet driver warnings fixes Florian Fainelli
2018-05-21 18:45 ` Florian Fainelli
2018-05-21 18:45 ` [PATCH net-next 1/5] ti: ethernet: cpdma: Use correct format for genpool_* Florian Fainelli
2018-05-21 18:45   ` Florian Fainelli
2018-05-21 18:45 ` [PATCH net-next 2/5] net: ethernet: ti: cpts: Fix timestamp print Florian Fainelli
2018-05-21 18:45   ` Florian Fainelli
2018-05-21 18:45 ` [PATCH net-next 3/5] net: ethernet: ti: cpsw: Fix cpsw_add_ch_strings() printk format Florian Fainelli
2018-05-21 18:45   ` Florian Fainelli
2018-05-21 18:45 ` [PATCH net-next 4/5] net: ethernet: davinci_emac: Fix printing of base address Florian Fainelli
2018-05-21 18:45   ` Florian Fainelli
2018-05-21 18:45 ` [PATCH net-next 5/5] ti: ethernet: davinci: Fix cast to int warnings Florian Fainelli
2018-05-21 18:45   ` Florian Fainelli
2018-05-21 20:18 ` [PATCH net-next 0/5] TI Ethernet driver warnings fixes David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.