Re: [PATCH v4 09/10] iio: magnetometer: yas530: Introduce "chip_info" structure

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

 



On Fri, Jul 29, 2022 at 1:06 AM Jakob Hauser <jahau@xxxxxxxxxxxxxx> wrote:
> On 27.07.22 19:39, Andy Shevchenko wrote:

...

Just a couple of remarks.

> Indeed, to my own surprise I found a solution with the 2D array:
>
>         static const char * const yas5xx_product_name[] = {
>                 "YAS530 MS-3E",
>                 "YAS532 MS-3R",
>                 "YAS533 MS-3F",
>         };
>
>         static const char * const yas5xx_version_name[][2] = {

yas5xx_version_names (note S at the end)

>                 [yas530] = { "A", "B" },
>                 [yas532] = { "AB", "AC" },
>                 [yas533] = { "AB", "AC" },
>         };
>
>         ...
>
>         struct yas5xx_chip_info {
>                 ...
>                 const char *product_name;
>                 const char * const *version_name;
>                 ...
>         };
>
>         static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
>                 [yas530] = {
>                         ...
>                         .product_name = yas5xx_product_name[0],
>                         .version_name = yas5xx_version_name[0],

Also 0 --> yas530 (use enum:ed indices)

>                 },
>         };
>

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux