Commit 9cb693f6 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman

staging: vt6655: replace typedef struct tagSRxDesc

with struct vnt_rx_desc and all members the same.

volatile is removed from pointers as this generates warning
message.

Only the first four members of vnt_rx_desc need to be volatile.
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 88defe2b
...@@ -564,7 +564,7 @@ CARDvSafeResetRx( ...@@ -564,7 +564,7 @@ CARDvSafeResetRx(
) )
{ {
unsigned int uu; unsigned int uu;
PSRxDesc pDesc; struct vnt_rx_desc *pDesc;
/* initialize RD index */ /* initialize RD index */
pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]); pDevice->pCurrRD[0] = &(pDevice->aRD0Ring[0]);
......
...@@ -195,16 +195,14 @@ struct vnt_rdes1 { ...@@ -195,16 +195,14 @@ struct vnt_rdes1 {
} __packed; } __packed;
/* Rx descriptor*/ /* Rx descriptor*/
typedef struct tagSRxDesc { struct vnt_rx_desc {
volatile struct vnt_rdes0 rd0; volatile struct vnt_rdes0 rd0;
volatile struct vnt_rdes1 rd1; volatile struct vnt_rdes1 rd1;
volatile __le32 buff_addr; volatile __le32 buff_addr;
volatile __le32 next_desc; volatile __le32 next_desc;
struct tagSRxDesc *next __aligned(8); struct vnt_rx_desc *next __aligned(8);
struct vnt_rd_info *rd_info __aligned(8); struct vnt_rd_info *rd_info __aligned(8);
} __attribute__ ((__packed__)) } __packed;
SRxDesc, *PSRxDesc;
typedef const SRxDesc *PCSRxDesc;
struct vnt_tdes0 { struct vnt_tdes0 {
volatile u8 tsr0; volatile u8 tsr0;
......
...@@ -258,9 +258,9 @@ struct vnt_private { ...@@ -258,9 +258,9 @@ struct vnt_private {
struct vnt_tx_desc *apTD0Rings; struct vnt_tx_desc *apTD0Rings;
struct vnt_tx_desc *apTD1Rings; struct vnt_tx_desc *apTD1Rings;
volatile PSRxDesc aRD0Ring; struct vnt_rx_desc *aRD0Ring;
volatile PSRxDesc aRD1Ring; struct vnt_rx_desc *aRD1Ring;
volatile PSRxDesc pCurrRD[TYPE_MAXRD]; struct vnt_rx_desc *pCurrRD[TYPE_MAXRD];
OPTIONS sOpts; OPTIONS sOpts;
......
...@@ -155,7 +155,7 @@ static void device_init_td1_ring(struct vnt_private *pDevice); ...@@ -155,7 +155,7 @@ static void device_init_td1_ring(struct vnt_private *pDevice);
static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx); static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx);
static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx); static int device_tx_srv(struct vnt_private *pDevice, unsigned int uIdx);
static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pDesc); static bool device_alloc_rx_buf(struct vnt_private *, struct vnt_rx_desc *);
static void device_init_registers(struct vnt_private *pDevice); static void device_init_registers(struct vnt_private *pDevice);
static void device_free_tx_buf(struct vnt_private *, struct vnt_tx_desc *); static void device_free_tx_buf(struct vnt_private *, struct vnt_tx_desc *);
static void device_free_td0_ring(struct vnt_private *pDevice); static void device_free_td0_ring(struct vnt_private *pDevice);
...@@ -520,8 +520,8 @@ static bool device_init_rings(struct vnt_private *pDevice) ...@@ -520,8 +520,8 @@ static bool device_init_rings(struct vnt_private *pDevice)
/*allocate all RD/TD rings a single pool*/ /*allocate all RD/TD rings a single pool*/
vir_pool = dma_zalloc_coherent(&pDevice->pcid->dev, vir_pool = dma_zalloc_coherent(&pDevice->pcid->dev,
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs0 * sizeof(struct vnt_rx_desc) +
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(struct vnt_rx_desc) +
pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc) + pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc) +
pDevice->sOpts.nTxDescs[1] * sizeof(struct vnt_tx_desc), pDevice->sOpts.nTxDescs[1] * sizeof(struct vnt_tx_desc),
&pDevice->pool_dma, GFP_ATOMIC); &pDevice->pool_dma, GFP_ATOMIC);
...@@ -532,11 +532,11 @@ static bool device_init_rings(struct vnt_private *pDevice) ...@@ -532,11 +532,11 @@ static bool device_init_rings(struct vnt_private *pDevice)
pDevice->aRD0Ring = vir_pool; pDevice->aRD0Ring = vir_pool;
pDevice->aRD1Ring = vir_pool + pDevice->aRD1Ring = vir_pool +
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc); pDevice->sOpts.nRxDescs0 * sizeof(struct vnt_rx_desc);
pDevice->rd0_pool_dma = pDevice->pool_dma; pDevice->rd0_pool_dma = pDevice->pool_dma;
pDevice->rd1_pool_dma = pDevice->rd0_pool_dma + pDevice->rd1_pool_dma = pDevice->rd0_pool_dma +
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc); pDevice->sOpts.nRxDescs0 * sizeof(struct vnt_rx_desc);
pDevice->tx0_bufs = dma_zalloc_coherent(&pDevice->pcid->dev, pDevice->tx0_bufs = dma_zalloc_coherent(&pDevice->pcid->dev,
pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ + pDevice->sOpts.nTxDescs[0] * PKT_BUF_SZ +
...@@ -549,8 +549,8 @@ static bool device_init_rings(struct vnt_private *pDevice) ...@@ -549,8 +549,8 @@ static bool device_init_rings(struct vnt_private *pDevice)
dev_err(&pDevice->pcid->dev, "allocate buf dma memory failed\n"); dev_err(&pDevice->pcid->dev, "allocate buf dma memory failed\n");
dma_free_coherent(&pDevice->pcid->dev, dma_free_coherent(&pDevice->pcid->dev,
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs0 * sizeof(struct vnt_rx_desc) +
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(struct vnt_rx_desc) +
pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc) + pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc) +
pDevice->sOpts.nTxDescs[1] * sizeof(struct vnt_tx_desc), pDevice->sOpts.nTxDescs[1] * sizeof(struct vnt_tx_desc),
vir_pool, pDevice->pool_dma vir_pool, pDevice->pool_dma
...@@ -559,19 +559,19 @@ static bool device_init_rings(struct vnt_private *pDevice) ...@@ -559,19 +559,19 @@ static bool device_init_rings(struct vnt_private *pDevice)
} }
pDevice->td0_pool_dma = pDevice->rd1_pool_dma + pDevice->td0_pool_dma = pDevice->rd1_pool_dma +
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc); pDevice->sOpts.nRxDescs1 * sizeof(struct vnt_rx_desc);
pDevice->td1_pool_dma = pDevice->td0_pool_dma + pDevice->td1_pool_dma = pDevice->td0_pool_dma +
pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc); pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc);
/* vir_pool: pvoid type */ /* vir_pool: pvoid type */
pDevice->apTD0Rings = vir_pool pDevice->apTD0Rings = vir_pool
+ pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs0 * sizeof(struct vnt_rx_desc)
+ pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc); + pDevice->sOpts.nRxDescs1 * sizeof(struct vnt_rx_desc);
pDevice->apTD1Rings = vir_pool pDevice->apTD1Rings = vir_pool
+ pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs0 * sizeof(struct vnt_rx_desc)
+ pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(struct vnt_rx_desc)
+ pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc); + pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc);
pDevice->tx1_bufs = pDevice->tx0_bufs + pDevice->tx1_bufs = pDevice->tx0_bufs +
...@@ -595,8 +595,8 @@ static bool device_init_rings(struct vnt_private *pDevice) ...@@ -595,8 +595,8 @@ static bool device_init_rings(struct vnt_private *pDevice)
static void device_free_rings(struct vnt_private *pDevice) static void device_free_rings(struct vnt_private *pDevice)
{ {
dma_free_coherent(&pDevice->pcid->dev, dma_free_coherent(&pDevice->pcid->dev,
pDevice->sOpts.nRxDescs0 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs0 * sizeof(struct vnt_rx_desc) +
pDevice->sOpts.nRxDescs1 * sizeof(SRxDesc) + pDevice->sOpts.nRxDescs1 * sizeof(struct vnt_rx_desc) +
pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc) + pDevice->sOpts.nTxDescs[0] * sizeof(struct vnt_tx_desc) +
pDevice->sOpts.nTxDescs[1] * sizeof(struct vnt_tx_desc) pDevice->sOpts.nTxDescs[1] * sizeof(struct vnt_tx_desc)
, ,
...@@ -617,10 +617,11 @@ static void device_init_rd0_ring(struct vnt_private *pDevice) ...@@ -617,10 +617,11 @@ static void device_init_rd0_ring(struct vnt_private *pDevice)
{ {
int i; int i;
dma_addr_t curr = pDevice->rd0_pool_dma; dma_addr_t curr = pDevice->rd0_pool_dma;
PSRxDesc pDesc; struct vnt_rx_desc *pDesc;
/* Init the RD0 ring entries */ /* Init the RD0 ring entries */
for (i = 0; i < pDevice->sOpts.nRxDescs0; i ++, curr += sizeof(SRxDesc)) { for (i = 0; i < pDevice->sOpts.nRxDescs0;
i ++, curr += sizeof(struct vnt_rx_desc)) {
pDesc = &(pDevice->aRD0Ring[i]); pDesc = &(pDevice->aRD0Ring[i]);
pDesc->rd_info = alloc_rd_info(); pDesc->rd_info = alloc_rd_info();
...@@ -628,7 +629,7 @@ static void device_init_rd0_ring(struct vnt_private *pDevice) ...@@ -628,7 +629,7 @@ static void device_init_rd0_ring(struct vnt_private *pDevice)
dev_err(&pDevice->pcid->dev, "can not alloc rx bufs\n"); dev_err(&pDevice->pcid->dev, "can not alloc rx bufs\n");
pDesc->next = &(pDevice->aRD0Ring[(i+1) % pDevice->sOpts.nRxDescs0]); pDesc->next = &(pDevice->aRD0Ring[(i+1) % pDevice->sOpts.nRxDescs0]);
pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc)); pDesc->next_desc = cpu_to_le32(curr + sizeof(struct vnt_rx_desc));
} }
if (i > 0) if (i > 0)
...@@ -640,10 +641,11 @@ static void device_init_rd1_ring(struct vnt_private *pDevice) ...@@ -640,10 +641,11 @@ static void device_init_rd1_ring(struct vnt_private *pDevice)
{ {
int i; int i;
dma_addr_t curr = pDevice->rd1_pool_dma; dma_addr_t curr = pDevice->rd1_pool_dma;
PSRxDesc pDesc; struct vnt_rx_desc *pDesc;
/* Init the RD1 ring entries */ /* Init the RD1 ring entries */
for (i = 0; i < pDevice->sOpts.nRxDescs1; i ++, curr += sizeof(SRxDesc)) { for (i = 0; i < pDevice->sOpts.nRxDescs1;
i ++, curr += sizeof(struct vnt_rx_desc)) {
pDesc = &(pDevice->aRD1Ring[i]); pDesc = &(pDevice->aRD1Ring[i]);
pDesc->rd_info = alloc_rd_info(); pDesc->rd_info = alloc_rd_info();
...@@ -651,7 +653,7 @@ static void device_init_rd1_ring(struct vnt_private *pDevice) ...@@ -651,7 +653,7 @@ static void device_init_rd1_ring(struct vnt_private *pDevice)
dev_err(&pDevice->pcid->dev, "can not alloc rx bufs\n"); dev_err(&pDevice->pcid->dev, "can not alloc rx bufs\n");
pDesc->next = &(pDevice->aRD1Ring[(i+1) % pDevice->sOpts.nRxDescs1]); pDesc->next = &(pDevice->aRD1Ring[(i+1) % pDevice->sOpts.nRxDescs1]);
pDesc->next_desc = cpu_to_le32(curr + sizeof(SRxDesc)); pDesc->next_desc = cpu_to_le32(curr + sizeof(struct vnt_rx_desc));
} }
if (i > 0) if (i > 0)
...@@ -664,7 +666,7 @@ static void device_free_rd0_ring(struct vnt_private *pDevice) ...@@ -664,7 +666,7 @@ static void device_free_rd0_ring(struct vnt_private *pDevice)
int i; int i;
for (i = 0; i < pDevice->sOpts.nRxDescs0; i++) { for (i = 0; i < pDevice->sOpts.nRxDescs0; i++) {
PSRxDesc pDesc = &(pDevice->aRD0Ring[i]); struct vnt_rx_desc *pDesc = &(pDevice->aRD0Ring[i]);
struct vnt_rd_info *rd_info = pDesc->rd_info; struct vnt_rd_info *rd_info = pDesc->rd_info;
dma_unmap_single(&pDevice->pcid->dev, rd_info->skb_dma, dma_unmap_single(&pDevice->pcid->dev, rd_info->skb_dma,
...@@ -681,7 +683,7 @@ static void device_free_rd1_ring(struct vnt_private *pDevice) ...@@ -681,7 +683,7 @@ static void device_free_rd1_ring(struct vnt_private *pDevice)
int i; int i;
for (i = 0; i < pDevice->sOpts.nRxDescs1; i++) { for (i = 0; i < pDevice->sOpts.nRxDescs1; i++) {
PSRxDesc pDesc = &(pDevice->aRD1Ring[i]); struct vnt_rx_desc *pDesc = &(pDevice->aRD1Ring[i]);
struct vnt_rd_info *rd_info = pDesc->rd_info; struct vnt_rd_info *rd_info = pDesc->rd_info;
dma_unmap_single(&pDevice->pcid->dev, rd_info->skb_dma, dma_unmap_single(&pDevice->pcid->dev, rd_info->skb_dma,
...@@ -774,7 +776,7 @@ static void device_free_td1_ring(struct vnt_private *pDevice) ...@@ -774,7 +776,7 @@ static void device_free_td1_ring(struct vnt_private *pDevice)
static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx) static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx)
{ {
PSRxDesc pRD; struct vnt_rx_desc *pRD;
int works = 0; int works = 0;
for (pRD = pDevice->pCurrRD[uIdx]; for (pRD = pDevice->pCurrRD[uIdx];
...@@ -801,7 +803,8 @@ static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx) ...@@ -801,7 +803,8 @@ static int device_rx_srv(struct vnt_private *pDevice, unsigned int uIdx)
return works; return works;
} }
static bool device_alloc_rx_buf(struct vnt_private *pDevice, PSRxDesc pRD) static bool device_alloc_rx_buf(struct vnt_private *pDevice,
struct vnt_rx_desc *pRD)
{ {
struct vnt_rd_info *pRDInfo = pRD->rd_info; struct vnt_rd_info *pRDInfo = pRD->rd_info;
......
...@@ -132,7 +132,7 @@ static bool vnt_rx_data(struct vnt_private *priv, struct sk_buff *skb, ...@@ -132,7 +132,7 @@ static bool vnt_rx_data(struct vnt_private *priv, struct sk_buff *skb,
return true; return true;
} }
bool vnt_receive_frame(struct vnt_private *priv, PSRxDesc curr_rd) bool vnt_receive_frame(struct vnt_private *priv, struct vnt_rx_desc *curr_rd)
{ {
struct vnt_rd_info *rd_info = curr_rd->rd_info; struct vnt_rd_info *rd_info = curr_rd->rd_info;
struct sk_buff *skb; struct sk_buff *skb;
......
...@@ -31,6 +31,6 @@ ...@@ -31,6 +31,6 @@
#include "device.h" #include "device.h"
bool vnt_receive_frame(struct vnt_private *priv, PSRxDesc curr_rd); bool vnt_receive_frame(struct vnt_private *priv, struct vnt_rx_desc *curr_rd);
#endif /* __RXTX_H__ */ #endif /* __RXTX_H__ */
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