Re: [PATCH 04/15] tty: Remove now superfluous sentinel element from ctl_table array

From: Greg Kroah-Hartman
Date: Mon Oct 02 2023 - 05:02:49 EST


On Mon, Oct 02, 2023 at 08:47:53AM +0000, Christophe Leroy wrote:
>
>
> Le 02/10/2023 à 10:17, Jiri Slaby a écrit :
> > On 28. 09. 23, 15:21, Joel Granados via B4 Relay wrote:
> >> From: Joel Granados <j.granados@xxxxxxxxxxx>
> >>
> >> This commit comes at the tail end of a greater effort to remove the
> >> empty elements at the end of the ctl_table arrays (sentinels) which
> >> will reduce the overall build time size of the kernel and run time
> >> memory bloat by ~64 bytes per sentinel (further information Link :
> >> https://lore.kernel.org/all/ZO5Yx5JFogGi%2FcBo@xxxxxxxxxxxxxxxxxxxxxx/)
> >>
> >> Remove sentinel from tty_table
> >>
> >> Signed-off-by: Joel Granados <j.granados@xxxxxxxxxxx>
> >> ---
> >>   drivers/tty/tty_io.c | 3 +--
> >>   1 file changed, 1 insertion(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> >> index 8a94e5a43c6d..2f925dc54a20 100644
> >> --- a/drivers/tty/tty_io.c
> >> +++ b/drivers/tty/tty_io.c
> >> @@ -3607,8 +3607,7 @@ static struct ctl_table tty_table[] = {
> >>           .proc_handler    = proc_dointvec,
> >>           .extra1        = SYSCTL_ZERO,
> >>           .extra2        = SYSCTL_ONE,
> >> -    },
> >> -    { }
> >> +    }
> >
> > Why to remove the comma? One would need to add one when adding a new entry?
>
> Does it make any difference at all ?
>
> In one case you have:
>
> @xxxx
> something old,
> },
> + {
> + something new,
> + },
> }
>
> In the other case you have:
>
> @xxxx
> something old,
> + },
> + {
> + something new,
> }
> }

Because that way it is obvious you are only touching the "something new"
lines and never have to touch the "something old" ones.

It's just a long-standing tradition in Linux, don't have an extra
character if you don't need it :)

thanks,

greg k-h