netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: eth: altera: Remove sgdmadesclen member from altera_tse_private
@ 2015-08-10 10:26 Tobias Klauser
  2015-08-11  4:12 ` David Miller
  2015-08-12 21:31 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Tobias Klauser @ 2015-08-10 10:26 UTC (permalink / raw)
  To: Vince Bridgers, netdev; +Cc: nios2-dev

altera_tse_private->sgdmadesclen is always assigned assigned the same
value and never changes during runtime.  Remove the struct member and
use a new define for sizeof(struct sgdma_descrip) instead.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 drivers/net/ethernet/altera/altera_sgdma.c   | 8 +++-----
 drivers/net/ethernet/altera/altera_sgdmahw.h | 1 +
 drivers/net/ethernet/altera/altera_tse.h     | 1 -
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/altera/altera_sgdma.c b/drivers/net/ethernet/altera/altera_sgdma.c
index 580553d..88ef67a 100644
--- a/drivers/net/ethernet/altera/altera_sgdma.c
+++ b/drivers/net/ethernet/altera/altera_sgdma.c
@@ -71,8 +71,6 @@ int sgdma_initialize(struct altera_tse_private *priv)
 		      SGDMA_CTRLREG_INTEN |
 		      SGDMA_CTRLREG_ILASTD;
 
-	priv->sgdmadesclen = sizeof(struct sgdma_descrip);
-
 	INIT_LIST_HEAD(&priv->txlisthd);
 	INIT_LIST_HEAD(&priv->rxlisthd);
 
@@ -254,7 +252,7 @@ u32 sgdma_rx_status(struct altera_tse_private *priv)
 		unsigned int pktstatus = 0;
 		dma_sync_single_for_cpu(priv->device,
 					priv->rxdescphys,
-					priv->sgdmadesclen,
+					SGDMA_DESC_LEN,
 					DMA_FROM_DEVICE);
 
 		pktlength = csrrd16(desc, sgdma_descroffs(bytes_xferred));
@@ -374,7 +372,7 @@ static int sgdma_async_read(struct altera_tse_private *priv)
 
 		dma_sync_single_for_device(priv->device,
 					   priv->rxdescphys,
-					   priv->sgdmadesclen,
+					   SGDMA_DESC_LEN,
 					   DMA_TO_DEVICE);
 
 		csrwr32(lower_32_bits(sgdma_rxphysaddr(priv, cdesc)),
@@ -402,7 +400,7 @@ static int sgdma_async_write(struct altera_tse_private *priv,
 	csrwr32(0x1f, priv->tx_dma_csr, sgdma_csroffs(status));
 
 	dma_sync_single_for_device(priv->device, priv->txdescphys,
-				   priv->sgdmadesclen, DMA_TO_DEVICE);
+				   SGDMA_DESC_LEN, DMA_TO_DEVICE);
 
 	csrwr32(lower_32_bits(sgdma_txphysaddr(priv, desc)),
 		priv->tx_dma_csr,
diff --git a/drivers/net/ethernet/altera/altera_sgdmahw.h b/drivers/net/ethernet/altera/altera_sgdmahw.h
index 85bc33b..bbd52f0 100644
--- a/drivers/net/ethernet/altera/altera_sgdmahw.h
+++ b/drivers/net/ethernet/altera/altera_sgdmahw.h
@@ -50,6 +50,7 @@ struct sgdma_descrip {
 	u8	control;
 } __packed;
 
+#define SGDMA_DESC_LEN	sizeof(struct sgdma_descrip)
 
 #define SGDMA_STATUS_ERR		BIT(0)
 #define SGDMA_STATUS_LENGTH_ERR		BIT(1)
diff --git a/drivers/net/ethernet/altera/altera_tse.h b/drivers/net/ethernet/altera/altera_tse.h
index 2adb24d..103c30d 100644
--- a/drivers/net/ethernet/altera/altera_tse.h
+++ b/drivers/net/ethernet/altera/altera_tse.h
@@ -458,7 +458,6 @@ struct altera_tse_private {
 	u32 rxctrlreg;
 	dma_addr_t rxdescphys;
 	dma_addr_t txdescphys;
-	size_t sgdmadesclen;
 
 	struct list_head txlisthd;
 	struct list_head rxlisthd;
-- 
2.5.0

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

* Re: [PATCH] net: eth: altera: Remove sgdmadesclen member from altera_tse_private
  2015-08-10 10:26 [PATCH] net: eth: altera: Remove sgdmadesclen member from altera_tse_private Tobias Klauser
@ 2015-08-11  4:12 ` David Miller
  2015-08-12 21:31 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-08-11  4:12 UTC (permalink / raw)
  To: tklauser; +Cc: vbridger, netdev, nios2-dev

From: Tobias Klauser <tklauser@distanz.ch>
Date: Mon, 10 Aug 2015 12:26:32 +0200

> altera_tse_private->sgdmadesclen is always assigned assigned the same
> value and never changes during runtime.  Remove the struct member and
> use a new define for sizeof(struct sgdma_descrip) instead.
> 
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

I think the intention was to use different descriptor sizes in the future.

Vince?

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

* Re: [PATCH] net: eth: altera: Remove sgdmadesclen member from altera_tse_private
  2015-08-10 10:26 [PATCH] net: eth: altera: Remove sgdmadesclen member from altera_tse_private Tobias Klauser
  2015-08-11  4:12 ` David Miller
@ 2015-08-12 21:31 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-08-12 21:31 UTC (permalink / raw)
  To: tklauser; +Cc: vbridger, netdev, nios2-dev

From: Tobias Klauser <tklauser@distanz.ch>
Date: Mon, 10 Aug 2015 12:26:32 +0200

> altera_tse_private->sgdmadesclen is always assigned assigned the same
> value and never changes during runtime.  Remove the struct member and
> use a new define for sizeof(struct sgdma_descrip) instead.
> 
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

No feedback from Vince about whether this was intended to be used in
some way or not, so I'm applying this to net-next, thanks Tobias.

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

end of thread, other threads:[~2015-08-12 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-10 10:26 [PATCH] net: eth: altera: Remove sgdmadesclen member from altera_tse_private Tobias Klauser
2015-08-11  4:12 ` David Miller
2015-08-12 21:31 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).