Skip to content

Commit 76fc9cd

Browse files
committed
ASoC: SOF: sof-client: Convert sof_client_dev_to_sof_dev into function
Remove the sof_client_dev_to_sof_dev() from the header file and add it as a function in sof-client.c to avoid it's use by client drivers. At the same time mark the sdev and list of sof_client_dev as restricted fro core use only. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent c0ce398 commit 76fc9cd

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

sound/soc/sof/sof-client.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,3 +630,9 @@ enum sof_fw_state sof_client_get_fw_state(struct sof_client_dev *cdev)
630630
return sdev->fw_state;
631631
}
632632
EXPORT_SYMBOL_NS_GPL(sof_client_get_fw_state, "SND_SOC_SOF_CLIENT");
633+
634+
struct snd_sof_dev *sof_client_dev_to_sof_dev(struct sof_client_dev *cdev)
635+
{
636+
return cdev->sdev;
637+
}
638+
EXPORT_SYMBOL_NS_GPL(sof_client_dev_to_sof_dev, "SND_SOC_SOF_CLIENT");

sound/soc/sof/sof-client.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ struct sof_ipc4_fw_module;
1818
/**
1919
* struct sof_client_dev - SOF client device
2020
* @auxdev: auxiliary device
21-
* @sdev: pointer to SOF core device struct
22-
* @list: item in SOF core client dev list
21+
* @sdev: pointer to SOF core device struct, resticted for core use only
22+
* @list: item in SOF core client dev list, resticted for core use only
2323
* @data: device specific data
2424
*/
2525
struct sof_client_dev {
@@ -29,8 +29,6 @@ struct sof_client_dev {
2929
void *data;
3030
};
3131

32-
#define sof_client_dev_to_sof_dev(cdev) ((cdev)->sdev)
33-
3432
#define auxiliary_dev_to_sof_client_dev(auxiliary_dev) \
3533
container_of(auxiliary_dev, struct sof_client_dev, auxdev)
3634

sound/soc/sof/sof-priv.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,11 @@ int sof_stream_pcm_close(struct snd_sof_dev *sdev,
855855
struct snd_pcm_substream *substream);
856856

857857
/* SOF client support */
858+
struct sof_client_dev;
859+
858860
#if IS_ENABLED(CONFIG_SND_SOC_SOF_CLIENT)
861+
struct snd_sof_dev *sof_client_dev_to_sof_dev(struct sof_client_dev *cdev);
862+
859863
int sof_client_dev_register(struct snd_sof_dev *sdev, const char *name, u32 id,
860864
const void *data, size_t size);
861865
void sof_client_dev_unregister(struct snd_sof_dev *sdev, const char *name, u32 id);
@@ -866,6 +870,11 @@ void sof_client_fw_state_dispatcher(struct snd_sof_dev *sdev);
866870
int sof_suspend_clients(struct snd_sof_dev *sdev, pm_message_t state);
867871
int sof_resume_clients(struct snd_sof_dev *sdev);
868872
#else /* CONFIG_SND_SOC_SOF_CLIENT */
873+
static inline struct snd_sof_dev *
874+
sof_client_dev_to_sof_dev(struct sof_client_dev *cdev) {
875+
return NULL;
876+
}
877+
869878
static inline int sof_client_dev_register(struct snd_sof_dev *sdev, const char *name,
870879
u32 id, const void *data, size_t size)
871880
{

0 commit comments

Comments
 (0)