mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: rtl8169: add missing casts
@ 2015-02-13 19:38 Lucas Stach
  2015-02-16  6:07 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2015-02-13 19:38 UTC (permalink / raw)
  To: barebox

Those explicit casts are needed to shut up some compiler
warnings.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
Sascha, please apply this to master.
The warnings fixed were introduced with
36138c6e1b (net: rtl8169: remove unnecessary cache maintenance)
---
 drivers/net/rtl8169.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 19f5763..bd3e5c0 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -236,8 +236,8 @@ static void rtl8169_init_ring(struct rtl8169_priv *priv)
 	dma_clean_range((unsigned long)priv->rx_buf,
 			(unsigned long)priv->rx_buf + NUM_RX_DESC * PKT_BUF_SIZE);
 
-	memset(priv->tx_desc, 0, NUM_TX_DESC * sizeof(struct bufdesc));
-	memset(priv->rx_desc, 0, NUM_RX_DESC * sizeof(struct bufdesc));
+	memset((void *)priv->tx_desc, 0, NUM_TX_DESC * sizeof(struct bufdesc));
+	memset((void *)priv->rx_desc, 0, NUM_RX_DESC * sizeof(struct bufdesc));
 
 	for (i = 0; i < NUM_RX_DESC; i++) {
 		if (i == (NUM_RX_DESC - 1))
@@ -275,9 +275,9 @@ static void rtl8169_hw_start(struct rtl8169_priv *priv)
 	/* Set DMA burst size and Interframe Gap Time */
 	RTL_W32(priv, TxConfig, (6 << TxDMAShift) | (3 << TxInterFrameGapShift));
 
-	RTL_W32(priv, TxDescStartAddrLow, virt_to_phys(priv->tx_desc));
+	RTL_W32(priv, TxDescStartAddrLow, virt_to_phys((void *)priv->tx_desc));
 	RTL_W32(priv, TxDescStartAddrHigh, 0);
-	RTL_W32(priv, RxDescStartAddrLow, virt_to_phys(priv->rx_desc));
+	RTL_W32(priv, RxDescStartAddrLow, virt_to_phys((void *)priv->rx_desc));
 	RTL_W32(priv, RxDescStartAddrHigh, 0);
 
 	/* RTL-8169sc/8110sc or later version */
@@ -363,8 +363,8 @@ static int rtl8169_eth_send(struct eth_device *edev, void *packet,
 	entry = priv->cur_tx % NUM_TX_DESC;
 
 	if (packet_length < ETH_ZLEN)
-		memset(priv->tx_buf + entry * PKT_BUF_SIZE, 0, ETH_ZLEN);
-	memcpy(priv->tx_buf + entry * PKT_BUF_SIZE, packet, packet_length);
+		memset((void *)priv->tx_buf + entry * PKT_BUF_SIZE, 0, ETH_ZLEN);
+	memcpy((void *)priv->tx_buf + entry * PKT_BUF_SIZE, packet, packet_length);
 	dma_flush_range((unsigned long)priv->tx_buf + entry * PKT_BUF_SIZE,
 			(unsigned long)priv->tx_buf + (entry + 1) * PKT_BUF_SIZE);
 
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] net: rtl8169: add missing casts
  2015-02-13 19:38 [PATCH] net: rtl8169: add missing casts Lucas Stach
@ 2015-02-16  6:07 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2015-02-16  6:07 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Fri, Feb 13, 2015 at 08:38:34PM +0100, Lucas Stach wrote:
> Those explicit casts are needed to shut up some compiler
> warnings.
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
> Sascha, please apply this to master.
> The warnings fixed were introduced with
> 36138c6e1b (net: rtl8169: remove unnecessary cache maintenance)
> ---
>  drivers/net/rtl8169.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
> index 19f5763..bd3e5c0 100644
> --- a/drivers/net/rtl8169.c
> +++ b/drivers/net/rtl8169.c
> @@ -236,8 +236,8 @@ static void rtl8169_init_ring(struct rtl8169_priv *priv)
>  	dma_clean_range((unsigned long)priv->rx_buf,
>  			(unsigned long)priv->rx_buf + NUM_RX_DESC * PKT_BUF_SIZE);
>  
> -	memset(priv->tx_desc, 0, NUM_TX_DESC * sizeof(struct bufdesc));
> -	memset(priv->rx_desc, 0, NUM_RX_DESC * sizeof(struct bufdesc));
> +	memset((void *)priv->tx_desc, 0, NUM_TX_DESC * sizeof(struct bufdesc));
> +	memset((void *)priv->rx_desc, 0, NUM_RX_DESC * sizeof(struct bufdesc));
>  
>  	for (i = 0; i < NUM_RX_DESC; i++) {
>  		if (i == (NUM_RX_DESC - 1))
> @@ -275,9 +275,9 @@ static void rtl8169_hw_start(struct rtl8169_priv *priv)
>  	/* Set DMA burst size and Interframe Gap Time */
>  	RTL_W32(priv, TxConfig, (6 << TxDMAShift) | (3 << TxInterFrameGapShift));
>  
> -	RTL_W32(priv, TxDescStartAddrLow, virt_to_phys(priv->tx_desc));
> +	RTL_W32(priv, TxDescStartAddrLow, virt_to_phys((void *)priv->tx_desc));
>  	RTL_W32(priv, TxDescStartAddrHigh, 0);
> -	RTL_W32(priv, RxDescStartAddrLow, virt_to_phys(priv->rx_desc));
> +	RTL_W32(priv, RxDescStartAddrLow, virt_to_phys((void *)priv->rx_desc));

Maybe virt_to_phys should take a volatile void * like in the kernel?

>  	RTL_W32(priv, RxDescStartAddrHigh, 0);
>  
>  	/* RTL-8169sc/8110sc or later version */
> @@ -363,8 +363,8 @@ static int rtl8169_eth_send(struct eth_device *edev, void *packet,
>  	entry = priv->cur_tx % NUM_TX_DESC;
>  
>  	if (packet_length < ETH_ZLEN)
> -		memset(priv->tx_buf + entry * PKT_BUF_SIZE, 0, ETH_ZLEN);
> -	memcpy(priv->tx_buf + entry * PKT_BUF_SIZE, packet, packet_length);
> +		memset((void *)priv->tx_buf + entry * PKT_BUF_SIZE, 0, ETH_ZLEN);
> +	memcpy((void *)priv->tx_buf + entry * PKT_BUF_SIZE, packet, packet_length);

tx_buf already is a void *. Why has this to be casted?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2015-02-16  6:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13 19:38 [PATCH] net: rtl8169: add missing casts Lucas Stach
2015-02-16  6:07 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox