[rtems commit] bdbuf: Use rtems_cache_aligned_malloc()

Sebastian Huber sebh at rtems.org
Tue Nov 25 15:19:51 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Nov 25 16:12:59 2014 +0100

bdbuf: Use rtems_cache_aligned_malloc()

---

 cpukit/libblock/src/bdbuf.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c
index e1ed039..bae57e2 100644
--- a/cpukit/libblock/src/bdbuf.c
+++ b/cpukit/libblock/src/bdbuf.c
@@ -19,7 +19,7 @@
  *    Rewritten to remove score mutex access. Fixes many performance
  *    issues.
  *
- * Copyright (c) 2009-2012 embedded brains GmbH.
+ * Copyright (c) 2009-2014 embedded brains GmbH.
  */
 
 /**
@@ -39,7 +39,6 @@
 
 #include <rtems.h>
 #include <rtems/error.h>
-#include <rtems/malloc.h>
 
 #include "rtems/bdbuf.h"
 
@@ -1599,14 +1598,12 @@ rtems_bdbuf_do_init (void)
 
   /*
    * Allocate memory for buffer memory. The buffer memory will be cache
-   * aligned. It is possible to free the memory allocated by rtems_memalign()
-   * with free(). Return 0 if allocated.
-   *
-   * The memory allocate allows a
+   * aligned. It is possible to free the memory allocated by
+   * rtems_cache_aligned_malloc() with free().
    */
-  if (rtems_memalign ((void **) &bdbuf_cache.buffers,
-                      rtems_cache_get_data_line_size(),
-                      bdbuf_cache.buffer_min_count * bdbuf_config.buffer_min) != 0)
+  bdbuf_cache.buffers = rtems_cache_aligned_malloc(bdbuf_cache.buffer_min_count
+                                                   * bdbuf_config.buffer_min);
+  if (bdbuf_cache.buffers == NULL)
     goto error;
 
   /*




More information about the vc mailing list