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

From: Jan Kiszka
Date: Sun May 28 2017 - 12:53:04 EST


On 2017-05-27 15:28, Andy Shevchenko wrote:
> On Fri, May 26, 2017 at 7:07 PM, Jan Kiszka <jan.kiszka@xxxxxxxxxxx> 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 = &galileo_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