Unverified Commit 47857dae authored by Mark Brown's avatar Mark Brown
Browse files

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.
parents fd16593d 479b1f8d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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,