Re: [PATCH v2 5/8] media: camss: Add regulator_bulk support

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

 



On 10/01/2022 15:17, Robert Foss wrote:
+       for (i = 0; i < ARRAY_SIZE(res->regulators); i++) {
+               if (res->regulators[i])
+                       csid->num_supplies++;
+       }
With the cleanup that Bjorn suggested, and was submitted as v2 6/8, I
would like to see the above snippet simplified to the below.

csid->num_supplies = ARRAY_SIZE(res->regulators);


res->regulators is declared as

char *regulators[CAMSS_RES_MAX];

which means ARRAY_SIZE(regulators) == CAMSS_RES_MAX

I could do something like this

 struct resources {
-       char *regulator[CAMSS_RES_MAX];
+       char **regulators;
        char *clock[CAMSS_RES_MAX];
        u32 clock_rate[CAMSS_RES_MAX][CAMSS_RES_MAX];
        char *reg[CAMSS_RES_MAX];

+static const char const *csid_res_8x16_regulators = { "vdda" };
 static const struct resources csid_res_8x16[] = {
        /* CSID0 */
        {
-               .regulator = { "vdda" },
+               .regulators = csid_res_8x16_regulators,

 static const struct resources vfe_res_8x16[] = {
        /* VFE0 */
        {
-               .regulator = {},
+               .regulators = NULL,

then the ARRAY_SIZE() thing would work

If that change is made - then it would also make sense to change up *clock[CAMSS_RES_MAX]; *reg[CAMSS_RES_MAX]..

---
bod



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux