[PATCH v5 3/4] nvme: Add Support for Opal: Unlock from S3 & Opal Allocation/Ioctls

Christoph Hellwig hch at infradead.org
Fri Feb 3 00:16:34 PST 2017


> +int nvme_opal_initialize(struct nvme_ctrl *ctrl)
> +{
> +	/* Opal dev has already been initialized for this controller */
> +	if (ctrl->opal_dev.initialized)
> +		return 0;
> +	init_opal_dev(&ctrl->opal_dev, &nvme_sec_submit);
> +
> +	if (check_opal_support(&ctrl->opal_dev, NULL, NULL) < 0)
> +		dev_warn(ctrl->device, "Opal is not supported\n");
> +
> +	return 0;
> +}

Can you move the initialized and supported checks into init_opal_dev?

That way we can remove this function entirely.

> +void nvme_unlock_from_suspend(struct nvme_ctrl *ctrl)
> +{
> +	if (!ctrl->opal_dev.supported)
> +		return;
> +	if (opal_unlock_from_suspend(&ctrl->opal_dev))
> +		dev_warn(ctrl->dev, "Failed to unlock one or more locking ranges!\n");

Similarly I think the supported check should simply go into 
opal_unlock_from_suspend, and the nvme-pci driver could call 
opal_unlock_from_suspend directly.



More information about the Linux-nvme mailing list