[PATCH 2/2] nvme: sanitize KATO setting

Christoph Hellwig hch at lst.de
Wed Feb 24 11:23:50 EST 2021


> +		unsigned long kato_delay = ctrl->kato >> 1;
> +
> +		queue_delayed_work(nvme_wq, &ctrl->ka_work, kato_delay * HZ);

> +		unsigned long kato_delay = ctrl->kato >> 1;
> +
> +		queue_delayed_work(nvme_wq, &ctrl->ka_work, kato_delay * HZ);

> +	unsigned long kato_delay = ctrl->kato >> 1;

> +	queue_delayed_work(nvme_wq, &ctrl->ka_work, kato_delay * HZ);

I think we need a properly documented helper for

	(ctrl->kato / 2) * HZ

instead of all this open coded magic.

>  	cmd.connect.kato = ctrl->kato ?
> -		cpu_to_le32((ctrl->kato + NVME_KATO_GRACE) * 1000) : 0;
> +		cpu_to_le32(ctrl->kato * 1000) : 0;

cpu_to_le32(0 * 1000) is still 0, so we can remove the branch here now.



More information about the Linux-nvme mailing list