[PATCH 01/13] ASoC: Intel: Add catpt device

Andy Shevchenko andriy.shevchenko at intel.com
Sat Aug 8 13:50:41 CEST 2020


On Fri, Aug 07, 2020 at 01:06:37PM +0200, Cezary Rojewski wrote:
> Declare base structures, registers and device routines for the catpt
> solution. Catpt deprecates and is a direct replacement for
> sound/soc/intel/haswell. Supports Lynxpoint and Wildcat Point both.


...

> +struct catpt_mregion {
> +	u32 start;
> +	u32 end;
> +	bool busy;
> +	struct list_head node;
> +};

I'm wondering if struct resource can be used instead.

You know that you may introduce a new type of resource if you want to.

> +static inline size_t catpt_mregion_size(const struct catpt_mregion *reg)
> +{
> +	return reg->end - reg->start + 1;
> +}
> +
> +/* True if region r1 intersects region r2 */
> +static inline bool catpt_mregion_intersects(struct catpt_mregion *r1,
> +					    struct catpt_mregion *r2)
> +{
> +	return (r1->start >= r2->start && r1->start <= r2->end) ||
> +	       (r1->end >= r2->start && r1->end <= r2->end);
> +}
> +
> +static inline bool catpt_mregion_intersecting(struct catpt_mregion *r1,
> +					      struct catpt_mregion *r2,
> +					      struct catpt_mregion *ret)
> +{
> +	if (!catpt_mregion_intersects(r1, r2))
> +		return false;
> +	ret->start = max(r1->start, r2->start);
> +	ret->end = min(r1->end, r2->end);
> +	return true;
> +}

Yeah, it reminds the existing resource infrastructure. Why to repeat it?


-- 
With Best Regards,
Andy Shevchenko




More information about the Alsa-devel mailing list