Skip to content

Commit

Permalink
ASoC: SOF: IPC: remove a superfluous argument from functions
Browse files Browse the repository at this point in the history
.block_read() and .block_write() operations as well as their
respective implementations sof_block_read() and sof_block_write()
are always used with the MMIO BAR. Remove the argument and specify
the BAR explicitly.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
  • Loading branch information
lyakh committed Apr 9, 2019
1 parent 71f992c commit e044b43
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 32 deletions.
4 changes: 2 additions & 2 deletions sound/soc/sof/hw-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* Memory copy.
*/

static void spi_block_read(struct snd_sof_dev *sdev, u32 bar, u32 offset,
static void spi_block_read(struct snd_sof_dev *sdev, u32 offset,
void *dest, size_t size)
{
u8 *buf;
Expand All @@ -62,7 +62,7 @@ static void spi_block_read(struct snd_sof_dev *sdev, u32 bar, u32 offset,
}
}

static void spi_block_write(struct snd_sof_dev *sdev, u32 bar, u32 offset,
static void spi_block_write(struct snd_sof_dev *sdev, u32 offset,
void *src, size_t size)
{
int ret;
Expand Down
3 changes: 1 addition & 2 deletions sound/soc/sof/intel/bdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,7 @@ static int bdw_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
return 0;

/* copy data from the DSP FW ready offset */
sof_block_read(sdev, sdev->mmio_bar, offset, fw_ready,
sizeof(*fw_ready));
sof_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));

snd_sof_dsp_mailbox_init(sdev, fw_ready->dspbox_offset,
fw_ready->dspbox_size,
Expand Down
3 changes: 1 addition & 2 deletions sound/soc/sof/intel/byt.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ static int byt_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
return 0;

/* copy data from the DSP FW ready offset */
sof_block_read(sdev, sdev->mmio_bar, offset, fw_ready,
sizeof(*fw_ready));
sof_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));

snd_sof_dsp_mailbox_init(sdev, fw_ready->dspbox_offset,
fw_ready->dspbox_size,
Expand Down
3 changes: 1 addition & 2 deletions sound/soc/sof/intel/hda-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,7 @@ int hda_dsp_ipc_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
return 0;

/* copy data from the DSP FW ready offset */
sof_block_read(sdev, sdev->mmio_bar, offset, fw_ready,
sizeof(*fw_ready));
sof_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));

/* make sure ABI version is compatible */
ret = snd_sof_ipc_valid(sdev);
Expand Down
6 changes: 3 additions & 3 deletions sound/soc/sof/intel/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ static void hda_dsp_get_registers(struct snd_sof_dev *sdev,
u32 *stack, size_t stack_words)
{
/* first read registers */
sof_block_read(sdev, sdev->mmio_bar, sdev->dsp_oops_offset, xoops,
sof_block_read(sdev, sdev->dsp_oops_offset, xoops,
sizeof(*xoops));

/* then get panic info */
sof_block_read(sdev, sdev->mmio_bar, sdev->dsp_oops_offset +
sof_block_read(sdev, sdev->dsp_oops_offset +
sizeof(*xoops), panic_info, sizeof(*panic_info));

/* then get the stack */
sof_block_read(sdev, sdev->mmio_bar, sdev->dsp_oops_offset +
sof_block_read(sdev, sdev->dsp_oops_offset +
sizeof(*xoops) + sizeof(*panic_info), stack,
stack_words * sizeof(u32));
}
Expand Down
3 changes: 1 addition & 2 deletions sound/soc/sof/intel/hsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,7 @@ static int hsw_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
return 0;

/* copy data from the DSP FW ready offset */
sof_block_read(sdev, sdev->mmio_bar, offset, fw_ready,
sizeof(*fw_ready));
sof_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));

snd_sof_dsp_mailbox_init(sdev, fw_ready->dspbox_offset,
fw_ready->dspbox_size,
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/sof/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,12 +645,12 @@ int snd_sof_ipc_set_get_comp_data(struct snd_sof_ipc *ipc,
send_bytes = sizeof(struct sof_ipc_ctrl_value_chan) *
cdata->num_elems;
if (send)
snd_sof_dsp_block_write(sdev, sdev->mmio_bar,
snd_sof_dsp_block_write(sdev,
scontrol->readback_offset,
cdata->chanv, send_bytes);

else
snd_sof_dsp_block_read(sdev, sdev->mmio_bar,
snd_sof_dsp_block_read(sdev,
scontrol->readback_offset,
cdata->chanv, send_bytes);
return 0;
Expand Down
9 changes: 4 additions & 5 deletions sound/soc/sof/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 offset)
return -ENOMEM;

/* get first header */
snd_sof_dsp_block_read(sdev, sdev->mmio_bar, offset, ext_data,
snd_sof_dsp_block_read(sdev, offset, ext_data,
sizeof(*ext_hdr));
ext_hdr = ext_data;

while (ext_hdr->hdr.cmd == SOF_IPC_FW_READY) {
/* read in ext structure */
offset += sizeof(*ext_hdr);
snd_sof_dsp_block_read(sdev, sdev->mmio_bar, offset,
snd_sof_dsp_block_read(sdev, offset,
(void *)((u8 *)ext_data + sizeof(*ext_hdr)),
ext_hdr->hdr.size - sizeof(*ext_hdr));

Expand All @@ -79,7 +79,7 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 offset)

/* move to next header */
offset += ext_hdr->hdr.size;
snd_sof_dsp_block_read(sdev, sdev->mmio_bar, offset, ext_data,
snd_sof_dsp_block_read(sdev, offset, ext_data,
sizeof(*ext_hdr));
ext_hdr = ext_data;
}
Expand Down Expand Up @@ -145,8 +145,7 @@ int snd_sof_parse_module_memcpy(struct snd_sof_dev *sdev,
block->size);
return -EINVAL;
}
snd_sof_dsp_block_write(sdev, sdev->mmio_bar, offset,
block + 1, block->size);
snd_sof_dsp_block_write(sdev, offset, block + 1, block->size);

/* minus body size of block */
remaining -= block->size;
Expand Down
8 changes: 4 additions & 4 deletions sound/soc/sof/ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,22 +199,22 @@ static inline u64 snd_sof_dsp_read64(struct snd_sof_dev *sdev, u32 bar,
}

/* block IO */
static inline void snd_sof_dsp_block_read(struct snd_sof_dev *sdev, u32 bar,
static inline void snd_sof_dsp_block_read(struct snd_sof_dev *sdev,
u32 offset, void *dest, size_t bytes)
{
if (sof_ops(sdev)->block_read) {
sof_ops(sdev)->block_read(sdev, bar, offset, dest, bytes);
sof_ops(sdev)->block_read(sdev, offset, dest, bytes);
return;
}

dev_err_ratelimited(sdev->dev, "error: %s not defined\n", __func__);
}

static inline void snd_sof_dsp_block_write(struct snd_sof_dev *sdev, u32 bar,
static inline void snd_sof_dsp_block_write(struct snd_sof_dev *sdev,
u32 offset, void *src, size_t bytes)
{
if (sof_ops(sdev)->block_write) {
sof_ops(sdev)->block_write(sdev, bar, offset, src, bytes);
sof_ops(sdev)->block_write(sdev, offset, src, bytes);
return;
}

Expand Down
8 changes: 4 additions & 4 deletions sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ struct snd_sof_dsp_ops {
void __iomem *addr); /* mandatory */

/* memcpy IO */
void (*block_read)(struct snd_sof_dev *sof_dev, u32 bar,
void (*block_read)(struct snd_sof_dev *sof_dev,
u32 offset, void *dest,
size_t size); /* mandatory */
void (*block_write)(struct snd_sof_dev *sof_dev, u32 bar,
void (*block_write)(struct snd_sof_dev *sof_dev,
u32 offset, void *src,
size_t size); /* mandatory */

Expand Down Expand Up @@ -608,9 +608,9 @@ void sof_mailbox_write(struct snd_sof_dev *sdev, u32 offset,
void *message, size_t bytes);
void sof_mailbox_read(struct snd_sof_dev *sdev, u32 offset,
void *message, size_t bytes);
void sof_block_write(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *src,
void sof_block_write(struct snd_sof_dev *sdev, u32 offset, void *src,
size_t size);
void sof_block_read(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *dest,
void sof_block_read(struct snd_sof_dev *sdev, u32 offset, void *dest,
size_t size);

void intel_ipc_msg_data(struct snd_sof_dev *sdev,
Expand Down
8 changes: 4 additions & 4 deletions sound/soc/sof/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ EXPORT_SYMBOL(sof_mailbox_read);
* Memory copy.
*/

void sof_block_write(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *src,
void sof_block_write(struct snd_sof_dev *sdev, u32 offset, void *src,
size_t size)
{
void __iomem *dest = sdev->bar[bar] + offset;
void __iomem *dest = sdev->bar[sdev->mmio_bar] + offset;
const u8 *src_byte = src;
u32 affected_mask;
u32 tmp;
Expand Down Expand Up @@ -102,10 +102,10 @@ void sof_block_write(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *src,
}
EXPORT_SYMBOL(sof_block_write);

void sof_block_read(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *dest,
void sof_block_read(struct snd_sof_dev *sdev, u32 offset, void *dest,
size_t size)
{
void __iomem *src = sdev->bar[bar] + offset;
void __iomem *src = sdev->bar[sdev->mmio_bar] + offset;

memcpy_fromio(dest, src, size);
}
Expand Down

0 comments on commit e044b43

Please sign in to comment.