firmware: cs_dsp: Remove need for clients to supply

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

Clients of cs_dsp can provide optional callback function pointers, in
a struct cs_dsp_client_ops. The client had to provide a pointer to a
struct even if it didn't implement any of the callbacks.
This commit is contained in:
Mark Brown
2025-11-29 00:48:15 +00:00
2 changed files with 7 additions and 0 deletions

View File

@@ -2329,6 +2329,9 @@ static int cs_dsp_create_name(struct cs_dsp *dsp)
return 0;
}
static const struct cs_dsp_client_ops cs_dsp_default_client_ops = {
};
static int cs_dsp_common_init(struct cs_dsp *dsp)
{
int ret;
@@ -2342,6 +2345,9 @@ static int cs_dsp_common_init(struct cs_dsp *dsp)
mutex_init(&dsp->pwr_lock);
if (!dsp->client_ops)
dsp->client_ops = &cs_dsp_default_client_ops;
#ifdef CONFIG_DEBUG_FS
/* Ensure this is invalid if client never provides a debugfs root */
dsp->debugfs_root = ERR_PTR(-ENODEV);

View File

@@ -600,6 +600,7 @@ KUNIT_ARRAY_PARAM(cs_dsp_callbacks_ops,
static const struct cs_dsp_callbacks_test_param cs_dsp_no_callbacks_cases[] = {
{ .ops = &cs_dsp_callback_test_empty_client_ops, .case_name = "empty ops" },
{ .ops = NULL, .case_name = "NULL ops" },
};
KUNIT_ARRAY_PARAM(cs_dsp_no_callbacks,