[PATCH 4/5] nvme-pci: use helper for ctrl sgl check

Niklas Cassel Niklas.Cassel at wdc.com
Mon Jun 7 01:02:12 PDT 2021


On Sun, Jun 06, 2021 at 05:37:04PM -0700, Chaitanya Kulkarni wrote:
> Use helper to check the controller's SGL support instead of open coding.
> 
> Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
> ---
>  drivers/nvme/host/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index 3aa7245a505f..a7e7afc609b4 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -536,7 +536,7 @@ static inline bool nvme_pci_use_sgls(struct nvme_dev *dev, struct request *req)
>  
>  	avg_seg_size = DIV_ROUND_UP(blk_rq_payload_bytes(req), nseg);
>  
> -	if (!(dev->ctrl.sgls & ((1 << 0) | (1 << 1))))
> +	if (!nvme_ctrl_sgl_supported(&dev->ctrl))
>  		return false;
>  	if (!iod->nvmeq->qid)
>  		return false;
> -- 
> 2.22.1

Hello Chaitanya,

I believe that you can apply the same cleanup for pci.c:nvme_map_data()


Kind regards,
Niklas


More information about the Linux-nvme mailing list