[PATCH 11/18] ASoC: SOF: make struct snd_sof_widget IPC agnostic

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Mon Mar 7 20:51:12 CET 2022


On Mon, 2022-03-07 at 19:55 +0100, Amadeusz Sławiński wrote:
...
> 
> > +	u8 uuid[SOF_UUID_SIZE];
> 
> Can this be uuid_t perhaps?
Yes, makes sense.

...
> >   	/* 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?
Sure.
> 
> >   
> >   	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?
But I'd like to retain the memcpy() here as this is IPC payload and the
ipc struct does not contain the uuid field.
Thanks,
Ranjani



More information about the Alsa-devel mailing list