Skip to content

Commit ce620b8

Browse files
committed
ipc: ipc4: rename ipc_comp_(dis)connect()
Currently both IPC3 and IPC4 use ipc_comp_connect() and ipc_comp_disconnect() even though their second parameter has different types. This makes no sense since both implementations and calling sites are different. Rename IPC4 versions to drop type-casts. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent c75473f commit ce620b8

4 files changed

Lines changed: 23 additions & 13 deletions

File tree

src/include/ipc4/handler.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,22 @@ int ipc4_set_pipeline_state(struct ipc4_message_request *ipc4);
6868
*/
6969
void ipc_compound_msg_done(uint32_t msg_id, int error);
7070

71+
/**
72+
* \brief Connect components together on a pipeline.
73+
* @param ipc The global IPC context.
74+
* @param bu IPC4 bind-unbind data.
75+
* @return IPC4_SUCCESS on success, error code otherwise.
76+
*/
77+
int ipc4_comp_connect(struct ipc *ipc, const struct ipc4_module_bind_unbind *bu);
78+
79+
/**
80+
* \brief Disconnect components in a pipeline.
81+
* @param ipc The global IPC context.
82+
* @param bu IPC4 bind-unbind data.
83+
* @return IPC4_SUCCESS on success, error code otherwise.
84+
*/
85+
int ipc4_comp_disconnect(struct ipc *ipc, const struct ipc4_module_bind_unbind *bu);
86+
7187
#if defined(__ZEPHYR__) && defined(CONFIG_SOF_FULL_ZEPHYR_APPLICATION)
7288
/**
7389
* \brief Increment the IPC compound message pre-start counter.

src/include/sof/ipc/topology.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ int ipc_pipeline_complete(struct ipc *ipc, uint32_t comp_id);
165165
/**
166166
* \brief Connect components together on a pipeline.
167167
* @param ipc The global IPC context.
168-
* @param connect Components to connect together..
168+
* @param connect Components to connect together.
169169
* @return 0 on success or negative error.
170170
*/
171171
int ipc_comp_connect(struct ipc *ipc, ipc_pipe_comp_connect *connect);

src/ipc/ipc4/handler-user.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ __cold static int ipc4_bind_module_instance(struct ipc4_message_request *ipc4)
812812
(uint32_t)bu->primary.r.module_id, (uint32_t)bu->primary.r.instance_id,
813813
(uint32_t)bu->extension.r.dst_module_id, (uint32_t)bu->extension.r.dst_instance_id);
814814

815-
return ipc_comp_connect(ipc, (ipc_pipe_comp_connect *)bu);
815+
return ipc4_comp_connect(ipc, bu);
816816
}
817817

818818
__cold static int ipc4_unbind_module_instance(struct ipc4_message_request *ipc4)
@@ -826,7 +826,7 @@ __cold static int ipc4_unbind_module_instance(struct ipc4_message_request *ipc4)
826826
(uint32_t)bu->primary.r.module_id, (uint32_t)bu->primary.r.instance_id,
827827
(uint32_t)bu->extension.r.dst_module_id, (uint32_t)bu->extension.r.dst_instance_id);
828828

829-
return ipc_comp_disconnect(ipc, (ipc_pipe_comp_connect *)bu);
829+
return ipc4_comp_disconnect(ipc, bu);
830830
}
831831
#endif /* !CONFIG_SOF_USERSPACE_LL */
832832

@@ -1707,8 +1707,7 @@ int ipc_user_thread_dispatch(struct ipc_user *ipc_user)
17071707
if (result < 0)
17081708
break;
17091709

1710-
result = ipc_comp_connect(ipc_user->ipc,
1711-
(ipc_pipe_comp_connect *)&bu);
1710+
result = ipc4_comp_connect(ipc_user->ipc, &bu);
17121711
break;
17131712
}
17141713
case SOF_IPC4_MOD_UNBIND: {
@@ -1718,8 +1717,7 @@ int ipc_user_thread_dispatch(struct ipc_user *ipc_user)
17181717
if (result < 0)
17191718
break;
17201719

1721-
result = ipc_comp_disconnect(ipc_user->ipc,
1722-
(ipc_pipe_comp_connect *)&bu);
1720+
result = ipc4_comp_disconnect(ipc_user->ipc, &bu);
17231721
break;
17241722
}
17251723
case SOF_IPC4_MOD_INIT_INSTANCE: {

src/ipc/ipc4/helper.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -772,9 +772,8 @@ static int ll_wait_finished_on_core(struct comp_dev *dev)
772772
#endif
773773

774774
/* Only called from ipc4_bind_module_instance(), which is __cold */
775-
__cold int ipc_comp_connect(struct ipc *ipc, ipc_pipe_comp_connect *_connect)
775+
__cold int ipc4_comp_connect(struct ipc *ipc, const struct ipc4_module_bind_unbind *bu)
776776
{
777-
struct ipc4_module_bind_unbind *bu;
778777
struct bind_info bind_data;
779778
struct comp_buffer *buffer;
780779
struct comp_dev *source;
@@ -790,7 +789,6 @@ __cold int ipc_comp_connect(struct ipc *ipc, ipc_pipe_comp_connect *_connect)
790789

791790
assert_can_be_cold();
792791

793-
bu = (struct ipc4_module_bind_unbind *)_connect;
794792
src_id = IPC4_COMP_ID(bu->primary.r.module_id, bu->primary.r.instance_id);
795793
sink_id = IPC4_COMP_ID(bu->extension.r.dst_module_id, bu->extension.r.dst_instance_id);
796794
source = ipc4_get_comp_dev(src_id);
@@ -1041,9 +1039,8 @@ __cold int ipc_comp_connect(struct ipc *ipc, ipc_pipe_comp_connect *_connect)
10411039
* pipeline and create it in modified form.
10421040
*/
10431041
/* Only called from ipc4_unbind_module_instance(), which is __cold */
1044-
__cold int ipc_comp_disconnect(struct ipc *ipc, ipc_pipe_comp_connect *_connect)
1042+
__cold int ipc4_comp_disconnect(struct ipc *ipc, const struct ipc4_module_bind_unbind *bu)
10451043
{
1046-
struct ipc4_module_bind_unbind *bu;
10471044
struct comp_buffer *buffer = NULL;
10481045
struct comp_buffer *buf;
10491046
struct comp_dev *src, *sink;
@@ -1055,7 +1052,6 @@ __cold int ipc_comp_disconnect(struct ipc *ipc, ipc_pipe_comp_connect *_connect)
10551052

10561053
assert_can_be_cold();
10571054

1058-
bu = (struct ipc4_module_bind_unbind *)_connect;
10591055
src_id = IPC4_COMP_ID(bu->primary.r.module_id, bu->primary.r.instance_id);
10601056
sink_id = IPC4_COMP_ID(bu->extension.r.dst_module_id, bu->extension.r.dst_instance_id);
10611057
src = ipc4_get_comp_dev(src_id);

0 commit comments

Comments
 (0)