]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: SOF: sof-client: Convert sof_client_dev_to_sof_dev into function
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Fri, 29 Aug 2025 10:25:09 +0000 (13:25 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 29 Aug 2025 11:34:25 +0000 (13:34 +0200)
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>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Message-ID: <20250829102510.15159-2-peter.ujfalusi@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/sof-client.c
sound/soc/sof/sof-client.h
sound/soc/sof/sof-priv.h

index 4c7951338c66f6bd6613de627a40cc725b5520d8..2db12753f79ee4427d51746ccace0eb005b94d14 100644 (file)
@@ -611,3 +611,9 @@ enum sof_fw_state sof_client_get_fw_state(struct sof_client_dev *cdev)
        return sdev->fw_state;
 }
 EXPORT_SYMBOL_NS_GPL(sof_client_get_fw_state, "SND_SOC_SOF_CLIENT");
+
+struct snd_sof_dev *sof_client_dev_to_sof_dev(struct sof_client_dev *cdev)
+{
+       return cdev->sdev;
+}
+EXPORT_SYMBOL_NS_GPL(sof_client_dev_to_sof_dev, "SND_SOC_SOF_CLIENT");
index b6ccc2cd69e52c81c65d8b83f8e98d8f90205b23..8b267b0b9ff12ffd217ef70c0d9021c94a1d2592 100644 (file)
@@ -18,8 +18,8 @@ struct sof_ipc4_fw_module;
 /**
  * struct sof_client_dev - SOF client device
  * @auxdev:    auxiliary device
- * @sdev:      pointer to SOF core device struct
- * @list:      item in SOF core client dev list
+ * @sdev:      pointer to SOF core device struct, resticted for core use only
+ * @list:      item in SOF core client dev list, resticted for core use only
  * @data:      device specific data
  */
 struct sof_client_dev {
@@ -29,8 +29,6 @@ struct sof_client_dev {
        void *data;
 };
 
-#define sof_client_dev_to_sof_dev(cdev)                ((cdev)->sdev)
-
 #define auxiliary_dev_to_sof_client_dev(auxiliary_dev) \
        container_of(auxiliary_dev, struct sof_client_dev, auxdev)
 
index abbb5ee7e08c8c2e2b37fecb03dad0de85b707e4..0f624d8cde201b2637c084adb2304d284225ea30 100644 (file)
@@ -838,7 +838,11 @@ int sof_stream_pcm_close(struct snd_sof_dev *sdev,
                         struct snd_pcm_substream *substream);
 
 /* SOF client support */
+struct sof_client_dev;
+
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_CLIENT)
+struct snd_sof_dev *sof_client_dev_to_sof_dev(struct sof_client_dev *cdev);
+
 int sof_client_dev_register(struct snd_sof_dev *sdev, const char *name, u32 id,
                            const void *data, size_t size);
 void sof_client_dev_unregister(struct snd_sof_dev *sdev, const char *name, u32 id);
@@ -849,6 +853,11 @@ void sof_client_fw_state_dispatcher(struct snd_sof_dev *sdev);
 int sof_suspend_clients(struct snd_sof_dev *sdev, pm_message_t state);
 int sof_resume_clients(struct snd_sof_dev *sdev);
 #else /* CONFIG_SND_SOC_SOF_CLIENT */
+static inline struct snd_sof_dev *
+sof_client_dev_to_sof_dev(struct sof_client_dev *cdev) {
+       return NULL;
+}
+
 static inline int sof_client_dev_register(struct snd_sof_dev *sdev, const char *name,
                                          u32 id, const void *data, size_t size)
 {