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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux