Commit 1b444881 authored by Tobias Klauser's avatar Tobias Klauser Committed by David S. Miller

Altera TSE: Fix DMA secriptor length initialization

sgdma_descrip is a function name as well as the name of a struct. In
sgdma_initialize(), we should initialize the descriptor length field
with the actual length of a descriptor not with the size of the
function. In order to prevent such things from happening in the future,
rename the function to sgdma_setup_descrip().

Found by sparse which yields the following warning:

drivers/net/ethernet/altera/altera_sgdma.c:74:30: warning: expression using sizeof on a function
Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 014f1b20
...@@ -20,15 +20,15 @@ ...@@ -20,15 +20,15 @@
#include "altera_sgdmahw.h" #include "altera_sgdmahw.h"
#include "altera_sgdma.h" #include "altera_sgdma.h"
static void sgdma_descrip(struct sgdma_descrip *desc, static void sgdma_setup_descrip(struct sgdma_descrip *desc,
struct sgdma_descrip *ndesc, struct sgdma_descrip *ndesc,
dma_addr_t ndesc_phys, dma_addr_t ndesc_phys,
dma_addr_t raddr, dma_addr_t raddr,
dma_addr_t waddr, dma_addr_t waddr,
u16 length, u16 length,
int generate_eop, int generate_eop,
int rfixed, int rfixed,
int wfixed); int wfixed);
static int sgdma_async_write(struct altera_tse_private *priv, static int sgdma_async_write(struct altera_tse_private *priv,
struct sgdma_descrip *desc); struct sgdma_descrip *desc);
...@@ -71,7 +71,7 @@ int sgdma_initialize(struct altera_tse_private *priv) ...@@ -71,7 +71,7 @@ int sgdma_initialize(struct altera_tse_private *priv)
SGDMA_CTRLREG_INTEN | SGDMA_CTRLREG_INTEN |
SGDMA_CTRLREG_ILASTD; SGDMA_CTRLREG_ILASTD;
priv->sgdmadesclen = sizeof(sgdma_descrip); priv->sgdmadesclen = sizeof(struct sgdma_descrip);
INIT_LIST_HEAD(&priv->txlisthd); INIT_LIST_HEAD(&priv->txlisthd);
INIT_LIST_HEAD(&priv->rxlisthd); INIT_LIST_HEAD(&priv->rxlisthd);
...@@ -195,15 +195,15 @@ int sgdma_tx_buffer(struct altera_tse_private *priv, struct tse_buffer *buffer) ...@@ -195,15 +195,15 @@ int sgdma_tx_buffer(struct altera_tse_private *priv, struct tse_buffer *buffer)
if (sgdma_txbusy(priv)) if (sgdma_txbusy(priv))
return 0; return 0;
sgdma_descrip(cdesc, /* current descriptor */ sgdma_setup_descrip(cdesc, /* current descriptor */
ndesc, /* next descriptor */ ndesc, /* next descriptor */
sgdma_txphysaddr(priv, ndesc), sgdma_txphysaddr(priv, ndesc),
buffer->dma_addr, /* address of packet to xmit */ buffer->dma_addr, /* address of packet to xmit */
0, /* write addr 0 for tx dma */ 0, /* write addr 0 for tx dma */
buffer->len, /* length of packet */ buffer->len, /* length of packet */
SGDMA_CONTROL_EOP, /* Generate EOP */ SGDMA_CONTROL_EOP, /* Generate EOP */
0, /* read fixed */ 0, /* read fixed */
SGDMA_CONTROL_WR_FIXED); /* Generate SOP */ SGDMA_CONTROL_WR_FIXED); /* Generate SOP */
pktstx = sgdma_async_write(priv, cdesc); pktstx = sgdma_async_write(priv, cdesc);
...@@ -309,15 +309,15 @@ u32 sgdma_rx_status(struct altera_tse_private *priv) ...@@ -309,15 +309,15 @@ u32 sgdma_rx_status(struct altera_tse_private *priv)
/* Private functions */ /* Private functions */
static void sgdma_descrip(struct sgdma_descrip *desc, static void sgdma_setup_descrip(struct sgdma_descrip *desc,
struct sgdma_descrip *ndesc, struct sgdma_descrip *ndesc,
dma_addr_t ndesc_phys, dma_addr_t ndesc_phys,
dma_addr_t raddr, dma_addr_t raddr,
dma_addr_t waddr, dma_addr_t waddr,
u16 length, u16 length,
int generate_eop, int generate_eop,
int rfixed, int rfixed,
int wfixed) int wfixed)
{ {
/* Clear the next descriptor as not owned by hardware */ /* Clear the next descriptor as not owned by hardware */
u32 ctrl = ndesc->control; u32 ctrl = ndesc->control;
...@@ -367,15 +367,15 @@ static int sgdma_async_read(struct altera_tse_private *priv) ...@@ -367,15 +367,15 @@ static int sgdma_async_read(struct altera_tse_private *priv)
return 0; return 0;
} }
sgdma_descrip(cdesc, /* current descriptor */ sgdma_setup_descrip(cdesc, /* current descriptor */
ndesc, /* next descriptor */ ndesc, /* next descriptor */
sgdma_rxphysaddr(priv, ndesc), sgdma_rxphysaddr(priv, ndesc),
0, /* read addr 0 for rx dma */ 0, /* read addr 0 for rx dma */
rxbuffer->dma_addr, /* write addr for rx dma */ rxbuffer->dma_addr, /* write addr for rx dma */
0, /* read 'til EOP */ 0, /* read 'til EOP */
0, /* EOP: NA for rx dma */ 0, /* EOP: NA for rx dma */
0, /* read fixed: NA for rx dma */ 0, /* read fixed: NA for rx dma */
0); /* SOP: NA for rx DMA */ 0); /* SOP: NA for rx DMA */
dma_sync_single_for_device(priv->device, dma_sync_single_for_device(priv->device,
priv->rxdescphys, priv->rxdescphys,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment