[rtems commit] libchip: Avoid __DEVOLATILE()

Sebastian Huber sebh at rtems.org
Mon Mar 31 16:24:24 UTC 2014


Module:    rtems
Branch:    master
Commit:    8118b670655308ec1a39fda3fe33db2a6b55e667
Changeset: http://git.rtems.org/rtems/commit/?id=8118b670655308ec1a39fda3fe33db2a6b55e667

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Mar 31 18:30:44 2014 +0200

libchip: Avoid __DEVOLATILE()

---

 c/src/libchip/network/dwmac-desc-enh.c |   20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/c/src/libchip/network/dwmac-desc-enh.c b/c/src/libchip/network/dwmac-desc-enh.c
index bd1e77d..cb20ba4 100644
--- a/c/src/libchip/network/dwmac-desc-enh.c
+++ b/c/src/libchip/network/dwmac-desc-enh.c
@@ -705,8 +705,8 @@ static void dwmac_desc_enh_init_rx_desc(
 
 static int dwmac_desc_enh_destroy_rx_desc( dwmac_common_context *self )
 {
-  int   eno      = 0;
-  void *desc_mem = __DEVOLATILE( void *, self->dma_rx );
+  int                  eno    = 0;
+  volatile dwmac_desc *dma_rx = self->dma_rx;
 
 
   if ( self->mbuf_addr_rx != NULL ) {
@@ -714,10 +714,9 @@ static int dwmac_desc_enh_destroy_rx_desc( dwmac_common_context *self )
     self->mbuf_addr_rx = NULL;
   }
 
-  if ( desc_mem != NULL ) {
-    eno          = self->CFG->CALLBACK.mem_free_nocache( self->arg, desc_mem );
-    desc_mem     = NULL;
-    self->dma_rx = (volatile dwmac_desc *) desc_mem;
+  if ( dma_rx != NULL ) {
+    eno          = self->CFG->CALLBACK.mem_free_nocache( self->arg, dma_rx );
+    self->dma_rx = NULL;
   }
 
   DWMAC_COMMON_DSB();
@@ -742,8 +741,7 @@ static void dwmac_desc_enh_release_rx_bufs( dwmac_common_context *self )
 
       MFREE( self->mbuf_addr_rx[i], dummy );
       (void) dummy;
-      memset( __DEVOLATILE( void *,
-                            &p_enh[i].erx ), 0, sizeof( dwmac_desc_ext ) );
+      memset(&p_enh[i].erx, 0, sizeof( dwmac_desc_ext ) );
     }
   }
 
@@ -754,12 +752,12 @@ static void dwmac_desc_enh_release_rx_bufs( dwmac_common_context *self )
 static int dwmac_desc_enh_create_tx_desc( dwmac_common_context *self )
 {
   int          eno        = 0;
-  void        *mem_desc   = __DEVOLATILE( void *, self->dma_tx );
+  void        *mem_desc   = NULL;
   const size_t NUM_DESCS  = (size_t) self->bsd_config->xbuf_count;
   const size_t SIZE_DESCS = NUM_DESCS * sizeof( dwmac_desc_ext );
 
 
-  assert( mem_desc == NULL );
+  assert( self->dma_tx == NULL );
 
   /* Allocate an array of mbuf pointers */
   self->mbuf_addr_tx = calloc( NUM_DESCS, sizeof( struct mbuf * ) );
@@ -786,7 +784,7 @@ static int dwmac_desc_enh_create_tx_desc( dwmac_common_context *self )
   }
 
   if ( eno == 0 ) {
-    self->dma_tx = (volatile dwmac_desc *) mem_desc;
+    self->dma_tx = mem_desc;
     DWMAC_COMMON_DSB();
   }
 




More information about the vc mailing list