Re: [PATCH v2 5/6] stmmac: pci: Use dmi_system_id table for retrieving PHY addresses

2017-05-28 Thread Jan Kiszka
On 2017-05-27 15:28, Andy Shevchenko wrote:
> On Fri, May 26, 2017 at 7:07 PM, Jan Kiszka  wrote:
>> Avoids reimplementation of DMI matching in stmmac_pci_find_phy_addr.
> 
>>  struct stmmac_pci_dmi_data {
>> -   const char *name;
>> -   const char *asset_tag;
>> -   unsigned int func;
>> +   int func;
>> int phy_addr;
>>  };
> 
> Can we leave unsigned type here...
> 
>> -static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = {
>> +static const struct stmmac_pci_dmi_data galileo_stmmac_dmi_data[] = {
> 
>> +   {-1, -1},
>> +};
> 
>> +static const struct stmmac_pci_dmi_data iot2040_stmmac_dmi_data[] = {
> 
>> +   {-1, -1},
>> +};
> 
> ...and avoid this not so standard terminators?

0 is a valid PCI function, thus can't be use as terminator. Therefore I
chose -1 as an obviously invalid value.

> 
>> +   .matches = {
>> +   DMI_EXACT_MATCH(DMI_BOARD_NAME, "GalileoGen2"),
>> +   },
> 
>> +   .driver_data = (void *)galileo_stmmac_dmi_data,
> 
> Can't be slightly better
> 
>  .driver_data = _stmmac_dmi_data,
> 
> ?
> 

Interesting, that removes the "const" as well. OK.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux


Re: [PATCH v2 5/6] stmmac: pci: Use dmi_system_id table for retrieving PHY addresses

2017-05-27 Thread Andy Shevchenko
On Fri, May 26, 2017 at 7:07 PM, Jan Kiszka  wrote:
> Avoids reimplementation of DMI matching in stmmac_pci_find_phy_addr.

>  struct stmmac_pci_dmi_data {
> -   const char *name;
> -   const char *asset_tag;
> -   unsigned int func;
> +   int func;
> int phy_addr;
>  };

Can we leave unsigned type here...

> -static struct stmmac_pci_dmi_data quark_pci_dmi_data[] = {
> +static const struct stmmac_pci_dmi_data galileo_stmmac_dmi_data[] = {

> +   {-1, -1},
> +};

> +static const struct stmmac_pci_dmi_data iot2040_stmmac_dmi_data[] = {

> +   {-1, -1},
> +};

...and avoid this not so standard terminators?

> +   .matches = {
> +   DMI_EXACT_MATCH(DMI_BOARD_NAME, "GalileoGen2"),
> +   },

> +   .driver_data = (void *)galileo_stmmac_dmi_data,

Can't be slightly better

 .driver_data = _stmmac_dmi_data,

?

-- 
With Best Regards,
Andy Shevchenko