Unverified Commit 228132b4 authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: Constify local snd_sof_dsp_ops

Merge series from Krzysztof Kozlowski <krzk@kernel.org>:

The core code does not modify the 'struct snd_sof_dsp_ops' passed via
pointer in various places, so this can be made pointer to const in few
places.  This in turn allows few drivers to have the local (usually
static) 'struct snd_sof_dsp_ops' as const which increased code safety,
as it is now part of rodata.

Not all drivers can be made safer that way. Intel and AMD rely on
customizing that 'struct snd_sof_dsp_ops' before passing to SOF, so they
won't benefit.  They don't lose anything., either.
parents af2ab6cc 8b6d678f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -166,7 +166,7 @@ struct sof_dev_desc {
	/* default firmware name */
	const char *default_fw_filename[SOF_IPC_TYPE_COUNT];

	struct snd_sof_dsp_ops *ops;
	const struct snd_sof_dsp_ops *ops;
	int (*ops_init)(struct snd_sof_dev *sdev);
	void (*ops_free)(struct snd_sof_dev *sdev);
};
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ struct snd_soc_acpi_mach *amd_sof_machine_select(struct snd_sof_dev *sdev)
}

/* AMD Common DSP ops */
struct snd_sof_dsp_ops sof_acp_common_ops = {
const struct snd_sof_dsp_ops sof_acp_common_ops = {
	/* probe and remove */
	.probe			= amd_sof_acp_probe,
	.remove			= amd_sof_acp_remove,
+1 −1
Original line number Diff line number Diff line
@@ -310,7 +310,7 @@ int acp_pcm_hw_params(struct snd_sof_dev *sdev, struct snd_pcm_substream *substr
snd_pcm_uframes_t acp_pcm_pointer(struct snd_sof_dev *sdev,
				  struct snd_pcm_substream *substream);

extern struct snd_sof_dsp_ops sof_acp_common_ops;
extern const struct snd_sof_dsp_ops sof_acp_common_ops;

extern struct snd_sof_dsp_ops sof_renoir_ops;
int sof_renoir_ops_init(struct snd_sof_dev *sdev);
+1 −1
Original line number Diff line number Diff line
@@ -311,8 +311,8 @@ EXPORT_SYMBOL_GPL(snd_sof_dbg_memory_info_init);

int snd_sof_dbg_init(struct snd_sof_dev *sdev)
{
	const struct snd_sof_dsp_ops *ops = sof_ops(sdev);
	struct snd_sof_pdata *plat_data = sdev->pdata;
	struct snd_sof_dsp_ops *ops = sof_ops(sdev);
	const struct snd_sof_debugfs_map *map;
	struct dentry *fw_profile;
	int i;
+2 −2
Original line number Diff line number Diff line
@@ -478,7 +478,7 @@ static int imx8_dsp_set_power_state(struct snd_sof_dev *sdev,
}

/* i.MX8 ops */
static struct snd_sof_dsp_ops sof_imx8_ops = {
static const struct snd_sof_dsp_ops sof_imx8_ops = {
	/* probe and remove */
	.probe		= imx8_probe,
	.remove		= imx8_remove,
@@ -539,7 +539,7 @@ static struct snd_sof_dsp_ops sof_imx8_ops = {
};

/* i.MX8X ops */
static struct snd_sof_dsp_ops sof_imx8x_ops = {
static const struct snd_sof_dsp_ops sof_imx8x_ops = {
	/* probe and remove */
	.probe		= imx8_probe,
	.remove		= imx8_remove,
Loading