Re: [PATCH v3 03/25] ASoC: qcom: qdsp6: Add common qdsp6 helper functions

From: Mark Brown
Date: Thu Mar 01 2018 - 16:04:47 EST


On Tue, Feb 13, 2018 at 04:58:15PM +0000, srinivas.kandagatla@xxxxxxxxxx wrote:

> +config SND_SOC_QDSP6_COMMON
> + tristate
> + default n
> +

Ah, the other default n that had snuck in was actually in an earlier
patch in the series! I'm fairly sure this has come up with earlier
drivers you've submitted...

> +int q6dsp_map_channels(u8 ch_map[PCM_FORMAT_MAX_NUM_CHANNEL], int ch)
> +{
> + memset(ch_map, 0, PCM_FORMAT_MAX_NUM_CHANNEL);
> +
> + switch (ch) {
> + case 1:
> + ch_map[0] = PCM_CHANNEL_FC;
> + break;
> + case 2:
> + ch_map[0] = PCM_CHANNEL_FL;
> + ch_map[1] = PCM_CHANNEL_FR;
> + break;

That's some really funky indentation there...

> +static inline int q6dsp_errno(u32 error)
> +{
> + int ret = -EINVAL;
> +
> + if (error <= ARRAY_SIZE(q6dsp_err_codes))
> + ret = q6dsp_err_codes[error].lnx_err_code;
> +
> + return ret;
> +}

Is the error handling such a hot path that we need to make the lookup
functions (and the data table with the lookups) static inlines in a
header or could we just move the functions and the data into a C file?
Especially given the string lookups for the errors (which are really
nice to have) it seems wasteful.

Attachment: signature.asc
Description: PGP signature