summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2025-11-29 00:48:15 +0000
committerMark Brown <broonie@kernel.org>2025-11-29 00:48:15 +0000
commit47857dae1e6710443b8fdf59146f7e3632b591fa (patch)
treed9709525b1e3e2a8252e9e72030fe593cb04e3f2
parentfd16593d456053d110c6e7bd141a7f381a1b10f7 (diff)
parent479b1f8d416501cc3c18b743b1cf63776934ada9 (diff)
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.
-rw-r--r--drivers/firmware/cirrus/cs_dsp.c6
-rw-r--r--drivers/firmware/cirrus/test/cs_dsp_test_callbacks.c1
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/firmware/cirrus/cs_dsp.c b/drivers/firmware/cirrus/cs_dsp.c
index 60a2061c444c..525ac0f0a75d 100644
--- a/drivers/firmware/cirrus/cs_dsp.c
+++ b/drivers/firmware/cirrus/cs_dsp.c
@@ -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);
diff --git a/drivers/firmware/cirrus/test/cs_dsp_test_callbacks.c b/drivers/firmware/cirrus/test/cs_dsp_test_callbacks.c
index 8a9b66a3b7d3..e5a389808e5f 100644
--- a/drivers/firmware/cirrus/test/cs_dsp_test_callbacks.c
+++ b/drivers/firmware/cirrus/test/cs_dsp_test_callbacks.c
@@ -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,