diff mbox series

net: stmmac: xgmac: fix initializer element is not constant error

Message ID 20240212154319.907447-1-shiftee@posteo.net (mailing list archive)
State New, archived
Headers show
Series net: stmmac: xgmac: fix initializer element is not constant error | expand

Commit Message

Mark O'Donovan Feb. 12, 2024, 3:43 p.m. UTC
GCC prior to 8.x gives an "initializer element is not constant"
error for the uses of dpp_tx_err in dwxgmac3_dma_dpp_errors.
Newer compilers accept either version.

More info here:
https://lore.kernel.org/all/20240103-fix-bq24190_charger-vbus_desc-non-const-v1-1-115ddf798c70@kernel.org

Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


base-commit: 841c35169323cd833294798e58b9bf63fa4fa1de

Comments

Jacob Keller Feb. 14, 2024, 8:31 p.m. UTC | #1
On 2/12/2024 7:43 AM, Mark O'Donovan wrote:
> GCC prior to 8.x gives an "initializer element is not constant"
> error for the uses of dpp_tx_err in dwxgmac3_dma_dpp_errors.
> Newer compilers accept either version.
> 
> More info here:
> https://lore.kernel.org/all/20240103-fix-bq24190_charger-vbus_desc-non-const-v1-1-115ddf798c70@kernel.org
> 
> Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
> ---

I'm not sure whether the Linux kernel project has an explicit cutoff for
what versions of GCC (or other compilers) are supported. GCC 8 was first
released in 2018.

The fix provided here is fairly straight forward, and while I do think
the benefit of using builtin types vs using the macros is nice, I don't
see that as a strong enough reason to hold up supporting the older compiler.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>  drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
> index 323c57f03c93..c02c035b81c0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
> @@ -830,8 +830,8 @@ static const struct dwxgmac3_error_desc dwxgmac3_dma_errors[32]= {
>  	{ false, "UNKNOWN", "Unknown Error" }, /* 31 */
>  };
>  
> -static const char * const dpp_rx_err = "Read Rx Descriptor Parity checker Error";
> -static const char * const dpp_tx_err = "Read Tx Descriptor Parity checker Error";
> +#define dpp_rx_err "Read Rx Descriptor Parity checker Error"
> +#define dpp_tx_err "Read Tx Descriptor Parity checker Error"
>  static const struct dwxgmac3_error_desc dwxgmac3_dma_dpp_errors[32] = {
>  	{ true, "TDPES0", dpp_tx_err },
>  	{ true, "TDPES1", dpp_tx_err },
> 
> base-commit: 841c35169323cd833294798e58b9bf63fa4fa1de
Mark O'Donovan Feb. 14, 2024, 10:07 p.m. UTC | #2
On 14/02/2024 20:31, Jacob Keller wrote:
> 
> 
> On 2/12/2024 7:43 AM, Mark O'Donovan wrote:
>> GCC prior to 8.x gives an "initializer element is not constant"
>> error for the uses of dpp_tx_err in dwxgmac3_dma_dpp_errors.
>> Newer compilers accept either version.
>>
>> More info here:
>> https://lore.kernel.org/all/20240103-fix-bq24190_charger-vbus_desc-non-const-v1-1-115ddf798c70@kernel.org
>>
>> Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
>> ---
> 
> I'm not sure whether the Linux kernel project has an explicit cutoff for
> what versions of GCC (or other compilers) are supported. GCC 8 was first
> released in 2018.
> 
> The fix provided here is fairly straight forward, and while I do think
> the benefit of using builtin types vs using the macros is nice, I don't
> see that as a strong enough reason to hold up supporting the older compiler.
> 
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> 
>>   drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
>> index 323c57f03c93..c02c035b81c0 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
>> @@ -830,8 +830,8 @@ static const struct dwxgmac3_error_desc dwxgmac3_dma_errors[32]= {
>>   	{ false, "UNKNOWN", "Unknown Error" }, /* 31 */
>>   };
>>   
>> -static const char * const dpp_rx_err = "Read Rx Descriptor Parity checker Error";
>> -static const char * const dpp_tx_err = "Read Tx Descriptor Parity checker Error";
>> +#define dpp_rx_err "Read Rx Descriptor Parity checker Error"
>> +#define dpp_tx_err "Read Tx Descriptor Parity checker Error"
>>   static const struct dwxgmac3_error_desc dwxgmac3_dma_dpp_errors[32] = {
>>   	{ true, "TDPES0", dpp_tx_err },
>>   	{ true, "TDPES1", dpp_tx_err },
>>
>> base-commit: 841c35169323cd833294798e58b9bf63fa4fa1de

Thanks Jacob.

The minimum versions for compilers and other tools are documented here:
https://www.kernel.org/doc/html/latest/process/changes.html

I am using a SLES 15 server to build, the first version of which came out in 2017.

Mark
Paolo Abeni Feb. 15, 2024, 10:47 a.m. UTC | #3
Hi,

On Wed, 2024-02-14 at 22:07 +0000, Mark O'Donovan wrote:
> On 14/02/2024 20:31, Jacob Keller wrote:
> > 
> > 
> > On 2/12/2024 7:43 AM, Mark O'Donovan wrote:
> > > GCC prior to 8.x gives an "initializer element is not constant"
> > > error for the uses of dpp_tx_err in dwxgmac3_dma_dpp_errors.
> > > Newer compilers accept either version.
> > > 
> > > More info here:
> > > https://lore.kernel.org/all/20240103-fix-bq24190_charger-vbus_desc-non-const-v1-1-115ddf798c70@kernel.org
> > > 
> > > Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
> > > ---
> > 
> > I'm not sure whether the Linux kernel project has an explicit cutoff for
> > what versions of GCC (or other compilers) are supported. GCC 8 was first
> > released in 2018.
> > 
> > The fix provided here is fairly straight forward, and while I do think
> > the benefit of using builtin types vs using the macros is nice, I don't
> > see that as a strong enough reason to hold up supporting the older compiler.
> > 
> > Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> > 
> > >   drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 4 ++--
> > >   1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
> > > index 323c57f03c93..c02c035b81c0 100644
> > > --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
> > > +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
> > > @@ -830,8 +830,8 @@ static const struct dwxgmac3_error_desc dwxgmac3_dma_errors[32]= {
> > >   	{ false, "UNKNOWN", "Unknown Error" }, /* 31 */
> > >   };
> > >   
> > > -static const char * const dpp_rx_err = "Read Rx Descriptor Parity checker Error";
> > > -static const char * const dpp_tx_err = "Read Tx Descriptor Parity checker Error";
> > > +#define dpp_rx_err "Read Rx Descriptor Parity checker Error"
> > > +#define dpp_tx_err "Read Tx Descriptor Parity checker Error"
> > >   static const struct dwxgmac3_error_desc dwxgmac3_dma_dpp_errors[32] = {
> > >   	{ true, "TDPES0", dpp_tx_err },
> > >   	{ true, "TDPES1", dpp_tx_err },
> > > 
> > > base-commit: 841c35169323cd833294798e58b9bf63fa4fa1de
> 
> Thanks Jacob.
> 
> The minimum versions for compilers and other tools are documented here:
> https://www.kernel.org/doc/html/latest/process/changes.html
> 
> I am using a SLES 15 server to build, the first version of which came out in 2017.

Note that we already have net commit
1692b9775e745f84b69dc8ad0075b0855a43db4e addressing this issue.

Thanks,

Paolo
Jacob Keller Feb. 15, 2024, 5:31 p.m. UTC | #4
On 2/14/2024 2:07 PM, Mark O'Donovan wrote:
> On 14/02/2024 20:31, Jacob Keller wrote:
>>
>>
>> On 2/12/2024 7:43 AM, Mark O'Donovan wrote:
>>> GCC prior to 8.x gives an "initializer element is not constant"
>>> error for the uses of dpp_tx_err in dwxgmac3_dma_dpp_errors.
>>> Newer compilers accept either version.
>>>
>>> More info here:
>>> https://lore.kernel.org/all/20240103-fix-bq24190_charger-vbus_desc-non-const-v1-1-115ddf798c70@kernel.org
>>>
>>> Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
>>> ---
>>
>> I'm not sure whether the Linux kernel project has an explicit cutoff for
>> what versions of GCC (or other compilers) are supported. GCC 8 was first
>> released in 2018.
>>
>> The fix provided here is fairly straight forward, and while I do think
>> the benefit of using builtin types vs using the macros is nice, I don't
>> see that as a strong enough reason to hold up supporting the older compiler.
>>
>> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
>>
>>>   drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
>>> index 323c57f03c93..c02c035b81c0 100644
>>> --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
>>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
>>> @@ -830,8 +830,8 @@ static const struct dwxgmac3_error_desc dwxgmac3_dma_errors[32]= {
>>>   	{ false, "UNKNOWN", "Unknown Error" }, /* 31 */
>>>   };
>>>   
>>> -static const char * const dpp_rx_err = "Read Rx Descriptor Parity checker Error";
>>> -static const char * const dpp_tx_err = "Read Tx Descriptor Parity checker Error";
>>> +#define dpp_rx_err "Read Rx Descriptor Parity checker Error"
>>> +#define dpp_tx_err "Read Tx Descriptor Parity checker Error"
>>>   static const struct dwxgmac3_error_desc dwxgmac3_dma_dpp_errors[32] = {
>>>   	{ true, "TDPES0", dpp_tx_err },
>>>   	{ true, "TDPES1", dpp_tx_err },
>>>
>>> base-commit: 841c35169323cd833294798e58b9bf63fa4fa1de
> 
> Thanks Jacob.
> 
> The minimum versions for compilers and other tools are documented here:
> https://www.kernel.org/doc/html/latest/process/changes.html
> 
> I am using a SLES 15 server to build, the first version of which came out in 2017.
> 
> Mark

Thanks for pointing this out, I failed to find it with grep. Useful to
have this as a reference.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
index 323c57f03c93..c02c035b81c0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
@@ -830,8 +830,8 @@  static const struct dwxgmac3_error_desc dwxgmac3_dma_errors[32]= {
 	{ false, "UNKNOWN", "Unknown Error" }, /* 31 */
 };
 
-static const char * const dpp_rx_err = "Read Rx Descriptor Parity checker Error";
-static const char * const dpp_tx_err = "Read Tx Descriptor Parity checker Error";
+#define dpp_rx_err "Read Rx Descriptor Parity checker Error"
+#define dpp_tx_err "Read Tx Descriptor Parity checker Error"
 static const struct dwxgmac3_error_desc dwxgmac3_dma_dpp_errors[32] = {
 	{ true, "TDPES0", dpp_tx_err },
 	{ true, "TDPES1", dpp_tx_err },