Skip to content

Commit da8ebba

Browse files
lrgirdwolgirdwood
authored andcommitted
alloc: update comments and log string to align with new API
Zone was mentioned in many comments and one log message. Fix this to remove zone references. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 6118d85 commit da8ebba

File tree

5 files changed

+8
-41
lines changed

5 files changed

+8
-41
lines changed

posix/include/rtos/alloc.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,29 +51,20 @@
5151

5252
/**
5353
* Allocates memory block.
54-
* @param zone Zone to allocate memory from, see enum mem_zone.
5554
* @param flags Flags, see SOF_MEM_FLAG_...
56-
* @param caps Capabilities, see SOF_MEM_CAPS_...
5755
* @param bytes Size in bytes.
5856
* @return Pointer to the allocated memory or NULL if failed.
59-
*
60-
* @note Do not use for buffers (SOF_MEM_ZONE_BUFFER zone).
61-
* Use rballoc(), rballoc_align() to allocate memory for buffers.
6257
*/
6358
void *rmalloc(uint32_t flags, size_t bytes);
6459

6560
/**
6661
* Similar to rmalloc(), guarantees that returned block is zeroed.
67-
*
68-
* @note Do not use for buffers (SOF_MEM_ZONE_BUFFER zone).
69-
* rballoc(), rballoc_align() to allocate memory for buffers.
7062
*/
7163
void *rzalloc(uint32_t flags, size_t bytes);
7264

7365
/**
74-
* Allocates memory block from SOF_MEM_ZONE_BUFFER.
66+
* Allocates memory block.
7567
* @param flags Flags, see SOF_MEM_FLAG_...
76-
* @param caps Capabilities, see SOF_MEM_CAPS_...
7768
* @param bytes Size in bytes.
7869
* @param alignment Alignment in bytes.
7970
* @return Pointer to the allocated memory or NULL if failed.
@@ -90,10 +81,9 @@ static inline void *rballoc(uint32_t flags, size_t bytes)
9081
}
9182

9283
/**
93-
* Changes size of the memory block allocated from SOF_MEM_ZONE_BUFFER.
84+
* Changes size of the memory block allocated.
9485
* @param ptr Address of the block to resize.
9586
* @param flags Flags, see SOF_MEM_FLAG_...
96-
* @param caps Capabilities, see SOF_MEM_CAPS_...
9787
* @param bytes New size in bytes.
9888
* @param old_bytes Old size in bytes.
9989
* @param alignment Alignment in bytes.
@@ -116,9 +106,6 @@ static inline void *rbrealloc(void *ptr, uint32_t flags,
116106
/**
117107
* Frees the memory block.
118108
* @param ptr Pointer to the memory block.
119-
*
120-
* @note Blocks from SOF_MEM_ZONE_SYS cannot be freed, such a call causes
121-
* panic.
122109
*/
123110
void rfree(void *ptr);
124111

src/include/sof/audio/component.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@ struct comp_ops {
321321
* @param spec Pointer to initialization data
322322
* @return Pointer to the new component device.
323323
*
324-
* All required data objects should be allocated from the run-time
325-
* heap (SOF_MEM_ZONE_RUNTIME).
326324
* Any component-specific private data is allocated separately and
327325
* pointer is connected to the comp_dev::private by using
328326
* comp_set_drvdata() and later retrieved by comp_get_drvdata().

src/include/sof/lib/dai-legacy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct sof_ipc_stream_params;
7676
* If a single DAI instance can have multiple DMA links and/or there is
7777
* some other possibility of the same instance being used in multiple
7878
* contexts at the same time, the private data should be allocated in the
79-
* SOF_MEM_ZONE_SHARED.
79+
* SOF_MEM_FLAG_COHERENT.
8080
*/
8181
struct dai_ops {
8282
int (*set_config)(struct dai *dai, struct ipc_config_dai *config,

zephyr/include/rtos/alloc.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,21 @@
4242

4343
/**
4444
* Allocates memory block.
45-
* @param zone Zone to allocate memory from, see enum mem_zone.
46-
* @param flags Flags, see SOF_MEM_FLAG_...
47-
* @param caps Capabilities, see SOF_MEM_CAPS_...
45+
* @param flags Flags, see SOF_MEM_FLAG_....
4846
* @param bytes Size in bytes.
4947
* @return Pointer to the allocated memory or NULL if failed.
5048
*
51-
* @note Do not use for buffers (SOF_MEM_ZONE_BUFFER zone).
52-
* Use rballoc(), rballoc_align() to allocate memory for buffers.
5349
*/
5450
void *rmalloc(uint32_t flags, size_t bytes);
5551

5652
/**
5753
* Similar to rmalloc(), guarantees that returned block is zeroed.
58-
*
59-
* @note Do not use for buffers (SOF_MEM_ZONE_BUFFER zone).
60-
* rballoc(), rballoc_align() to allocate memory for buffers.
6154
*/
6255
void *rzalloc(uint32_t flags, size_t bytes);
6356

6457
/**
65-
* Allocates memory block from SOF_MEM_ZONE_BUFFER.
58+
* Allocates memory block.
6659
* @param flags Flags, see SOF_MEM_FLAG_...
67-
* @param caps Capabilities, see SOF_MEM_CAPS_...
6860
* @param bytes Size in bytes.
6961
* @param alignment Alignment in bytes.
7062
* @return Pointer to the allocated memory or NULL if failed.
@@ -81,10 +73,9 @@ static inline void *rballoc(uint32_t flags, size_t bytes)
8173
}
8274

8375
/**
84-
* Changes size of the memory block allocated from SOF_MEM_ZONE_BUFFER.
76+
* Changes size of the memory block allocated.
8577
* @param ptr Address of the block to resize.
8678
* @param flags Flags, see SOF_MEM_FLAG_...
87-
* @param caps Capabilities, see SOF_MEM_CAPS_...
8879
* @param bytes New size in bytes.
8980
* @param old_bytes Old size in bytes.
9081
* @param alignment Alignment in bytes.
@@ -107,9 +98,6 @@ static inline void *rbrealloc(void *ptr, uint32_t flags,
10798
/**
10899
* Frees the memory block.
109100
* @param ptr Pointer to the memory block.
110-
*
111-
* @note Blocks from SOF_MEM_ZONE_SYS cannot be freed, such a call causes
112-
* panic.
113101
*/
114102
void rfree(void *ptr);
115103

zephyr/lib/alloc.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ void *rmalloc(uint32_t flags, size_t bytes)
385385
heap = &l3_heap;
386386
/* Uncached L3_HEAP should not be used */
387387
if (flags & SOF_MEM_FLAG_COHERENT) {
388-
tr_err(&zephyr_tr, "L3_HEAP available for cached zones only!");
388+
tr_err(&zephyr_tr, "L3_HEAP available for cached addresses only!");
389389
return NULL;
390390
}
391391
ptr = (__sparse_force void *)l3_heap_alloc_aligned(heap, 0, bytes);
@@ -412,14 +412,12 @@ void *rmalloc(uint32_t flags, size_t bytes)
412412
}
413413
EXPORT_SYMBOL(rmalloc);
414414

415-
/* Use SOF_MEM_ZONE_BUFFER at the moment */
416415
void *rbrealloc_align(void *ptr, uint32_t flags, size_t bytes,
417416
size_t old_bytes, uint32_t alignment)
418417
{
419418
void *new_ptr;
420419

421420
if (!ptr) {
422-
/* TODO: Use correct zone */
423421
return rballoc_align(flags, bytes, alignment);
424422
}
425423

@@ -446,9 +444,6 @@ void *rbrealloc_align(void *ptr, uint32_t flags, size_t bytes,
446444

447445
/**
448446
* Similar to rmalloc(), guarantees that returned block is zeroed.
449-
*
450-
* @note Do not use for buffers (SOF_MEM_ZONE_BUFFER zone).
451-
* rballoc(), rballoc_align() to allocate memory for buffers.
452447
*/
453448
void *rzalloc(uint32_t flags, size_t bytes)
454449
{
@@ -462,9 +457,8 @@ void *rzalloc(uint32_t flags, size_t bytes)
462457
EXPORT_SYMBOL(rzalloc);
463458

464459
/**
465-
* Allocates memory block from SOF_MEM_ZONE_BUFFER.
460+
* Allocates memory block.
466461
* @param flags see SOF_MEM_FLAG_...
467-
* @param caps Capabilities, see SOF_MEM_CAPS_...
468462
* @param bytes Size in bytes.
469463
* @param align Alignment in bytes.
470464
* @return Pointer to the allocated memory or NULL if failed.

0 commit comments

Comments
 (0)