Subject: Re: [PATCH net-next 07/11] net/mlx5_core: Implement get/set port status

From: Sergei Shtylyov <[email-masked]>
Date: Wed, 08 Apr 2015 21:26:37 +0300

Hello.

On 04/08/2015 05:51 PM, Amir Vadai wrote:

> From: Rana Shahout <[email-masked]>

> Signed-off-by: Rana Shahout <[email-masked]>
> Signed-off-by: Saeed Mahameed <[email-masked]>
> Signed-off-by: Amir Vadai <[email-masked]>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/port.c | 34 ++++++++++++++++++++++++++
>   include/linux/mlx5/driver.h                    |  8 ++++++
>   2 files changed, 42 insertions(+)

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
> index 6e2d99c..7c394c0 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
> @@ -179,3 +179,37 @@ int mlx5_set_port_proto(struct mlx5_core_dev *dev, u32 proto_admin,
>   	return err;
>   }
>   EXPORT_SYMBOL_GPL(mlx5_set_port_proto);
> +
> +int mlx5_set_port_status(struct mlx5_core_dev *dev,
> +			 enum mlx5_port_status status)
> +{
> +	u32 in[MLX5_ST_SZ_DW(paos_reg)];
> +	u32 out[MLX5_ST_SZ_DW(paos_reg)];
> +	int err;
> +
> +	memset(in, 0, sizeof(in));
> +
> +	MLX5_SET(paos_reg, in, admin_status, status);
> +	MLX5_SET(paos_reg, in, ase, 1);
> +
> +	err = mlx5_core_access_reg(dev, in, sizeof(in), out,
> +				   sizeof(out), MLX5_REG_PAOS, 0, 1);
> +	return err;

    Why not just direct return of the function's result?

[...]

WBR, Sergei