[PATCH] nvme: update firmware version after commit

Keith Busch kbusch at kernel.org
Fri Oct 13 07:07:45 PDT 2023


On Fri, Oct 13, 2023 at 08:26:23AM +0200, Daniel Wagner wrote:
> +static void nvme_update_firmware_rev(struct nvme_ctrl *ctrl)
> +{
> +	struct nvme_id_ctrl *id;
> +	int ret;
> +
> +	ret = nvme_identify_ctrl(ctrl, &id);
> +	if (ret) {
> +		dev_warn(ctrl->device, "Identify Controller failed (%d)\n", ret);
> +		return;
> +	}
> +	memcpy(ctrl->subsys->firmware_rev, id->fr,
> +	       sizeof(ctrl->subsys->firmware_rev));
> +}
> +
>  static void nvme_fw_act_work(struct work_struct *work)
>  {
>  	struct nvme_ctrl *ctrl = container_of(work,
> @@ -4109,6 +4123,7 @@ static void nvme_fw_act_work(struct work_struct *work)
>  	nvme_unquiesce_io_queues(ctrl);
>  	/* read FW slot information to clear the AER */
>  	nvme_get_fw_slot_info(ctrl);
> +	nvme_update_firmware_rev(ctrl);

The "fw_slot_info()" call also gets the firmware version, so no need to
do it a different way. Just add the memcpy to that function instead of
introducing a new one.



More information about the Linux-nvme mailing list