* [PATCH net v2] Altera TSE: Fix DMA secriptor length initialization
@ 2014-04-28 21:23 Tobias Klauser
2014-04-28 22:37 ` Vince Bridgers
2014-04-30 20:14 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Tobias Klauser @ 2014-04-28 21:23 UTC (permalink / raw)
To: Vince Bridgers, netdev; +Cc: nios2-dev
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>
---
v2: patchd rebase against current net tree
drivers/net/ethernet/altera/altera_sgdma.c | 74 +++++++++++++++---------------
1 file changed, 37 insertions(+), 37 deletions(-)
diff --git a/drivers/net/ethernet/altera/altera_sgdma.c b/drivers/net/ethernet/altera/altera_sgdma.c
index 4bcdd34..9ce8630 100644
--- a/drivers/net/ethernet/altera/altera_sgdma.c
+++ b/drivers/net/ethernet/altera/altera_sgdma.c
@@ -20,15 +20,15 @@
#include "altera_sgdmahw.h"
#include "altera_sgdma.h"
-static void sgdma_descrip(struct sgdma_descrip *desc,
- struct sgdma_descrip *ndesc,
- dma_addr_t ndesc_phys,
- dma_addr_t raddr,
- dma_addr_t waddr,
- u16 length,
- int generate_eop,
- int rfixed,
- int wfixed);
+static void sgdma_setup_descrip(struct sgdma_descrip *desc,
+ struct sgdma_descrip *ndesc,
+ dma_addr_t ndesc_phys,
+ dma_addr_t raddr,
+ dma_addr_t waddr,
+ u16 length,
+ int generate_eop,
+ int rfixed,
+ int wfixed);
static int sgdma_async_write(struct altera_tse_private *priv,
struct sgdma_descrip *desc);
@@ -71,7 +71,7 @@ int sgdma_initialize(struct altera_tse_private *priv)
SGDMA_CTRLREG_INTEN |
SGDMA_CTRLREG_ILASTD;
- priv->sgdmadesclen = sizeof(sgdma_descrip);
+ priv->sgdmadesclen = sizeof(struct sgdma_descrip);
INIT_LIST_HEAD(&priv->txlisthd);
INIT_LIST_HEAD(&priv->rxlisthd);
@@ -195,15 +195,15 @@ int sgdma_tx_buffer(struct altera_tse_private *priv, struct tse_buffer *buffer)
if (sgdma_txbusy(priv))
return 0;
- sgdma_descrip(cdesc, /* current descriptor */
- ndesc, /* next descriptor */
- sgdma_txphysaddr(priv, ndesc),
- buffer->dma_addr, /* address of packet to xmit */
- 0, /* write addr 0 for tx dma */
- buffer->len, /* length of packet */
- SGDMA_CONTROL_EOP, /* Generate EOP */
- 0, /* read fixed */
- SGDMA_CONTROL_WR_FIXED); /* Generate SOP */
+ sgdma_setup_descrip(cdesc, /* current descriptor */
+ ndesc, /* next descriptor */
+ sgdma_txphysaddr(priv, ndesc),
+ buffer->dma_addr, /* address of packet to xmit */
+ 0, /* write addr 0 for tx dma */
+ buffer->len, /* length of packet */
+ SGDMA_CONTROL_EOP, /* Generate EOP */
+ 0, /* read fixed */
+ SGDMA_CONTROL_WR_FIXED); /* Generate SOP */
pktstx = sgdma_async_write(priv, cdesc);
@@ -309,15 +309,15 @@ u32 sgdma_rx_status(struct altera_tse_private *priv)
/* Private functions */
-static void sgdma_descrip(struct sgdma_descrip *desc,
- struct sgdma_descrip *ndesc,
- dma_addr_t ndesc_phys,
- dma_addr_t raddr,
- dma_addr_t waddr,
- u16 length,
- int generate_eop,
- int rfixed,
- int wfixed)
+static void sgdma_setup_descrip(struct sgdma_descrip *desc,
+ struct sgdma_descrip *ndesc,
+ dma_addr_t ndesc_phys,
+ dma_addr_t raddr,
+ dma_addr_t waddr,
+ u16 length,
+ int generate_eop,
+ int rfixed,
+ int wfixed)
{
/* Clear the next descriptor as not owned by hardware */
u32 ctrl = ndesc->control;
@@ -367,15 +367,15 @@ static int sgdma_async_read(struct altera_tse_private *priv)
return 0;
}
- sgdma_descrip(cdesc, /* current descriptor */
- ndesc, /* next descriptor */
- sgdma_rxphysaddr(priv, ndesc),
- 0, /* read addr 0 for rx dma */
- rxbuffer->dma_addr, /* write addr for rx dma */
- 0, /* read 'til EOP */
- 0, /* EOP: NA for rx dma */
- 0, /* read fixed: NA for rx dma */
- 0); /* SOP: NA for rx DMA */
+ sgdma_setup_descrip(cdesc, /* current descriptor */
+ ndesc, /* next descriptor */
+ sgdma_rxphysaddr(priv, ndesc),
+ 0, /* read addr 0 for rx dma */
+ rxbuffer->dma_addr, /* write addr for rx dma */
+ 0, /* read 'til EOP */
+ 0, /* EOP: NA for rx dma */
+ 0, /* read fixed: NA for rx dma */
+ 0); /* SOP: NA for rx DMA */
dma_sync_single_for_device(priv->device,
priv->rxdescphys,
--
1.9.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] Altera TSE: Fix DMA secriptor length initialization
2014-04-28 21:23 [PATCH net v2] Altera TSE: Fix DMA secriptor length initialization Tobias Klauser
@ 2014-04-28 22:37 ` Vince Bridgers
2014-04-29 7:05 ` Tobias Klauser
2014-04-30 20:14 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Vince Bridgers @ 2014-04-28 22:37 UTC (permalink / raw)
To: Tobias Klauser; +Cc: netdev@vger.kernel.org, nios2-dev
On Mon, Apr 28, 2014 at 4:23 PM, Tobias Klauser
<tobias.klauser@gmail.com> wrote:
> 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>
> ---
> v2: patchd rebase against current net tree
>
Thanks for the patch Tobias. Was the misspelling in the subject line
an oversight (secriptor -> descriptor) ?
All the best,
Vince
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] Altera TSE: Fix DMA secriptor length initialization
2014-04-28 22:37 ` Vince Bridgers
@ 2014-04-29 7:05 ` Tobias Klauser
2014-04-29 17:52 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Tobias Klauser @ 2014-04-29 7:05 UTC (permalink / raw)
To: Vince Bridgers; +Cc: netdev@vger.kernel.org, nios2-dev
On 29 April 2014 00:37, Vince Bridgers <vbridgers2013@gmail.com> wrote:
> On Mon, Apr 28, 2014 at 4:23 PM, Tobias Klauser
> <tobias.klauser@gmail.com> wrote:
>> 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>
>> ---
>> v2: patchd rebase against current net tree
>>
>
> Thanks for the patch Tobias. Was the misspelling in the subject line
> an oversight (secriptor -> descriptor) ?
Yes, this was an oversight, sorry. Thanks for pointing out.
Dave, shall I send an updated patch with the correct subject line or can
you fix it up before applying?
Thanks
Tobias
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] Altera TSE: Fix DMA secriptor length initialization
2014-04-29 7:05 ` Tobias Klauser
@ 2014-04-29 17:52 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-04-29 17:52 UTC (permalink / raw)
To: tobias.klauser; +Cc: vbridgers2013, netdev, nios2-dev
From: Tobias Klauser <tobias.klauser@gmail.com>
Date: Tue, 29 Apr 2014 09:05:21 +0200
> Dave, shall I send an updated patch with the correct subject line or can
> you fix it up before applying?
I can take care of it, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net v2] Altera TSE: Fix DMA secriptor length initialization
2014-04-28 21:23 [PATCH net v2] Altera TSE: Fix DMA secriptor length initialization Tobias Klauser
2014-04-28 22:37 ` Vince Bridgers
@ 2014-04-30 20:14 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2014-04-30 20:14 UTC (permalink / raw)
To: tobias.klauser; +Cc: vbridgers2013, netdev, nios2-dev
From: Tobias Klauser <tobias.klauser@gmail.com>
Date: Mon, 28 Apr 2014 23:23:01 +0200
> 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>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-04-30 20:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-28 21:23 [PATCH net v2] Altera TSE: Fix DMA secriptor length initialization Tobias Klauser
2014-04-28 22:37 ` Vince Bridgers
2014-04-29 7:05 ` Tobias Klauser
2014-04-29 17:52 ` David Miller
2014-04-30 20:14 ` 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).