Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>
To: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	alsa-devel@alsa-project.org
Cc: tiwai@suse.de, "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	broonie@kernel.org, "Bard Liao" <yung-chuan.liao@linux.intel.com>,
	"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>
Subject: Re: [PATCH 11/18] ASoC: SOF: make struct snd_sof_widget IPC agnostic
Date: Mon, 7 Mar 2022 19:55:31 +0100	[thread overview]
Message-ID: <cb8673b3-2306-9582-1434-7b173a5d6c30@linux.intel.com> (raw)
In-Reply-To: <20220307181111.49392-12-ranjani.sridharan@linux.intel.com>

On 3/7/2022 7:11 PM, Ranjani Sridharan wrote:
> Parse the UUID token and save it in the new uuid field in struct
> snd_sof_widget. struct sof_ipc_comp_ext is no longer needed. So remove
> it too.
> 
> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>   include/sound/sof/topology.h |  5 -----
>   sound/soc/sof/sof-audio.h    |  3 +--
>   sound/soc/sof/topology.c     | 20 ++++++++++----------
>   3 files changed, 11 insertions(+), 17 deletions(-)
> 
> diff --git a/include/sound/sof/topology.h b/include/sound/sof/topology.h
> index adee6afd1490..33bd9eaffd50 100644
> --- a/include/sound/sof/topology.h
> +++ b/include/sound/sof/topology.h
> @@ -303,9 +303,4 @@ enum sof_event_types {
>   	SOF_KEYWORD_DETECT_DAPM_EVENT,
>   };
>   
> -/* extended data struct for UUID components */
> -struct sof_ipc_comp_ext {
> -	uint8_t uuid[SOF_UUID_SIZE];
> -}  __packed;
> -
>   #endif
> diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h
> index a8eeffc12b24..5c10df500ffb 100644
> --- a/sound/soc/sof/sof-audio.h
> +++ b/sound/soc/sof/sof-audio.h
> @@ -110,8 +110,7 @@ struct snd_sof_widget {
>   	struct list_head list;	/* list in sdev widget list */
>   	struct snd_sof_widget *pipe_widget;
>   
> -	/* extended data for UUID components */
> -	struct sof_ipc_comp_ext comp_ext;
> +	u8 uuid[SOF_UUID_SIZE];

Can this be uuid_t perhaps?

>   
>   	void *private;		/* core does not touch this */
>   };
> diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
> index 41927e99ace2..45bac1ac9fdd 100644
> --- a/sound/soc/sof/topology.c
> +++ b/sound/soc/sof/topology.c
> @@ -743,7 +743,7 @@ static const struct sof_topology_token core_tokens[] = {
>   static const struct sof_topology_token comp_ext_tokens[] = {
>   	{SOF_TKN_COMP_UUID,
>   		SND_SOC_TPLG_TUPLE_TYPE_UUID, get_token_uuid,
> -		offsetof(struct sof_ipc_comp_ext, uuid)},
> +		offsetof(struct snd_sof_widget, uuid)},
>   };
>   
>   /*
> @@ -1419,16 +1419,17 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
>    *
>    * Return: The pointer to the new allocated component, NULL if failed.
>    */
> -static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget,
> -					   size_t *ipc_size, int index)
> +static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget, size_t *ipc_size,
> +					   int index)
>   {
>   	u8 nil_uuid[SOF_UUID_SIZE] = {0};
>   	struct sof_ipc_comp *comp;
>   	size_t total_size = *ipc_size;
> +	size_t ext_size = sizeof(swidget->uuid);
>   
>   	/* only non-zero UUID is valid */
> -	if (memcmp(&swidget->comp_ext, nil_uuid, SOF_UUID_SIZE))
> -		total_size += sizeof(swidget->comp_ext);
> +	if (memcmp(swidget->uuid, nil_uuid, SOF_UUID_SIZE))
> +		total_size += ext_size;

And if you change type above then uuid_is_null(swidget->uuid) here?

>   
>   	comp = kzalloc(total_size, GFP_KERNEL);
>   	if (!comp)
> @@ -1444,8 +1445,8 @@ static struct sof_ipc_comp *sof_comp_alloc(struct snd_sof_widget *swidget,
>   	/* handle the extended data if needed */
>   	if (total_size > *ipc_size) {
>   		/* append extended data to the end of the component */
> -		memcpy((u8 *)comp + *ipc_size, &swidget->comp_ext, sizeof(swidget->comp_ext));
> -		comp->ext_data_length = sizeof(swidget->comp_ext);
> +		memcpy((u8 *)comp + *ipc_size, swidget->uuid, ext_size);
and uuid_copy() here?

> +		comp->ext_data_length = ext_size;
>   	}
>   
>   	/* update ipc_size and return */
> @@ -2276,9 +2277,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
>   
>   	swidget->core = comp.core;
>   
> -	ret = sof_parse_tokens(scomp, &swidget->comp_ext, comp_ext_tokens,
> -			       ARRAY_SIZE(comp_ext_tokens), tw->priv.array,
> -			       le32_to_cpu(tw->priv.size));
> +	ret = sof_parse_tokens(scomp, swidget, comp_ext_tokens, ARRAY_SIZE(comp_ext_tokens),
> +			       tw->priv.array, le32_to_cpu(tw->priv.size));
>   	if (ret != 0) {
>   		dev_err(scomp->dev, "error: parsing comp_ext_tokens failed %d\n",
>   			ret);


  reply	other threads:[~2022-03-07 18:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 18:10 [PATCH 00/18] Clean ups and preparation for IPC abstraction in the SOF driver Ranjani Sridharan
2022-03-07 18:10 ` [PATCH 01/18] ASoC: SOF: remove snd_sof_pipeline_find() Ranjani Sridharan
2022-03-07 18:10 ` [PATCH 02/18] ASoC: SOF: simplify snd_sof_device_remove() Ranjani Sridharan
2022-03-07 18:10 ` [PATCH 03/18] ASoC: SOF: set swidget's core for scheduler widget Ranjani Sridharan
2022-03-07 18:10 ` [PATCH 04/18] ASoC: SOF: sof-audio: removed unused function Ranjani Sridharan
2022-03-07 18:10 ` [PATCH 05/18] ASoC: SOF: topology: remove redundant code Ranjani Sridharan
2022-03-07 18:10 ` [PATCH 06/18] ASoC: SOF: topology: remove redundant code in sof_link_afe_load() Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 07/18] ASoC: SOF: topology: Drop the size parameter from struct sof_topology_token Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 08/18] ASoC: SOF: topology: Modify the get_token op for string tokens Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 09/18] ASoC: SOF: topology: expose some get_token ops Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 10/18] ASoC: SOF: change comp_dai to a pointer in struct snd_sof_dai Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 11/18] ASoC: SOF: make struct snd_sof_widget IPC agnostic Ranjani Sridharan
2022-03-07 18:55   ` Amadeusz Sławiński [this message]
2022-03-07 19:51     ` Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 12/18] ASoC: SOF: topology: make sof_route_load() " Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 13/18] ASoC: SOF: Add a tuples array to struct snd_sof_widget Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 14/18] ASoC: SOF: topology: Modify signature for token parsing functions Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 15/18] ASoC: SOF: topology: Rename arguments in sof_parse_token_sets() Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 16/18] ASoC: SOF: topology: Rename arguments in sof_parse_tokens() Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 17/18] ASoC: SOF: make struct snd_sof_dai IPC agnostic Ranjani Sridharan
2022-03-07 18:11 ` [PATCH 18/18] ASoC: SOF: move definition of snd_sof_ipc to header file Ranjani Sridharan
2022-03-08 17:20 ` [PATCH 00/18] Clean ups and preparation for IPC abstraction in the SOF driver Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb8673b3-2306-9582-1434-7b173a5d6c30@linux.intel.com \
    --to=amadeuszx.slawinski@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox