diff options
author | Tobias Klauser <tobias.klauser@gmail.com> | 2014-04-28 17:23:01 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-04-30 16:12:21 -0400 |
commit | 1b4448815ee746f878ca4c6b8fffa23441f6d16c (patch) | |
tree | f0208c5a1c25ad413c60ae2d1631bb255664cf0e | |
parent | 014f1b20108dc2c0bb0777d8383654a089c790f8 (diff) |
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: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/altera/altera_sgdma.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/drivers/net/ethernet/altera/altera_sgdma.c b/drivers/net/ethernet/altera/altera_sgdma.c index 4bcdd34f5d24..9ce8630692b6 100644 --- a/drivers/net/ethernet/altera/altera_sgdma.c +++ b/drivers/net/ethernet/altera/altera_sgdma.c | |||
@@ -20,15 +20,15 @@ | |||
20 | #include "altera_sgdmahw.h" | 20 | #include "altera_sgdmahw.h" |
21 | #include "altera_sgdma.h" | 21 | #include "altera_sgdma.h" |
22 | 22 | ||
23 | static void sgdma_descrip(struct sgdma_descrip *desc, | 23 | static void sgdma_setup_descrip(struct sgdma_descrip *desc, |
24 | struct sgdma_descrip *ndesc, | 24 | struct sgdma_descrip *ndesc, |
25 | dma_addr_t ndesc_phys, | 25 | dma_addr_t ndesc_phys, |
26 | dma_addr_t raddr, | 26 | dma_addr_t raddr, |
27 | dma_addr_t waddr, | 27 | dma_addr_t waddr, |
28 | u16 length, | 28 | u16 length, |
29 | int generate_eop, | 29 | int generate_eop, |
30 | int rfixed, | 30 | int rfixed, |
31 | int wfixed); | 31 | int wfixed); |
32 | 32 | ||
33 | static int sgdma_async_write(struct altera_tse_private *priv, | 33 | static int sgdma_async_write(struct altera_tse_private *priv, |
34 | struct sgdma_descrip *desc); | 34 | struct sgdma_descrip *desc); |
@@ -71,7 +71,7 @@ int sgdma_initialize(struct altera_tse_private *priv) | |||
71 | SGDMA_CTRLREG_INTEN | | 71 | SGDMA_CTRLREG_INTEN | |
72 | SGDMA_CTRLREG_ILASTD; | 72 | SGDMA_CTRLREG_ILASTD; |
73 | 73 | ||
74 | priv->sgdmadesclen = sizeof(sgdma_descrip); | 74 | priv->sgdmadesclen = sizeof(struct sgdma_descrip); |
75 | 75 | ||
76 | INIT_LIST_HEAD(&priv->txlisthd); | 76 | INIT_LIST_HEAD(&priv->txlisthd); |
77 | INIT_LIST_HEAD(&priv->rxlisthd); | 77 | INIT_LIST_HEAD(&priv->rxlisthd); |
@@ -195,15 +195,15 @@ int sgdma_tx_buffer(struct altera_tse_private *priv, struct tse_buffer *buffer) | |||
195 | if (sgdma_txbusy(priv)) | 195 | if (sgdma_txbusy(priv)) |
196 | return 0; | 196 | return 0; |
197 | 197 | ||
198 | sgdma_descrip(cdesc, /* current descriptor */ | 198 | sgdma_setup_descrip(cdesc, /* current descriptor */ |
199 | ndesc, /* next descriptor */ | 199 | ndesc, /* next descriptor */ |
200 | sgdma_txphysaddr(priv, ndesc), | 200 | sgdma_txphysaddr(priv, ndesc), |
201 | buffer->dma_addr, /* address of packet to xmit */ | 201 | buffer->dma_addr, /* address of packet to xmit */ |
202 | 0, /* write addr 0 for tx dma */ | 202 | 0, /* write addr 0 for tx dma */ |
203 | buffer->len, /* length of packet */ | 203 | buffer->len, /* length of packet */ |
204 | SGDMA_CONTROL_EOP, /* Generate EOP */ | 204 | SGDMA_CONTROL_EOP, /* Generate EOP */ |
205 | 0, /* read fixed */ | 205 | 0, /* read fixed */ |
206 | SGDMA_CONTROL_WR_FIXED); /* Generate SOP */ | 206 | SGDMA_CONTROL_WR_FIXED); /* Generate SOP */ |
207 | 207 | ||
208 | pktstx = sgdma_async_write(priv, cdesc); | 208 | pktstx = sgdma_async_write(priv, cdesc); |
209 | 209 | ||
@@ -309,15 +309,15 @@ u32 sgdma_rx_status(struct altera_tse_private *priv) | |||
309 | 309 | ||
310 | 310 | ||
311 | /* Private functions */ | 311 | /* Private functions */ |
312 | static void sgdma_descrip(struct sgdma_descrip *desc, | 312 | static void sgdma_setup_descrip(struct sgdma_descrip *desc, |
313 | struct sgdma_descrip *ndesc, | 313 | struct sgdma_descrip *ndesc, |
314 | dma_addr_t ndesc_phys, | 314 | dma_addr_t ndesc_phys, |
315 | dma_addr_t raddr, | 315 | dma_addr_t raddr, |
316 | dma_addr_t waddr, | 316 | dma_addr_t waddr, |
317 | u16 length, | 317 | u16 length, |
318 | int generate_eop, | 318 | int generate_eop, |
319 | int rfixed, | 319 | int rfixed, |
320 | int wfixed) | 320 | int wfixed) |
321 | { | 321 | { |
322 | /* Clear the next descriptor as not owned by hardware */ | 322 | /* Clear the next descriptor as not owned by hardware */ |
323 | u32 ctrl = ndesc->control; | 323 | u32 ctrl = ndesc->control; |
@@ -367,15 +367,15 @@ static int sgdma_async_read(struct altera_tse_private *priv) | |||
367 | return 0; | 367 | return 0; |
368 | } | 368 | } |
369 | 369 | ||
370 | sgdma_descrip(cdesc, /* current descriptor */ | 370 | sgdma_setup_descrip(cdesc, /* current descriptor */ |
371 | ndesc, /* next descriptor */ | 371 | ndesc, /* next descriptor */ |
372 | sgdma_rxphysaddr(priv, ndesc), | 372 | sgdma_rxphysaddr(priv, ndesc), |
373 | 0, /* read addr 0 for rx dma */ | 373 | 0, /* read addr 0 for rx dma */ |
374 | rxbuffer->dma_addr, /* write addr for rx dma */ | 374 | rxbuffer->dma_addr, /* write addr for rx dma */ |
375 | 0, /* read 'til EOP */ | 375 | 0, /* read 'til EOP */ |
376 | 0, /* EOP: NA for rx dma */ | 376 | 0, /* EOP: NA for rx dma */ |
377 | 0, /* read fixed: NA for rx dma */ | 377 | 0, /* read fixed: NA for rx dma */ |
378 | 0); /* SOP: NA for rx DMA */ | 378 | 0); /* SOP: NA for rx DMA */ |
379 | 379 | ||
380 | dma_sync_single_for_device(priv->device, | 380 | dma_sync_single_for_device(priv->device, |
381 | priv->rxdescphys, | 381 | priv->rxdescphys, |