From 94001aa81cf3f921a689e4b557fb487c1943dd3c Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Jul 2018 14:34:26 +0100 Subject: [PATCH 01/10] [SQUASHME] ASoC: SOF: core fix sparse warnings. Signed-off-by: Liam Girdwood --- sound/soc/sof/core.c | 4 ++-- sound/soc/sof/sof-priv.h | 14 +++++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index d022deca0d7786..ee76082cd891a9 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -34,7 +34,7 @@ struct snd_sof_pcm *snd_sof_find_spcm_dai(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm = NULL; list_for_each_entry(spcm, &sdev->pcm_list, list) { - if (spcm->pcm.dai_id == rtd->dai_link->id) + if (le32_to_cpu(spcm->pcm.dai_id) == rtd->dai_link->id) return spcm; } @@ -87,7 +87,7 @@ struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm = NULL; list_for_each_entry(spcm, &sdev->pcm_list, list) { - if (spcm->pcm.pcm_id == pcm_id) + if (le32_to_cpu(spcm->pcm.pcm_id) == pcm_id) return spcm; } diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index d0c26dcb932a2b..91115c82e62506 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -107,9 +107,9 @@ struct snd_sof_dsp_ops { /* mailbox */ void (*mailbox_read)(struct snd_sof_dev *sof_dev, u32 offset, - void __iomem *addr, size_t bytes); + void *addr, size_t bytes); void (*mailbox_write)(struct snd_sof_dev *sof_dev, u32 offset, - void __iomem *addr, size_t bytes); + void *addr, size_t bytes); /* ipc */ int (*send_msg)(struct snd_sof_dev *sof_dev, @@ -171,7 +171,14 @@ struct sof_ops_table { }; /* FS entry for debug files that can expose DSP memories, registers */ -struct snd_sof_dfsentry { +struct snd_sof_dfsentry_io { + struct dentry *dfsentry; + size_t size; + void __iomem *buf; + struct snd_sof_dev *sdev; +}; + +struct snd_sof_dfsentry_buf { struct dentry *dfsentry; size_t size; void *buf; @@ -401,6 +408,7 @@ struct snd_sof_pcm *snd_sof_find_spcm_comp(struct snd_sof_dev *sdev, int *direction); struct snd_sof_pcm *snd_sof_find_spcm_pcm_id(struct snd_sof_dev *sdev, unsigned int pcm_id); +void sof_ipc_drop_all(struct snd_sof_ipc *ipc); /* * Stream IPC From d6c73564cffbc3ad7885e933e6fcc5734142e099 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Jul 2018 14:34:45 +0100 Subject: [PATCH 02/10] [SQUASHME] ASoC: SOF: debug: fix sparse warnings. Signed-off-by: Liam Girdwood --- sound/soc/sof/debug.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c index c1580a17d2f2d2..ec966d25816df4 100644 --- a/sound/soc/sof/debug.c +++ b/sound/soc/sof/debug.c @@ -32,7 +32,7 @@ static int sof_dfsentry_open(struct inode *inode, struct file *file) static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { - struct snd_sof_dfsentry *dfse = file->private_data; + struct snd_sof_dfsentry_io *dfse = file->private_data; struct snd_sof_dev *sdev = dfse->sdev; int size; u32 *buf; @@ -78,7 +78,7 @@ int snd_sof_debugfs_create_item(struct snd_sof_dev *sdev, void __iomem *base, size_t size, const char *name) { - struct snd_sof_dfsentry *dfse; + struct snd_sof_dfsentry_io *dfse; if (!sdev) return -EINVAL; @@ -118,7 +118,8 @@ int snd_sof_dbg_init(struct snd_sof_dev *sdev) for (i = 0; i < ops->debug_map_count; i++) { map = &ops->debug_map[i]; - err = snd_sof_debugfs_create_item(sdev, sdev->bar[map->bar] + + err = snd_sof_debugfs_create_item(sdev, + sdev->bar[map->bar] + map->offset, map->size, map->name); if (err < 0) From 798b7aabf7a170d608c812e7b548ed46e3295b68 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Jul 2018 14:35:37 +0100 Subject: [PATCH 03/10] [SQUASHME] ASoC: SOF: ipc: fix sparse warnings. Signed-off-by: Liam Girdwood --- sound/soc/sof/ipc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index f0c90a7f820b2b..300f33139862a9 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -192,8 +192,8 @@ static void ipc_tx_next_msg(struct work_struct *work) } /* find original TX message from DSP reply */ -struct snd_sof_ipc_msg *sof_ipc_reply_find_msg(struct snd_sof_ipc *ipc, - u32 header) +static struct snd_sof_ipc_msg *sof_ipc_reply_find_msg(struct snd_sof_ipc *ipc, + u32 header) { struct snd_sof_dev *sdev = ipc->sdev; struct snd_sof_ipc_msg *msg; @@ -213,11 +213,10 @@ struct snd_sof_ipc_msg *sof_ipc_reply_find_msg(struct snd_sof_ipc *ipc, header); return NULL; } -EXPORT_SYMBOL(sof_ipc_reply_find_msg); /* mark IPC message as complete - locks held by caller */ -void sof_ipc_tx_msg_reply_complete(struct snd_sof_ipc *ipc, - struct snd_sof_ipc_msg *msg) +static void sof_ipc_tx_msg_reply_complete(struct snd_sof_ipc *ipc, + struct snd_sof_ipc_msg *msg) { msg->complete = true; wake_up(&msg->waitq); From 3fbc96aaceceffd226200b3c4ba85ca89a6e7e06 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Jul 2018 14:35:50 +0100 Subject: [PATCH 04/10] [SQUASHME] ASoC: SOF: topology: fix sparse warnings. Signed-off-by: Liam Girdwood --- sound/soc/sof/topology.c | 120 +++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 61 deletions(-) diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c index f9347384ecf3ad..143a191b381ad0 100644 --- a/sound/soc/sof/topology.c +++ b/sound/soc/sof/topology.c @@ -216,7 +216,7 @@ static const struct sof_frame_types sof_frames[] = { {"float", SOF_IPC_FRAME_FLOAT}, }; -static enum sof_ipc_dai_type find_format(const char *name) +static enum sof_ipc_frame find_format(const char *name) { int i; @@ -244,28 +244,25 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, struct sof_ipc_ctrl_data *cdata; /* validate topology data */ - if (mc->num_channels >= SND_SOC_TPLG_MAX_CHAN) + if (le32_to_cpu(mc->num_channels) >= SND_SOC_TPLG_MAX_CHAN) return -EINVAL; /* init the volume get/put data */ scontrol->size = sizeof(struct sof_ipc_ctrl_data) + - sizeof(struct sof_ipc_ctrl_value_chan) * mc->num_channels; + sizeof(struct sof_ipc_ctrl_value_chan) * + le32_to_cpu(mc->num_channels); scontrol->control_data = kzalloc(scontrol->size, GFP_KERNEL); cdata = scontrol->control_data; if (!scontrol->control_data) return -ENOMEM; scontrol->comp_id = sdev->next_comp_id; - scontrol->num_channels = mc->num_channels; + scontrol->num_channels = le32_to_cpu(mc->num_channels); dev_dbg(sdev->dev, "tplg: load kcontrol index %d chans %d\n", scontrol->comp_id, scontrol->num_channels); return 0; - /* configure channel IDs */ - //for (i = 0; i < mc->num_channels; i++) { - // v.pcm.chmap[i] = mc->channel[i].id; - //} } struct sof_topology_token { @@ -281,7 +278,7 @@ static int get_token_u32(void *elem, void *object, u32 offset, u32 size) struct snd_soc_tplg_vendor_value_elem *velem = elem; u32 *val = object + offset; - *val = velem->value; + *val = le32_to_cpu(velem->value); return 0; } @@ -495,7 +492,7 @@ static void sof_parse_uuid_tokens(struct snd_soc_component *scomp, int i, j; /* parse element by element */ - for (i = 0; i < array->num_elems; i++) { + for (i = 0; i < le32_to_cpu(array->num_elems); i++) { elem = &array->uuid[i]; /* search for token */ @@ -505,7 +502,7 @@ static void sof_parse_uuid_tokens(struct snd_soc_component *scomp, continue; /* match token id */ - if (tokens[j].token != elem->token) + if (tokens[j].token != le32_to_cpu(elem->token)) continue; /* matched - now load token */ @@ -525,7 +522,7 @@ static void sof_parse_string_tokens(struct snd_soc_component *scomp, int i, j; /* parse element by element */ - for (i = 0; i < array->num_elems; i++) { + for (i = 0; i < le32_to_cpu(array->num_elems); i++) { elem = &array->string[i]; /* search for token */ @@ -535,7 +532,7 @@ static void sof_parse_string_tokens(struct snd_soc_component *scomp, continue; /* match token id */ - if (tokens[j].token != elem->token) + if (tokens[j].token != le32_to_cpu(elem->token)) continue; /* matched - now load token */ @@ -559,7 +556,7 @@ static void sof_parse_word_tokens(struct snd_soc_component *scomp, u32 *index = NULL; /* parse element by element */ - for (i = 0; i < array->num_elems; i++) { + for (i = 0; i < le32_to_cpu(array->num_elems); i++) { elem = &array->value[i]; /* search for token */ @@ -570,7 +567,7 @@ static void sof_parse_word_tokens(struct snd_soc_component *scomp, continue; /* match token id */ - if (tokens[j].token != elem->token) + if (tokens[j].token != le32_to_cpu(elem->token)) continue; /* pdm config array index */ @@ -583,7 +580,8 @@ static void sof_parse_word_tokens(struct snd_soc_component *scomp, /* inc number of pdm array index */ if (index) - ++(*index); + (*index)++; + /* fallthrough */ case SOF_TKN_INTEL_DMIC_PDM_MIC_A_Enable: case SOF_TKN_INTEL_DMIC_PDM_MIC_B_Enable: case SOF_TKN_INTEL_DMIC_PDM_POLARITY_A: @@ -625,7 +623,7 @@ static int sof_parse_tokens(struct snd_soc_component *scomp, int asize; while (priv_size > 0) { - asize = array->size; + asize = le32_to_cpu(array->size); /* validate asize */ if (asize < 0) { /* FIXME: A zero-size array makes no sense */ @@ -643,7 +641,7 @@ static int sof_parse_tokens(struct snd_soc_component *scomp, } /* call correct parser depending on type */ - switch (array->type) { + switch (le32_to_cpu(array->type)) { case SND_SOC_TPLG_TUPLE_TYPE_UUID: sof_parse_uuid_tokens(scomp, object, tokens, count, array); @@ -702,7 +700,7 @@ static int sof_control_load(struct snd_soc_component *scomp, int index, scontrol->sdev = sdev; mutex_init(&scontrol->mutex); - switch (hdr->ops.info) { + switch (le32_to_cpu(hdr->ops.info)) { case SND_SOC_TPLG_CTL_VOLSW: case SND_SOC_TPLG_CTL_VOLSW_SX: case SND_SOC_TPLG_CTL_VOLSW_XR_SX: @@ -825,16 +823,16 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &comp_dai, dai_tokens, ARRAY_SIZE(dai_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse dai tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); return ret; } ret = sof_parse_tokens(scomp, &comp_dai.config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse dai.cfg tokens failed %d\n", private->size); @@ -880,7 +878,7 @@ static int sof_widget_load_buffer(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &buffer, buffer_tokens, ARRAY_SIZE(buffer_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse buffer tokens failed %d\n", private->size); @@ -921,7 +919,7 @@ static int sof_widget_load_pcm(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &host, pcm_tokens, ARRAY_SIZE(pcm_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse host tokens failed %d\n", private->size); @@ -930,10 +928,10 @@ static int sof_widget_load_pcm(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &host.config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse host.cfg tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); return ret; } @@ -982,7 +980,7 @@ static int sof_widget_load_pipeline(struct snd_soc_component *scomp, ret = sof_parse_tokens(scomp, &pipeline, sched_tokens, ARRAY_SIZE(sched_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse pipeline tokens failed %d\n", private->size); @@ -1022,7 +1020,7 @@ static int sof_widget_load_mixer(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &mixer.config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse mixer.cfg tokens failed %d\n", private->size); @@ -1054,7 +1052,7 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index, const unsigned int *p; int ret, tlv[TLV_ITEMS]; - if (tw->num_kcontrols != 1) { + if (le32_to_cpu(tw->num_kcontrols) != 1) { dev_err(sdev->dev, "error: invalid kcontrol count %d for volume\n", tw->num_kcontrols); return -EINVAL; @@ -1092,7 +1090,7 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &volume, volume_tokens, ARRAY_SIZE(volume_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse volume tokens failed %d\n", private->size); @@ -1100,10 +1098,10 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index, } ret = sof_parse_tokens(scomp, &volume.config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse volume.cfg tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); return ret; } @@ -1138,7 +1136,7 @@ static int sof_widget_load_src(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &src, src_tokens, ARRAY_SIZE(src_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse src tokens failed %d\n", private->size); @@ -1147,10 +1145,10 @@ static int sof_widget_load_src(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &src.config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse src.cfg tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); return ret; } @@ -1187,19 +1185,19 @@ static int sof_widget_load_siggen(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &tone, tone_tokens, ARRAY_SIZE(tone_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse tone tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); return ret; } ret = sof_parse_tokens(scomp, &tone.config, comp_tokens, ARRAY_SIZE(comp_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse tone.cfg tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); return ret; } @@ -1473,21 +1471,21 @@ static int sof_link_ssp_load(struct snd_soc_component *scomp, int index, ret = sof_parse_tokens(scomp, &config->ssp, ssp_tokens, ARRAY_SIZE(ssp_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse ssp tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); return ret; } - config->ssp.mclk_rate = hw_config->mclk_rate; - config->ssp.bclk_rate = hw_config->bclk_rate; - config->ssp.fsync_rate = hw_config->fsync_rate; - config->ssp.tdm_slots = hw_config->tdm_slots; - config->ssp.tdm_slot_width = hw_config->tdm_slot_width; + config->ssp.mclk_rate = le32_to_cpu(hw_config->mclk_rate); + config->ssp.bclk_rate = le32_to_cpu(hw_config->bclk_rate); + config->ssp.fsync_rate = le32_to_cpu(hw_config->fsync_rate); + config->ssp.tdm_slots = le32_to_cpu(hw_config->tdm_slots); + config->ssp.tdm_slot_width = le32_to_cpu(hw_config->tdm_slot_width); config->ssp.mclk_direction = hw_config->mclk_direction; - config->ssp.rx_slots = hw_config->rx_slots; - config->ssp.tx_slots = hw_config->tx_slots; + config->ssp.rx_slots = le32_to_cpu(hw_config->rx_slots); + config->ssp.tx_slots = le32_to_cpu(hw_config->tx_slots); dev_dbg(sdev->dev, "tplg: config SSP%d fmt 0x%x mclk %d bclk %d fclk %d width (%d)%d slots %d mclk id %d\n", config->id, config->format, @@ -1525,10 +1523,10 @@ static int sof_link_dmic_load(struct snd_soc_component *scomp, int index, /* get DMIC tokens */ ret = sof_parse_tokens(scomp, &config->dmic, dmic_tokens, ARRAY_SIZE(dmic_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse dmic tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); return ret; } @@ -1557,10 +1555,10 @@ static int sof_link_dmic_load(struct snd_soc_component *scomp, int index, /* get DMIC PDM tokens */ ret = sof_parse_tokens(scomp, &ipc_config->dmic.pdm[0], dmic_pdm_tokens, ARRAY_SIZE(dmic_pdm_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse dmic pdm tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); kfree(ipc_config); return ret; } @@ -1633,10 +1631,10 @@ static int sof_link_hda_load(struct snd_soc_component *scomp, int index, /* get any bespoke DAI tokens */ ret = sof_parse_tokens(scomp, config, hda_tokens, ARRAY_SIZE(hda_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse hda tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); return ret; } @@ -1675,14 +1673,14 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, return 0; /* only support 1 config atm */ - if (cfg->num_hw_configs != 1) { + if (le32_to_cpu(cfg->num_hw_configs) != 1) { dev_err(sdev->dev, "error: unexpected DAI config count %d\n", - cfg->num_hw_configs); + le32_to_cpu(cfg->num_hw_configs)); return -EINVAL; } /* check we have some tokens - we need at least DAI type */ - if (private->size == 0) { + if (le32_to_cpu(private->size) == 0) { dev_err(sdev->dev, "error: expected tokens for DAI, none found\n"); return -EINVAL; } @@ -1692,10 +1690,10 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, /* get any common DAI tokens */ ret = sof_parse_tokens(scomp, &config, dai_link_tokens, ARRAY_SIZE(dai_link_tokens), private->array, - private->size); + le32_to_cpu(private->size)); if (ret != 0) { dev_err(sdev->dev, "error: parse link tokens failed %d\n", - private->size); + le32_to_cpu(private->size)); return ret; } @@ -1703,8 +1701,8 @@ static int sof_link_load(struct snd_soc_component *scomp, int index, hw_config = &cfg->hw_config[0]; config.hdr.cmd = SOF_IPC_GLB_DAI_MSG | SOF_IPC_DAI_CONFIG; - config.id = hw_config->id; - config.format = hw_config->fmt; + config.id = le32_to_cpu(hw_config->id); + config.format = le32_to_cpu(hw_config->fmt); /* now load DAI specific data and send IPC - type comes from token */ switch (config.type) { From c023b55fdc08efc8e4e7f88d2265edff44ea4a0f Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Jul 2018 14:36:08 +0100 Subject: [PATCH 05/10] [SQUASHME] ASoC: SOF: trace: fix sparse warnings. Signed-off-by: Liam Girdwood --- sound/soc/sof/trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/trace.c b/sound/soc/sof/trace.c index dc452ad6109359..d3aa6e4b46a5f7 100644 --- a/sound/soc/sof/trace.c +++ b/sound/soc/sof/trace.c @@ -74,7 +74,7 @@ static int sof_wait_trace_avail(struct snd_sof_dev *sdev, size_t *count, static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { - struct snd_sof_dfsentry *dfse = file->private_data; + struct snd_sof_dfsentry_buf *dfse = file->private_data; struct snd_sof_dev *sdev = dfse->sdev; int err; loff_t pos = *ppos; @@ -130,7 +130,7 @@ static const struct file_operations sof_dfs_trace_fops = { static int trace_debugfs_create(struct snd_sof_dev *sdev) { - struct snd_sof_dfsentry *dfse; + struct snd_sof_dfsentry_buf *dfse; if (!sdev) return -EINVAL; From c764884be50142fd585965070e930f7a7181f26e Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Jul 2018 14:36:20 +0100 Subject: [PATCH 06/10] [SQUASHME] ASoC: SOF: pcm: fix sparse warnings. Signed-off-by: Liam Girdwood --- sound/soc/sof/pcm.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 2ab73d1518c571..92da3074f286ef 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -291,10 +291,10 @@ static int sof_pcm_open(struct snd_pcm_substream *substream) /* set any runtime constraints based on topology */ snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, - caps->period_size_min); + le32_to_cpu(caps->period_size_min)); snd_pcm_hw_constraint_step(substream->runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, - caps->period_size_min); + le32_to_cpu(caps->period_size_min)); /* set runtime config */ runtime->hw.info = SNDRV_PCM_INFO_MMAP | @@ -303,12 +303,12 @@ static int sof_pcm_open(struct snd_pcm_substream *substream) SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_NO_PERIOD_WAKEUP; - runtime->hw.formats = caps->formats; - runtime->hw.period_bytes_min = caps->period_size_min; - runtime->hw.period_bytes_max = caps->period_size_max; - runtime->hw.periods_min = caps->periods_min; - runtime->hw.periods_max = caps->periods_max; - runtime->hw.buffer_bytes_max = caps->buffer_size_max; + runtime->hw.formats = le64_to_cpu(caps->formats); + runtime->hw.period_bytes_min = le32_to_cpu(caps->period_size_min); + runtime->hw.period_bytes_max = le32_to_cpu(caps->period_size_max); + runtime->hw.periods_min = le32_to_cpu(caps->periods_min); + runtime->hw.periods_max = le32_to_cpu(caps->periods_max); + runtime->hw.buffer_bytes_max = le32_to_cpu(caps->buffer_size_max); dev_dbg(sdev->dev, "period min %zd max %zd bytes\n", runtime->hw.period_bytes_min, @@ -398,8 +398,8 @@ static int sof_pcm_new(struct snd_soc_pcm_runtime *rtd) ret = snd_pcm_lib_preallocate_pages(pcm->streams[stream].substream, SNDRV_DMA_TYPE_DEV_SG, sdev->parent, - caps->buffer_size_min, - caps->buffer_size_max); + le32_to_cpu(caps->buffer_size_min), + le32_to_cpu(caps->buffer_size_max)); if (ret) { dev_err(sdev->dev, "error: can't alloc DMA buffer size 0x%x/0x%x for %s %d\n", caps->buffer_size_min, caps->buffer_size_max, @@ -431,8 +431,8 @@ static int sof_pcm_new(struct snd_soc_pcm_runtime *rtd) ret = snd_pcm_lib_preallocate_pages(pcm->streams[stream].substream, SNDRV_DMA_TYPE_DEV_SG, sdev->parent, - caps->buffer_size_min, - caps->buffer_size_max); + le32_to_cpu(caps->buffer_size_min), + le32_to_cpu(caps->buffer_size_max)); if (ret) { dev_err(sdev->dev, "error: can't alloc DMA buffer size 0x%x/0x%x for %s %d\n", caps->buffer_size_min, caps->buffer_size_max, @@ -506,7 +506,7 @@ static int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, channels->max = 2; snd_mask_none(fmt); - snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE); + snd_mask_set(fmt, (__force int)SNDRV_PCM_FORMAT_S16_LE); return 0; } @@ -516,13 +516,13 @@ static int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, switch (dai->comp_dai.config.frame_fmt) { case SOF_IPC_FRAME_S16_LE: - snd_mask_set(fmt, SNDRV_PCM_FORMAT_S16_LE); + snd_mask_set(fmt, (__force int)SNDRV_PCM_FORMAT_S16_LE); break; case SOF_IPC_FRAME_S24_4LE: - snd_mask_set(fmt, SNDRV_PCM_FORMAT_S24_LE); + snd_mask_set(fmt, (__force int)SNDRV_PCM_FORMAT_S24_LE); break; case SOF_IPC_FRAME_S32_LE: - snd_mask_set(fmt, SNDRV_PCM_FORMAT_S32_LE); + snd_mask_set(fmt, (__force int)SNDRV_PCM_FORMAT_S32_LE); break; default: dev_err(sdev->dev, "No available DAI format!\n"); From e45f078d37849e23b28046a1d7925dbf4be2b260 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Jul 2018 14:36:39 +0100 Subject: [PATCH 07/10] [SQUASHME] ASoC: SOF: hsw: fix sparse warnings. Signed-off-by: Liam Girdwood --- sound/soc/sof/intel/hsw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/intel/hsw.c b/sound/soc/sof/intel/hsw.c index 1a8cbd3af50e13..d81f8de3d65608 100644 --- a/sound/soc/sof/intel/hsw.c +++ b/sound/soc/sof/intel/hsw.c @@ -88,12 +88,12 @@ static void hsw_block_write(struct snd_sof_dev *sdev, u32 offset, void *src, n = size % 4; /* __iowrite32_copy use 32bit size values so divide by 4 */ - __iowrite32_copy((void *)dest, src, m); + __iowrite32_copy(dest, src, m); if (n) { for (i = 0; i < n; i++) tmp |= (u32)*(src_byte + m * 4 + i) << (i * 8); - __iowrite32_copy((void *)(dest + m * 4), &tmp, 1); + __iowrite32_copy(dest + m * 4, &tmp, 1); } } From cc55919cb2fb71f6da7c26ae5f5cdba8f3f92d3e Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Jul 2018 14:37:22 +0100 Subject: [PATCH 08/10] [SQUASHME] ASoC: SOF: bdw: fix sparse warnings. Signed-off-by: Liam Girdwood --- sound/soc/sof/intel/bdw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/intel/bdw.c b/sound/soc/sof/intel/bdw.c index dc21d1fac43323..f76463abe07fa5 100644 --- a/sound/soc/sof/intel/bdw.c +++ b/sound/soc/sof/intel/bdw.c @@ -87,12 +87,12 @@ static void bdw_block_write(struct snd_sof_dev *sdev, u32 offset, void *src, n = size % 4; /* __iowrite32_copy use 32bit size values so divide by 4 */ - __iowrite32_copy((void *)dest, src, m); + __iowrite32_copy(dest, src, m); if (n) { for (i = 0; i < n; i++) tmp |= (u32)*(src_byte + m * 4 + i) << (i * 8); - __iowrite32_copy((void *)(dest + m * 4), &tmp, 1); + __iowrite32_copy(dest + m * 4, &tmp, 1); } } From 0290ba7cb3a7ad62fb2952a8ecfa1727dcf53f76 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Jul 2018 14:37:38 +0100 Subject: [PATCH 09/10] [SQUASHME] ASoC: SOF: byt: fix sparse warnings. Signed-off-by: Liam Girdwood --- sound/soc/sof/intel/byt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/intel/byt.c b/sound/soc/sof/intel/byt.c index 49ec019b45d0fa..9d06dd312f56d8 100644 --- a/sound/soc/sof/intel/byt.c +++ b/sound/soc/sof/intel/byt.c @@ -140,12 +140,12 @@ static void byt_block_write(struct snd_sof_dev *sdev, u32 offset, void *src, n = size % 4; /* __iowrite32_copy use 32bit size values so divide by 4 */ - __iowrite32_copy((void *)dest, src, m); + __iowrite32_copy(dest, src, m); if (n) { for (i = 0; i < n; i++) tmp |= (u32)*(src_byte + m * 4 + i) << (i * 8); - __iowrite32_copy((void *)(dest + m * 4), &tmp, 1); + __iowrite32_copy(dest + m * 4, &tmp, 1); } } From 7de8df0d32687fb0a9765c44711643a1de4e0fd7 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Thu, 5 Jul 2018 14:38:07 +0100 Subject: [PATCH 10/10] [SQUASHME] ASoC: SOF: hda: fix sparse warnings. Signed-off-by: Liam Girdwood --- sound/soc/sof/intel/hda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c index 7949d6d5508025..781a2f4a135ae5 100644 --- a/sound/soc/sof/intel/hda.c +++ b/sound/soc/sof/intel/hda.c @@ -77,12 +77,12 @@ void hda_dsp_block_write(struct snd_sof_dev *sdev, u32 offset, void *src, n = size % 4; /* __iowrite32_copy use 32bit size values so divide by 4 */ - __iowrite32_copy((void *)dest, src, m); + __iowrite32_copy(dest, src, m); if (n) { for (i = 0; i < n; i++) tmp |= (u32)*(src_byte + m * 4 + i) << (i * 8); - __iowrite32_copy((void *)(dest + m * 4), &tmp, 1); + __iowrite32_copy(dest + m * 4, &tmp, 1); } }