[alsa-devel] [RESEND PATCH v2 3/3] ucm: Execute sequence of component devices

Lin, Mengdong mengdong.lin at intel.com
Mon Nov 28 04:12:26 CET 2016


> -----Original Message-----
> From: Liam Girdwood [mailto:liam.r.girdwood at linux.intel.com]
> Sent: Thursday, November 24, 2016 8:04 PM
> >
> >  /*
> >   * misc
> > @@ -48,6 +49,30 @@ static int get_value3(char **value,
> >  		      struct list_head *value_list2,
> >  		      struct list_head *value_list3);
> >
> > +/* enter component domain and store cdev for the component */ #define
> > +ENTER_COMPONENT_DOMAIN(uc_mgr, cdev) \
> > +	do {\
> > +		(uc_mgr)->in_component_domain = 1;\
> > +		(uc_mgr)->cdev = (cdev);\
> > +	} while (0)
> > +
> > +/* exit component domain and clear cdev */ #define
> > +EXIT_COMPONENT_DOMAIN(uc_mgr) \
> > +	do {\
> > +		(uc_mgr)->in_component_domain = 0;\
> > +		(uc_mgr)->cdev = NULL;\
> > +	} while (0)
> > +
> 
> Do we need these macros ? It seems like we only use these once.

I'll remove these macros. Yes, we only use them once.

> 
> > +#define IN_COMPONENT_DOMAIN(uc_mgr) \
> > +	((uc_mgr)->in_component_domain)
> > +
> 
> cant see where we use this ? Is it not just better to use "if (uc_mgr-
> >in_component_domain)"

We use it only once in execute_sequence() in the code below. I'll replace the macro with "if ..." as you suggested.

Thanks
Mengdong

> 
> > @@ -366,7 +391,19 @@ static int execute_sequence(snd_use_case_mgr_t
> *uc_mgr,
> >  		case SEQUENCE_ELEMENT_TYPE_CSET:
> >  		case SEQUENCE_ELEMENT_TYPE_CSET_BIN_FILE:
> >  		case SEQUENCE_ELEMENT_TYPE_CSET_TLV:
> > -			if (cdev == NULL) {
> > +			if (cdev == NULL &&
> IN_COMPONENT_DOMAIN(uc_mgr)) {
> > +				/* For sequence of a component device, use
> > +				 * parent's cdev stored by ucm manager.
> > +				 */
> > +				if (uc_mgr->cdev == NULL) {
> > +					uc_error("cdev is not defined!");
> > +					return err;
> > +				}
> > +
> > +				cdev = strndup(uc_mgr->cdev, PATH_MAX);
> > +				if (!cdev)
> > +					return -ENOMEM;
> > +			} else if (cdev == NULL) {
> >  				char *playback_ctl = NULL;
> >  				char *capture_ctl = NULL;
> >


More information about the Alsa-devel mailing list