Re: [PATCH v4 4/7] media: qcom: camss: Move VFE power-domain specifics into vfe.c

From: Bryan O'Donoghue
Date: Sat Nov 18 2023 - 06:35:40 EST


On 18/11/2023 00:32, Konrad Dybcio wrote:
+ /* count the # of VFEs which have flagged power-domain */
[...]

Personal peeve, but this comment seems a bit excessive

Well, to me this code "does stuff" that isn't terribly obvious. It took a while to understand the Gordian knot so its worthwhile documenting it inline until we can use named pds to make it all go away forever.


+ for (vfepd_num = i = 0; i < camss->vfe_total_num; i++) {
+ if (res->vfe_res[i].has_pd)
+ vfepd_num++;
+ }
- camss->genpd_link = devm_kmalloc_array(dev, camss->genpd_num,
- sizeof(*camss->genpd_link),
- GFP_KERNEL);
- if (!camss->genpd_link)
- return -ENOMEM;
+ /*
+ * If the number of power-domains is greater than the number of VFEs
+ * then the additional power-domain is for the entire CAMSS block the
+ * 'top' power-domain.
the last 3 words seem out of place



+ */
+ if (camss->genpd_num <= vfepd_num)
+ return 0;
if (!(camss->genpd_num > vfepd_num))

would probably be easier to follow given your comment above

Sure, if its easier to read/understand for you, then it is probably so for others.

I will V5 this.

---
bod