Subject: Re: [patch net-next v3 09/11] mlxsw: core_linecards: Implement line card device flashing

From: Ido Schimmel <[email-masked]>
Date: Thu, 21 Jul 2022 11:25:45 +0300

On Wed, Jul 20, 2022 at 05:12:32PM +0200, Jiri Pirko wrote:
> +int mlxsw_linecard_flash_update(struct devlink *linecard_devlink,
> +				struct mlxsw_linecard *linecard,
> +				const struct firmware *firmware,
> +				struct netlink_ext_ack *extack)
> +{
> +	struct mlxsw_core *mlxsw_core = linecard->linecards->mlxsw_core;
> +	struct mlxsw_linecard_device_fw_info info = {
> +		.mlxfw_dev = {
> +			.ops = &mlxsw_linecard_device_dev_ops,
> +			.psid = linecard->device.info.psid,
> +			.psid_size = strlen(linecard->device.info.psid),
> +			.devlink = linecard_devlink,
> +		},
> +		.mlxsw_core = mlxsw_core,
> +		.linecard = linecard,
> +	};
> +	int err;
> +
> +	mutex_lock(&linecard->lock);
> +	if (!linecard->active) {
> +		NL_SET_ERR_MSG_MOD(extack, "Failed to flash non-active linecard");

IMO it's not clear enough that the problem is the fact that the line
card is inactive. Maybe:

"Only active linecards can be flashed"

Either way:

Reviewed-by: Ido Schimmel <[email-masked]>

> +		err = -EINVAL;
> +		goto unlock;
> +	}
> +	err = mlxsw_core_fw_flash(mlxsw_core, &info.mlxfw_dev,
> +				  firmware, extack);
> +unlock:
> +	mutex_unlock(&linecard->lock);
> +	return err;
> +}