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

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

 



Hi Andy,

On 29.07.22 18:13, Andy Shevchenko wrote:
> On Fri, Jul 29, 2022 at 1:06 AM Jakob Hauser <jahau@xxxxxxxxxxxxxx> 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)

As I understand you, it's to be applied on "yas5xx_version_names" only.
In the chip_info table, it would then look like:

        .product_name = yas5xx_product_name[yas530],
        .version_name = yas5xx_version_names[yas530],
                                           ^
                                           S

> 
>>                 [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)

OK

> 
>>                 },
>>         };
>>
> 

Kind regards,
Jakob



[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