[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200414020748.GB10195@Asurada-Nvidia.nvidia.com>
Date: Mon, 13 Apr 2020 19:07:49 -0700
From: Nicolin Chen <nicoleotsuka@...il.com>
To: Shengjiu Wang <shengjiu.wang@....com>
Cc: timur@...nel.org, Xiubo.Lee@...il.com, festevam@...il.com,
broonie@...nel.org, alsa-devel@...a-project.org,
lgirdwood@...il.com, perex@...ex.cz, tiwai@...e.com,
robh+dt@...nel.org, mark.rutland@....com,
devicetree@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 5/7] ASoC: fsl_asrc: Move common definition to
fsl_asrc_common
On Tue, Apr 14, 2020 at 08:43:07AM +0800, Shengjiu Wang wrote:
> There is a new ASRC included in i.MX serial platform, there
> are some common definition can be shared with each other.
> So move the common definition to a separate header file.
>
> And add fsl_asrc_pair_priv and fsl_asrc_priv for
> the variable specific for the module, which can be used
> internally.
>
> Signed-off-by: Shengjiu Wang <shengjiu.wang@....com>
> diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
> +static size_t fsl_asrc_get_pair_priv_size(void)
> +{
> + return sizeof(struct fsl_asrc_pair_priv);
> +}
Perhaps we haven't understood completely each other's point.
Yet, would the following change work?
> diff --git a/sound/soc/fsl/fsl_asrc_common.h b/sound/soc/fsl/fsl_asrc_common.h
> new file mode 100644
> index 000000000000..b15244e027d0
> --- /dev/null
> +++ b/sound/soc/fsl/fsl_asrc_common.h
> +struct fsl_asrc {
> + size_t (*get_pair_priv_size)(void);
+ size_t pair_priv_size;
> diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
> @@ -992,25 +1012,32 @@ static int fsl_asrc_probe(struct platform_device *pdev)
> + asrc->get_pair_priv_size = fsl_asrc_get_pair_priv_size;
+ asrc->pair_priv_size = sizeof(struct fsl_asrc_pair_priv);
> diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c
> @@ -311,11 +311,12 @@ static int fsl_asrc_dma_startup(struct snd_soc_component *component,
> return ret;
> }
>
> - pair = kzalloc(sizeof(struct fsl_asrc_pair), GFP_KERNEL);
> + pair = kzalloc(sizeof(*pair) + asrc->get_pair_priv_size(), GFP_KERNEL);
+ pair = kzalloc(sizeof(*pair) + asrc->pair_priv_size, GFP_KERNEL);
Powered by blists - more mailing lists