Skip to content

Commit eba2cdd

Browse files
lyakhlgirdwood
authored andcommitted
audio: host: mark non-performance critical code as "cold"
Add __cold qualifiers and debugging tests to IPC context functions. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 090748b commit eba2cdd

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

src/audio/host-zephyr.c

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,9 @@ static int host_copy_normal(struct host_data *hd, struct comp_dev *dev, copy_cal
524524
return ret;
525525
}
526526

527-
static int create_local_elems(struct host_data *hd, struct comp_dev *dev, uint32_t buffer_count,
528-
uint32_t buffer_bytes, uint32_t direction)
527+
static int create_local_elems(struct host_data *hd, struct comp_dev *dev,
528+
uint32_t buffer_count, uint32_t buffer_bytes,
529+
uint32_t direction)
529530
{
530531
struct dma_sg_elem_array *elem_array;
531532
uint32_t dir;
@@ -624,11 +625,13 @@ static int host_trigger(struct comp_dev *dev, int cmd)
624625
return host_common_trigger(hd, dev, cmd);
625626
}
626627

627-
int host_common_new(struct host_data *hd, struct comp_dev *dev,
628-
const struct ipc_config_host *ipc_host, uint32_t config_id)
628+
__cold int host_common_new(struct host_data *hd, struct comp_dev *dev,
629+
const struct ipc_config_host *ipc_host, uint32_t config_id)
629630
{
630631
uint32_t dir;
631632

633+
assert_can_be_cold();
634+
632635
hd->ipc_host = *ipc_host;
633636
/* request HDA DMA with shared access privilege */
634637
dir = hd->ipc_host.direction == SOF_IPC_STREAM_PLAYBACK ?
@@ -659,15 +662,17 @@ int host_common_new(struct host_data *hd, struct comp_dev *dev,
659662
return 0;
660663
}
661664

662-
static struct comp_dev *host_new(const struct comp_driver *drv,
663-
const struct comp_ipc_config *config,
664-
const void *spec)
665+
__cold static struct comp_dev *host_new(const struct comp_driver *drv,
666+
const struct comp_ipc_config *config,
667+
const void *spec)
665668
{
666669
struct comp_dev *dev;
667670
struct host_data *hd;
668671
const struct ipc_config_host *ipc_host = spec;
669672
int ret;
670673

674+
assert_can_be_cold();
675+
671676
comp_cl_dbg(&comp_host, "host_new()");
672677

673678
dev = comp_alloc(drv, sizeof(*dev));
@@ -697,18 +702,22 @@ static struct comp_dev *host_new(const struct comp_driver *drv,
697702
return NULL;
698703
}
699704

700-
void host_common_free(struct host_data *hd)
705+
__cold void host_common_free(struct host_data *hd)
701706
{
707+
assert_can_be_cold();
708+
702709
sof_dma_put(hd->dma);
703710

704711
ipc_msg_free(hd->msg);
705712
dma_sg_free(&hd->config.elem_array);
706713
}
707714

708-
static void host_free(struct comp_dev *dev)
715+
__cold static void host_free(struct comp_dev *dev)
709716
{
710717
struct host_data *hd = comp_get_drvdata(dev);
711718

719+
assert_can_be_cold();
720+
712721
comp_dbg(dev, "host_free()");
713722
host_common_free(hd);
714723
rfree(hd);
@@ -1113,11 +1122,13 @@ static int host_copy(struct comp_dev *dev)
11131122
return host_common_copy(hd, dev, host_dma_cb);
11141123
}
11151124

1116-
static int host_get_attribute(struct comp_dev *dev, uint32_t type,
1117-
void *value)
1125+
__cold static int host_get_attribute(struct comp_dev *dev, uint32_t type,
1126+
void *value)
11181127
{
11191128
struct host_data *hd = comp_get_drvdata(dev);
11201129

1130+
assert_can_be_cold();
1131+
11211132
switch (type) {
11221133
case COMP_ATTR_COPY_TYPE:
11231134
*(enum comp_copy_type *)value = hd->copy_type;
@@ -1132,11 +1143,13 @@ static int host_get_attribute(struct comp_dev *dev, uint32_t type,
11321143
return 0;
11331144
}
11341145

1135-
static int host_set_attribute(struct comp_dev *dev, uint32_t type,
1136-
void *value)
1146+
__cold static int host_set_attribute(struct comp_dev *dev, uint32_t type,
1147+
void *value)
11371148
{
11381149
struct host_data *hd = comp_get_drvdata(dev);
11391150

1151+
assert_can_be_cold();
1152+
11401153
switch (type) {
11411154
case COMP_ATTR_COPY_TYPE:
11421155
hd->copy_type = *(enum comp_copy_type *)value;

0 commit comments

Comments
 (0)