sof-client.c (6e9548cdb30e5d6724236dd7b89a79a270751485) sof-client.c (cac0b0887e5304bddfda91a4a7106f9328c31318)
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright(c) 2022 Intel Corporation. All rights reserved.
4//
5// Authors: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
6// Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
7//
8

--- 88 unchanged lines hidden (view full) ---

97static inline int sof_register_ipc_flood_test(struct snd_sof_dev *sdev)
98{
99 return 0;
100}
101
102static inline void sof_unregister_ipc_flood_test(struct snd_sof_dev *sdev) {}
103#endif /* CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST */
104
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright(c) 2022 Intel Corporation. All rights reserved.
4//
5// Authors: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
6// Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
7//
8

--- 88 unchanged lines hidden (view full) ---

97static inline int sof_register_ipc_flood_test(struct snd_sof_dev *sdev)
98{
99 return 0;
100}
101
102static inline void sof_unregister_ipc_flood_test(struct snd_sof_dev *sdev) {}
103#endif /* CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST */
104
105#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_MSG_INJECTOR)
106static int sof_register_ipc_msg_injector(struct snd_sof_dev *sdev)
107{
108 return sof_client_dev_register(sdev, "msg_injector", 0, NULL, 0);
109}
110
111static void sof_unregister_ipc_msg_injector(struct snd_sof_dev *sdev)
112{
113 sof_client_dev_unregister(sdev, "msg_injector", 0);
114}
115#else
116static inline int sof_register_ipc_msg_injector(struct snd_sof_dev *sdev)
117{
118 return 0;
119}
120
121static inline void sof_unregister_ipc_msg_injector(struct snd_sof_dev *sdev) {}
122#endif /* CONFIG_SND_SOC_SOF_DEBUG_IPC_MSG_INJECTOR */
123
105int sof_register_clients(struct snd_sof_dev *sdev)
106{
107 int ret;
108
109 /* Register platform independent client devices */
110 ret = sof_register_ipc_flood_test(sdev);
111 if (ret) {
112 dev_err(sdev->dev, "IPC flood test client registration failed\n");
113 return ret;
114 }
115
124int sof_register_clients(struct snd_sof_dev *sdev)
125{
126 int ret;
127
128 /* Register platform independent client devices */
129 ret = sof_register_ipc_flood_test(sdev);
130 if (ret) {
131 dev_err(sdev->dev, "IPC flood test client registration failed\n");
132 return ret;
133 }
134
135 ret = sof_register_ipc_msg_injector(sdev);
136 if (ret) {
137 dev_err(sdev->dev, "IPC message injector client registration failed\n");
138 goto err_msg_injector;
139 }
140
116 /* Platform depndent client device registration */
117
118 if (sof_ops(sdev) && sof_ops(sdev)->register_ipc_clients)
119 ret = sof_ops(sdev)->register_ipc_clients(sdev);
120
141 /* Platform depndent client device registration */
142
143 if (sof_ops(sdev) && sof_ops(sdev)->register_ipc_clients)
144 ret = sof_ops(sdev)->register_ipc_clients(sdev);
145
121 if (ret)
122 sof_unregister_ipc_flood_test(sdev);
146 if (!ret)
147 return 0;
123
148
149 sof_unregister_ipc_msg_injector(sdev);
150
151err_msg_injector:
152 sof_unregister_ipc_flood_test(sdev);
153
124 return ret;
125}
126
127void sof_unregister_clients(struct snd_sof_dev *sdev)
128{
129 if (sof_ops(sdev) && sof_ops(sdev)->unregister_ipc_clients)
130 sof_ops(sdev)->unregister_ipc_clients(sdev);
131
154 return ret;
155}
156
157void sof_unregister_clients(struct snd_sof_dev *sdev)
158{
159 if (sof_ops(sdev) && sof_ops(sdev)->unregister_ipc_clients)
160 sof_ops(sdev)->unregister_ipc_clients(sdev);
161
162 sof_unregister_ipc_msg_injector(sdev);
132 sof_unregister_ipc_flood_test(sdev);
133}
134
135int sof_client_dev_register(struct snd_sof_dev *sdev, const char *name, u32 id,
136 const void *data, size_t size)
137{
138 struct auxiliary_device *auxdev;
139 struct sof_client_dev *cdev;

--- 299 unchanged lines hidden ---
163 sof_unregister_ipc_flood_test(sdev);
164}
165
166int sof_client_dev_register(struct snd_sof_dev *sdev, const char *name, u32 id,
167 const void *data, size_t size)
168{
169 struct auxiliary_device *auxdev;
170 struct sof_client_dev *cdev;

--- 299 unchanged lines hidden ---