diff mbox series

[ethtool,3/3] marvell.c: Fix build with musl-libc

Message ID 20230113233148.235543-4-f.fainelli@gmail.com (mailing list archive)
State Superseded
Delegated to: Michal Kubecek
Headers show
Series Build fixes for older kernel headers and musl | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Florian Fainelli Jan. 13, 2023, 11:31 p.m. UTC
After commit 1fa60003a8b8 ("misc: header includes cleanup") we stopped
including net/if.h which resolved the proper defines to pull in
sys/types.h and provide a definition for u_int32_t. With musl-libc we
need to define _GNU_SOURCE to ensure that sys/types.h does provide a
definition for u_int32_t.

Fixes: 1fa60003a8b8 ("misc: header includes cleanup")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 marvell.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michal Kubecek Jan. 14, 2023, 12:13 a.m. UTC | #1
On Fri, Jan 13, 2023 at 03:31:48PM -0800, Florian Fainelli wrote:
> After commit 1fa60003a8b8 ("misc: header includes cleanup") we stopped
> including net/if.h which resolved the proper defines to pull in
> sys/types.h and provide a definition for u_int32_t. With musl-libc we
> need to define _GNU_SOURCE to ensure that sys/types.h does provide a
> definition for u_int32_t.
> 
> Fixes: 1fa60003a8b8 ("misc: header includes cleanup")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  marvell.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/marvell.c b/marvell.c
> index d3d570e4d4ad..be2fc36b8fc5 100644
> --- a/marvell.c
> +++ b/marvell.c
> @@ -6,7 +6,7 @@
>   */
>  
>  #include <stdio.h>
> -
> +#define _GNU_SOURCE
>  #include "internal.h"
>  
>  static void dump_addr(int n, const u8 *a)

I would prefer replacing u_intXX_t types with standard uintXX_t and
including <stdint.h>. That would be consistent with the rest of the
code which uses ISO uintXX_t types or (older code) kernel uXX types.

Michal
Florian Fainelli Jan. 14, 2023, 2:07 a.m. UTC | #2
On 1/13/2023 4:13 PM, Michal Kubecek wrote:
> On Fri, Jan 13, 2023 at 03:31:48PM -0800, Florian Fainelli wrote:
>> After commit 1fa60003a8b8 ("misc: header includes cleanup") we stopped
>> including net/if.h which resolved the proper defines to pull in
>> sys/types.h and provide a definition for u_int32_t. With musl-libc we
>> need to define _GNU_SOURCE to ensure that sys/types.h does provide a
>> definition for u_int32_t.
>>
>> Fixes: 1fa60003a8b8 ("misc: header includes cleanup")
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>>   marvell.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/marvell.c b/marvell.c
>> index d3d570e4d4ad..be2fc36b8fc5 100644
>> --- a/marvell.c
>> +++ b/marvell.c
>> @@ -6,7 +6,7 @@
>>    */
>>   
>>   #include <stdio.h>
>> -
>> +#define _GNU_SOURCE
>>   #include "internal.h"
>>   
>>   static void dump_addr(int n, const u8 *a)
> 
> I would prefer replacing u_intXX_t types with standard uintXX_t and
> including <stdint.h>. That would be consistent with the rest of the
> code which uses ISO uintXX_t types or (older code) kernel uXX types.

Sounds good, I will do that in v2.
diff mbox series

Patch

diff --git a/marvell.c b/marvell.c
index d3d570e4d4ad..be2fc36b8fc5 100644
--- a/marvell.c
+++ b/marvell.c
@@ -6,7 +6,7 @@ 
  */
 
 #include <stdio.h>
-
+#define _GNU_SOURCE
 #include "internal.h"
 
 static void dump_addr(int n, const u8 *a)