Skip to content

Conversation

@softwarecki
Copy link
Collaborator

The GetConfiguration function was incorrectly defined for IADK module adapter. This patch fixes the definition.

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 corrects the definition and usage of the GetConfiguration API for the IADK module adapter by switching the size parameters to be passed by reference/pointer.

  • Update C++ adapter signature to take data_offset_size and fragment_size by reference.
  • Adjust wrapper and caller sites to match the new parameter passing convention for data_offset_size.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/include/sof/audio/module_adapter/iadk/iadk_module_adapter.h Changed data_offset_size and fragment_size to references in the adapter API.
src/audio/module_adapter/module/modules.c Updated call to iadk_wrapper_get_configuration to pass data_offset_size pointer.
src/audio/module_adapter/iadk/iadk_module_adapter.cpp Modified wrapper signature to accept data_offset_size pointer.

Comment on lines 223 to 229
uint8_t *fragment, size_t fragment_size)
{
struct IadkModuleAdapter *mod_adp = (struct IadkModuleAdapter *) md;
return mod_adp->IadkModuleAdapter_GetConfiguration(config_id, pos,
data_offset_size,
*data_offset_size,
fragment,
fragment_size);
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

The wrapper iadk_wrapper_get_configuration still takes fragment_size by value, so updates from IadkModuleAdapter_GetConfiguration will be lost. Change the signature to size_t *fragment_size, dereference it in the call, and assign back the updated size.

Copilot uses AI. Check for mistakes.
return iadk_wrapper_get_configuration(module_get_private_data(mod), config_id,
MODULE_CFG_FRAGMENT_SINGLE, *data_offset_size,
MODULE_CFG_FRAGMENT_SINGLE, data_offset_size,
fragment, fragment_size);
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

After updating the wrapper to accept size_t *fragment_size, this call should pass &fragment_size instead of fragment_size, so the new fragment size is propagated correctly.

Suggested change
fragment, fragment_size);
fragment, &fragment_size);

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1 for copilot

Copy link
Member

Choose a reason for hiding this comment

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

What is the reference API doing ?

Copy link
Contributor

@tmleman tmleman left a comment

Choose a reason for hiding this comment

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

Could you add const for input-only parameters and document if data_offset_size/fragment_size are [in], [out], or [in,out]?

Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

need to fix fragment_size

The GetConfiguration function was incorrectly defined for IADK module
adapter. This patch fixes the definition.

Signed-off-by: Jaroslaw Stelter <Jaroslaw.Stelter@intel.com>
Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

Looks correct now. I guess the previous version would fail an IADK compilation test, do we have such tests in GH, Jenkins or internal? Or can we add some?

* \param[in] pos - position of the fragment in the large message
* \param[in] data_offset_size: size of the whole configuration if it is the first fragment or the
* only fragment. Otherwise, it is the offset of the fragment in the whole configuration.
* \param[in] fragment: configuration fragment buffer
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

ok, looks like we are good to go once the API buffer is aligned,

@lgirdwood lgirdwood merged commit fa841ef into thesofproject:main Jul 22, 2025
38 of 45 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.

6 participants