Skip to content

Commit 47857da

Browse files
committed
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.
2 parents fd16593 + 479b1f8 commit 47857da

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/firmware/cirrus/cs_dsp.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,6 +2329,9 @@ static int cs_dsp_create_name(struct cs_dsp *dsp)
23292329
return 0;
23302330
}
23312331

2332+
static const struct cs_dsp_client_ops cs_dsp_default_client_ops = {
2333+
};
2334+
23322335
static int cs_dsp_common_init(struct cs_dsp *dsp)
23332336
{
23342337
int ret;
@@ -2342,6 +2345,9 @@ static int cs_dsp_common_init(struct cs_dsp *dsp)
23422345

23432346
mutex_init(&dsp->pwr_lock);
23442347

2348+
if (!dsp->client_ops)
2349+
dsp->client_ops = &cs_dsp_default_client_ops;
2350+
23452351
#ifdef CONFIG_DEBUG_FS
23462352
/* Ensure this is invalid if client never provides a debugfs root */
23472353
dsp->debugfs_root = ERR_PTR(-ENODEV);

drivers/firmware/cirrus/test/cs_dsp_test_callbacks.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ KUNIT_ARRAY_PARAM(cs_dsp_callbacks_ops,
600600

601601
static const struct cs_dsp_callbacks_test_param cs_dsp_no_callbacks_cases[] = {
602602
{ .ops = &cs_dsp_callback_test_empty_client_ops, .case_name = "empty ops" },
603+
{ .ops = NULL, .case_name = "NULL ops" },
603604
};
604605

605606
KUNIT_ARRAY_PARAM(cs_dsp_no_callbacks,

0 commit comments

Comments
 (0)