Skip to content

Conversation

@kv2019i
Copy link
Collaborator

@kv2019i kv2019i commented Jul 3, 2025

Add "sof_" namespace to dma_get()/put() in the Zephyr native drivers builds. The main "struct dma" is also renamed, so this touches quite many places in code.

V2 of #9728. Now that XTOS code is removed (see #9983 ), this is now a very simple patch. No need for ugly typedefs anymore.

I ketp the NATIVE_DRIVERS bits still in the codebase, but that's obviously the next bit that can be removed (along with dai-legacy.c and host-legacy.c -- and their dependencies).

Add "sof_" namespace to dma_get()/put() in the Zephyr native
drivers builds. The main "struct dma" is also renamed, so this touches
quite many places in code.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Copilot AI review requested due to automatic review settings July 3, 2025 11:31
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR renames the Zephyr DMA structures and functions by adding a sof_ prefix to avoid naming conflicts with native drivers.

  • Renamed struct dma to struct sof_dma throughout the codebase.
  • Updated sof_dma_get/sof_dma_put function signatures and calls.
  • Adjusted DMA array definitions and cache initialization casts for the new type.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
zephyr/lib/dma.c Renamed struct dma dma[] to struct sof_dma dma[].
zephyr/include/sof/lib/dma.h Updated DMA type declarations and prototypes to use sof_dma.
src/platform/posix/dma.c Changed posix_sof_dma array and initializers to struct sof_dma.
src/platform/imx8m/lib/dma.c Updated cache initialization cast for renamed DMA type.
src/library_manager/lib_manager.c Updated lib_manager_dma_ext to reference struct sof_dma.
src/lib/dma.c Refactored DMA init/get/put functions to use struct sof_dma.
src/ipc/ipc3/host-page-table.c Adjusted signature of ipc_get_page_descriptors to use sof_dma.
src/include/sof/lib/dai-zephyr.h Updated DMA pointer in struct dai_data to struct sof_dma.
src/include/sof/ipc/common.h Conditional DMA type in ipc_data_host_buffer now uses sof_dma.
src/audio/copier/host_copier.h Conditional DMA field now uses struct sof_dma.
src/audio/chain_dma.c Renamed dma_host/dma_link fields to use struct sof_dma.


static const struct dma_info lib_dma = {
.dma_array = cache_to_uncache_init((struct dma *)dma),
.dma_array = cache_to_uncache_init((void *)dma),
Copy link

Copilot AI Jul 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider casting directly to struct sof_dma * instead of void * to preserve type safety and clarity (e.g., cache_to_uncache_init((struct sof_dma *)dma)).

Suggested change
.dma_array = cache_to_uncache_init((void *)dma),
.dma_array = cache_to_uncache_init((struct sof_dma *)dma),

Copilot uses AI. Check for mistakes.
Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice clean up.

@lgirdwood
Copy link
Member

@lyakh pls review

@kv2019i kv2019i merged commit ee58c00 into thesofproject:main Jul 4, 2025
34 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants