Skip to content

Commit 8c35b95

Browse files
author
Marcin Maka
committed
comp: init back ptr to driver early in new
Back pointer must be initialized before any instance level logging is performed by the new() operation since the instance identification requires access to the uuid that will be implemented on the component driver level. Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
1 parent 673aeba commit 8c35b95

20 files changed

Lines changed: 59 additions & 23 deletions

File tree

src/audio/asrc/asrc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ static void src_copy_s16(struct comp_dev *dev,
247247
}
248248
}
249249

250-
static struct comp_dev *asrc_new(struct sof_ipc_comp *comp)
250+
static struct comp_dev *asrc_new(const struct comp_driver *drv,
251+
struct sof_ipc_comp *comp)
251252
{
252253
struct comp_dev *dev;
253254
struct sof_ipc_comp_asrc *asrc;
@@ -271,6 +272,7 @@ static struct comp_dev *asrc_new(struct sof_ipc_comp *comp)
271272
COMP_SIZE(struct sof_ipc_comp_asrc));
272273
if (!dev)
273274
return NULL;
275+
dev->drv = drv;
274276

275277
asrc = COMP_GET_IPC(dev, sof_ipc_comp_asrc);
276278
err = memcpy_s(asrc, sizeof(*asrc), ipc_asrc,

src/audio/component.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,12 @@ struct comp_dev *comp_new(struct sof_ipc_comp *comp)
6969
}
7070

7171
/* create the new component */
72-
cdev = drv->ops.new(comp);
72+
cdev = drv->ops.new(drv, comp);
7373
if (!cdev) {
7474
comp_cl_err(drv, "comp_new() error: unable to create the new component");
7575
return NULL;
7676
}
7777

78-
cdev->drv = drv;
7978
list_init(&cdev->bsource_list);
8079
list_init(&cdev->bsink_list);
8180

src/audio/dai.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ static void dai_dma_cb(void *arg, enum notify_id type, void *data)
118118
}
119119
}
120120

121-
static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
121+
static struct comp_dev *dai_new(const struct comp_driver *drv,
122+
struct sof_ipc_comp *comp)
122123
{
123124
struct comp_dev *dev;
124125
struct sof_ipc_comp_dai *dai;
@@ -133,6 +134,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
133134
COMP_SIZE(struct sof_ipc_comp_dai));
134135
if (!dev)
135136
return NULL;
137+
dev->drv = drv;
136138

137139
dai = COMP_GET_IPC(dev, sof_ipc_comp_dai);
138140
ret = memcpy_s(dai, sizeof(*dai), ipc_dai,

src/audio/detect_test.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ static int test_keyword_apply_config(struct comp_dev *dev,
285285
return 0;
286286
}
287287

288-
static struct comp_dev *test_keyword_new(struct sof_ipc_comp *comp)
288+
static struct comp_dev *test_keyword_new(const struct comp_driver *drv,
289+
struct sof_ipc_comp *comp)
289290
{
290291
struct comp_dev *dev;
291292
struct sof_ipc_comp_process *keyword;
@@ -302,6 +303,7 @@ static struct comp_dev *test_keyword_new(struct sof_ipc_comp *comp)
302303
COMP_SIZE(struct sof_ipc_comp_process));
303304
if (!dev)
304305
return NULL;
306+
dev->drv = drv;
305307

306308
keyword = COMP_GET_IPC(dev, sof_ipc_comp_process);
307309
ret = memcpy_s(keyword, sizeof(*keyword), ipc_keyword,

src/audio/eq_fir/eq_fir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,8 @@ static int eq_fir_setup(struct comp_data *cd, int nch)
388388
* End of algorithm code. Next the standard component methods.
389389
*/
390390

391-
static struct comp_dev *eq_fir_new(struct sof_ipc_comp *comp)
391+
static struct comp_dev *eq_fir_new(const struct comp_driver *drv,
392+
struct sof_ipc_comp *comp)
392393
{
393394
struct comp_dev *dev;
394395
struct comp_data *cd;
@@ -414,6 +415,7 @@ static struct comp_dev *eq_fir_new(struct sof_ipc_comp *comp)
414415
COMP_SIZE(struct sof_ipc_comp_process));
415416
if (!dev)
416417
return NULL;
418+
dev->drv = drv;
417419

418420
fir = COMP_GET_IPC(dev, sof_ipc_comp_process);
419421
ret = memcpy_s(fir, sizeof(*fir), ipc_fir,

src/audio/eq_iir/eq_iir.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,8 @@ static int eq_iir_setup(struct comp_data *cd, int nch)
493493
* End of EQ setup code. Next the standard component methods.
494494
*/
495495

496-
static struct comp_dev *eq_iir_new(struct sof_ipc_comp *comp)
496+
static struct comp_dev *eq_iir_new(const struct comp_driver *drv,
497+
struct sof_ipc_comp *comp)
497498
{
498499
struct comp_dev *dev;
499500
struct comp_data *cd;
@@ -519,6 +520,7 @@ static struct comp_dev *eq_iir_new(struct sof_ipc_comp *comp)
519520
COMP_SIZE(struct sof_ipc_comp_process));
520521
if (!dev)
521522
return NULL;
523+
dev->drv = drv;
522524

523525
iir = COMP_GET_IPC(dev, sof_ipc_comp_process);
524526
ret = memcpy_s(iir, sizeof(*iir), ipc_iir,

src/audio/host.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ static int host_trigger(struct comp_dev *dev, int cmd)
312312
return ret;
313313
}
314314

315-
static struct comp_dev *host_new(struct sof_ipc_comp *comp)
315+
static struct comp_dev *host_new(const struct comp_driver *drv,
316+
struct sof_ipc_comp *comp)
316317
{
317318
struct sof_ipc_comp_host *ipc_host = (struct sof_ipc_comp_host *)comp;
318319
struct sof_ipc_comp_host *host;
@@ -327,6 +328,7 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp)
327328
COMP_SIZE(struct sof_ipc_comp_host));
328329
if (!dev)
329330
return NULL;
331+
dev->drv = drv;
330332

331333
host = COMP_GET_IPC(dev, sof_ipc_comp_host);
332334
ret = memcpy_s(host, sizeof(*host),
@@ -347,7 +349,7 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp)
347349

348350
hd->dma = dma_get(dir, 0, DMA_DEV_HOST, DMA_ACCESS_SHARED);
349351
if (!hd->dma) {
350-
comp_cl_err(&comp_host, "host_new() error: dma_get() returned NULL");
352+
comp_err(dev, "host_new() error: dma_get() returned NULL");
351353
rfree(hd);
352354
rfree(dev);
353355
return NULL;

src/audio/kpb.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ static uint64_t kpb_task_deadline(void *data)
107107
*
108108
* \return: a pointer to newly created KPB component.
109109
*/
110-
static struct comp_dev *kpb_new(struct sof_ipc_comp *comp)
110+
static struct comp_dev *kpb_new(const struct comp_driver *drv,
111+
struct sof_ipc_comp *comp)
111112
{
112113
struct sof_ipc_comp_process *ipc_process =
113114
(struct sof_ipc_comp_process *)comp;
@@ -126,6 +127,7 @@ static struct comp_dev *kpb_new(struct sof_ipc_comp *comp)
126127
COMP_SIZE(struct sof_ipc_comp_process));
127128
if (!dev)
128129
return NULL;
130+
dev->drv = drv;
129131

130132
ret = memcpy_s(COMP_GET_IPC(dev, sof_ipc_comp_process),
131133
sizeof(struct sof_ipc_comp_process),

src/audio/mixer.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ static void mix_n_s32(struct comp_dev *dev, struct audio_stream *sink,
106106
}
107107
#endif /* CONFIG_FORMAT_S24LE || CONFIG_FORMAT_S32LE */
108108

109-
static struct comp_dev *mixer_new(struct sof_ipc_comp *comp)
109+
static struct comp_dev *mixer_new(const struct comp_driver *drv,
110+
struct sof_ipc_comp *comp)
110111
{
111112
struct comp_dev *dev;
112113
struct sof_ipc_comp_mixer *mixer;
@@ -121,6 +122,7 @@ static struct comp_dev *mixer_new(struct sof_ipc_comp *comp)
121122
COMP_SIZE(struct sof_ipc_comp_mixer));
122123
if (!dev)
123124
return NULL;
125+
dev->drv = drv;
124126

125127
mixer = COMP_GET_IPC(dev, sof_ipc_comp_mixer);
126128

src/audio/mux/mux.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ static int mux_set_values(struct comp_data *cd, struct sof_mux_config *cfg)
7777
return 0;
7878
}
7979

80-
static struct comp_dev *mux_new(struct sof_ipc_comp *comp)
80+
static struct comp_dev *mux_new(const struct comp_driver *drv,
81+
struct sof_ipc_comp *comp)
8182
{
8283
struct sof_ipc_comp_process *ipc_process =
8384
(struct sof_ipc_comp_process *)comp;
@@ -92,6 +93,7 @@ static struct comp_dev *mux_new(struct sof_ipc_comp *comp)
9293
COMP_SIZE(struct sof_ipc_comp_process));
9394
if (!dev)
9495
return NULL;
96+
dev->drv = drv;
9597

9698
memcpy_s(COMP_GET_IPC(dev, sof_ipc_comp_process),
9799
sizeof(struct sof_ipc_comp_process),

0 commit comments

Comments
 (0)