Re: git: 805d759338a2 - main - mlx4: Move DEFINE_MUTEX() outside function body.

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Sun, 21 May 2023 16:33:35 UTC
On 21 May 2023, at 17:21, Hans Petter Selasky <hselasky@FreeBSD.org> wrote:
> 
> The branch main has been updated by hselasky:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=805d759338a2be939fffc8bf3f25cfaab981a9be
> 
> commit 805d759338a2be939fffc8bf3f25cfaab981a9be
> Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
> AuthorDate: 2023-05-21 11:25:28 +0000
> Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
> CommitDate: 2023-05-21 16:20:16 +0000
> 
>    mlx4: Move DEFINE_MUTEX() outside function body.
> 
>    Move static mutex declaration outside function body, to avoid global
>    variables being declared on the stack, when using SYSINITs.

What? This is nonsense. It’s not on the stack either way round.

Please revert this.

Jess

>    MFC after:      1 week
>    Sponsored by:   NVIDIA Networking
> ---
> sys/dev/mlx4/mlx4_core/mlx4_main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sys/dev/mlx4/mlx4_core/mlx4_main.c b/sys/dev/mlx4/mlx4_core/mlx4_main.c
> index ca63d1d12ba6..a37b900a2ed0 100644
> --- a/sys/dev/mlx4/mlx4_core/mlx4_main.c
> +++ b/sys/dev/mlx4/mlx4_core/mlx4_main.c
> @@ -1164,6 +1164,8 @@ err_sup:
> return err;
> }
> 
> +static DEFINE_MUTEX(set_port_type_mutex);
> +
> static ssize_t set_port_type(struct device *dev,
>     struct device_attribute *attr,
>     const char *buf, size_t count)
> @@ -1172,7 +1174,6 @@ static ssize_t set_port_type(struct device *dev,
>   port_attr);
> struct mlx4_dev *mdev = info->dev;
> enum mlx4_port_type port_type;
> - static DEFINE_MUTEX(set_port_type_mutex);
> int err;
> 
> mutex_lock(&set_port_type_mutex);