diff mbox series

[01/22] orion5x: Replace comments with C99 initializers

Message ID 20220326165909.506926-1-benni@stuerz.xyz
State New
Headers show
Series [01/22] orion5x: Replace comments with C99 initializers | expand

Commit Message

Benjamin Stürz March 26, 2022, 4:58 p.m. UTC
This replaces comments with C99's designated
initializers because the kernel supports them now.

Signed-off-by: Benjamin Stürz <benni@stuerz.xyz>
---
 arch/arm/mach-orion5x/dns323-setup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Mauro Carvalho Chehab March 26, 2022, 6:20 p.m. UTC | #1
Em Sat, 26 Mar 2022 17:58:48 +0100
Benjamin Stürz <benni@stuerz.xyz> escreveu:

> This replaces comments with C99's designated
> initializers because the kernel supports them now.

Please:

1. Split this series per sub-system. It makes no sense to mailbomb all
   subsystems for things that won't belong there;

2. Add a patch 00 to the series, in order to make easier to do reviews
   like this that are meant to the series as a hole.

Regards,
Mauro
> 
> Signed-off-by: Benjamin Stürz <benni@stuerz.xyz>
> ---
>  arch/arm/mach-orion5x/dns323-setup.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
> index 87cb47220e82..d762248c6512 100644
> --- a/arch/arm/mach-orion5x/dns323-setup.c
> +++ b/arch/arm/mach-orion5x/dns323-setup.c
> @@ -61,9 +61,9 @@
>  
>  /* Exposed to userspace, do not change */
>  enum {
> -	DNS323_REV_A1,	/* 0 */
> -	DNS323_REV_B1,	/* 1 */
> -	DNS323_REV_C1,	/* 2 */
> +	DNS323_REV_A1 = 0,
> +	DNS323_REV_B1 = 1,
> +	DNS323_REV_C1 = 2,
>  };
>  
>  



Thanks,
Mauro
Arnd Bergmann March 26, 2022, 7:23 p.m. UTC | #2
On Sat, Mar 26, 2022 at 5:58 PM Benjamin Stürz <benni@stuerz.xyz> wrote:
>
> This replaces comments with C99's designated
> initializers because the kernel supports them now.

The change looks fine, but the comment looks misplaced, as enum initializers
are not c99 feature. Also, the named array and struct intializers have been
supported by gnu89 for a long time and widely used in the kernel, so it's
not a recent change even for the others.

Also,

      Arnd
Daniel Thompson March 28, 2022, 1:17 p.m. UTC | #3
On Sat, Mar 26, 2022 at 05:58:48PM +0100, Benjamin Stürz wrote:
> This replaces comments with C99's designated
> initializers because the kernel supports them now.

This commit description seems wrong to me. This patch doesn't include
use C99 designated initializers (or AFAICT any other language feature
that has recently been enabled in the kernel).

The changes here are just plain constant-expressions in enumeration
lists and were included in C89/C90.


Daniel.


> 
> Signed-off-by: Benjamin Stürz <benni@stuerz.xyz>
> ---
>  arch/arm/mach-orion5x/dns323-setup.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
> index 87cb47220e82..d762248c6512 100644
> --- a/arch/arm/mach-orion5x/dns323-setup.c
> +++ b/arch/arm/mach-orion5x/dns323-setup.c
> @@ -61,9 +61,9 @@
>  
>  /* Exposed to userspace, do not change */
>  enum {
> -	DNS323_REV_A1,	/* 0 */
> -	DNS323_REV_B1,	/* 1 */
> -	DNS323_REV_C1,	/* 2 */
> +	DNS323_REV_A1 = 0,
> +	DNS323_REV_B1 = 1,
> +	DNS323_REV_C1 = 2,
>  };
>  
>  
> -- 
> 2.35.1
>
Segher Boessenkool March 28, 2022, 1:19 p.m. UTC | #4
On Sat, Mar 26, 2022 at 08:23:31PM +0100, Arnd Bergmann wrote:
> On Sat, Mar 26, 2022 at 5:58 PM Benjamin Stürz <benni@stuerz.xyz> wrote:
> >
> > This replaces comments with C99's designated
> > initializers because the kernel supports them now.
> 
> The change looks fine, but the comment looks misplaced, as enum initializers
> are not c99 feature.

Yes, it is from C89/C90.

> Also, the named array and struct intializers have been
> supported by gnu89 for a long time and widely used in the kernel, so it's
> not a recent change even for the others.

GCC supports this since 1998.  There was a syntax different from C99
designated initializers (".ans = 42") before (namely, "ans: 42").

1998 is long enough ago for all intents and purposes now of course ;-)


Segher
diff mbox series

Patch

diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 87cb47220e82..d762248c6512 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -61,9 +61,9 @@ 
 
 /* Exposed to userspace, do not change */
 enum {
-	DNS323_REV_A1,	/* 0 */
-	DNS323_REV_B1,	/* 1 */
-	DNS323_REV_C1,	/* 2 */
+	DNS323_REV_A1 = 0,
+	DNS323_REV_B1 = 1,
+	DNS323_REV_C1 = 2,
 };