All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: pierre-louis.bossart@linux.intel.com,
	alsa-devel@alsa-project.org, filip.kaczmarski@intel.com,
	harshapriya.n@intel.com, marcin.barlik@intel.com,
	zwisler@google.com, lgirdwood@gmail.com, tiwai@suse.com,
	filip.proborszcz@intel.com, broonie@kernel.org,
	michal.wasko@intel.com, cujomalainey@chromium.org,
	ppapierkowski@habana.ai, vamshi.krishna.gopal@intel.com
Subject: Re: [PATCH 01/13] ASoC: Intel: Add catpt device
Date: Tue, 11 Aug 2020 12:04:39 +0200	[thread overview]
Message-ID: <e9c8786c-4d31-a85a-2a40-cfd29fd91b73@intel.com> (raw)
In-Reply-To: <20200808115041.GN3703480@smile.fi.intel.com>

On 2020-08-08 1:50 PM, Andy Shevchenko wrote:
> 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?
> 

As mentioned in the followup message:
https://www.spinics.net/lists/alsa-devel/msg113563.html
(Resource management section)

I opted out of 'struct resource' usage due to differences in its layout 
and preferred usage. Perhaps I shouldn't have.

I've embraced 'struct resource' fully in v2. Your suggestion cascaded 
into several other changes and some things were made redundant with 
removal of struct catpt_mbank and catpt_mregion. Change log has been 
added in v2 cover-letter describing consequences of said change.

Thanks,
Czarek

  reply	other threads:[~2020-08-11 10:11 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07 11:06 [PATCH 00/13] ASoC: Intel: Catpt - Lynx and Wildcat point Cezary Rojewski
2020-08-07 11:06 ` [PATCH 01/13] ASoC: Intel: Add catpt device Cezary Rojewski
2020-08-08 11:50   ` Andy Shevchenko
2020-08-11 10:04     ` Cezary Rojewski [this message]
2020-08-07 11:06 ` [PATCH 02/13] ASoC: Intel: catpt: Define DSP operations Cezary Rojewski
2020-08-07 11:06 ` [PATCH 03/13] ASoC: Intel: catpt: Firmware loading and context restore Cezary Rojewski
2020-08-07 11:06 ` [PATCH 04/13] ASoC: Intel: catpt: Implement IPC protocol Cezary Rojewski
2020-08-07 11:06 ` [PATCH 05/13] ASoC: Intel: catpt: Add IPC messages Cezary Rojewski
2020-08-07 11:06 ` [PATCH 06/13] ASoC: Intel: catpt: PCM operations Cezary Rojewski
2020-08-07 11:06 ` [PATCH 07/13] ASoC: Intel: catpt: Event tracing Cezary Rojewski
2020-08-07 15:09   ` Mark Brown
2020-08-10  7:16     ` Cezary Rojewski
2020-08-11  7:30       ` Cezary Rojewski
2020-08-11  9:40         ` Mark Brown
2020-08-07 11:06 ` [PATCH 08/13] ASoC: Intel: catpt: Simple sysfs attributes Cezary Rojewski
2020-08-07 15:00   ` Mark Brown
2020-08-10  7:17     ` Cezary Rojewski
2020-08-07 11:06 ` [PATCH 09/13] ASoC: Intel: Select catpt and deprecate haswell Cezary Rojewski
2020-08-07 11:06 ` [PATCH 10/13] ASoC: Intel: haswell: Remove haswell-solution specific code Cezary Rojewski
2020-08-07 11:06 ` [PATCH 11/13] ASoC: Intel: broadwell: " Cezary Rojewski
2020-08-07 11:06 ` [PATCH 12/13] ASoC: Intel: bdw-5650: " Cezary Rojewski
2020-08-07 11:06 ` [PATCH 13/13] ASoC: Intel: bdw-5677: " Cezary Rojewski
2020-08-07 11:09 ` [PATCH 00/13] ASoC: Intel: Catpt - Lynx and Wildcat point Cezary Rojewski
2020-08-07 13:05 ` Amadeusz Sławiński

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=e9c8786c-4d31-a85a-2a40-cfd29fd91b73@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=broonie@kernel.org \
    --cc=cujomalainey@chromium.org \
    --cc=filip.kaczmarski@intel.com \
    --cc=filip.proborszcz@intel.com \
    --cc=harshapriya.n@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=marcin.barlik@intel.com \
    --cc=michal.wasko@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ppapierkowski@habana.ai \
    --cc=tiwai@suse.com \
    --cc=vamshi.krishna.gopal@intel.com \
    --cc=zwisler@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.