Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2004543pxv; Sat, 10 Jul 2021 23:16:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOMRloQk+lx3C+tAflt8gfY/bJkzwfaLxtSzDeyPclv3QQC+aSD5k/D682ofgU+73MFDiI X-Received: by 2002:a05:6402:53:: with SMTP id f19mr58197907edu.200.1625984185018; Sat, 10 Jul 2021 23:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625984185; cv=none; d=google.com; s=arc-20160816; b=T9H8tlk4RRA+vGSWbd/jG9m1I7kcvFn0Q4OdE3AXgwvF4MCSEOVbnYaG0dHrcY2TL9 Ds3/Zz3NTD8ItuzwOxsF5d5cPGT08pzf/+Qhm0IPjRl/Mii8/vYOuXAks4ymvuLsJyWo 8fi5HBrtTopFud1d6Vhk/goPRgG+WnVsudAbp2pFiBI4Bhqn009mMubzOFplH8zBHLr3 0z2+idrWUp5QjADbf6aTAmZiXL8yvX/BAllKR8VrCwPcBxEefRQ2MN9OVA9jblbz1RYc FYO1yyWj1CT/kBMpCK/bUvh45dmQWNM++rfgamLfeSumELr8OdQ+jBfzjpu5xMGo1oQP LnJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5Q+4in9iwsMsrvUV0WuL2k/0afjPrhibGP/TBZbJ7iI=; b=n1tVOfpPfrFARQWJJmBg6J3TmLpmIn72ozc4Vn0FxBAf8TOKdcfQO75I1jFbn4tnU2 tZpvQsRMefG4lugSjPpUF9mTcTdhKdUwS+AlxPP0o39CCe3QUel11OebP0qt4pfj1T+u 4nJm7Y0wB98rkF3HlNwgdtLhadXpQ95F6ZPQ1OGZB7mQuSHUNKYyhZmgmn8FUH9TOLn1 pCTHkZO07aHC389CGVUQajXtpMmv2bwb8qHevoYtEFgsydEKx609MUgTKWEUHK9Nqaw7 lGCJ+Sv0QuAZLi7mbu/L8gEnyBgsnQPkhSQhQWeIKl08ZEJFnkochEdk2d1+q5qJS4tf eZ2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eo9si15827841ejc.528.2021.07.10.23.16.02; Sat, 10 Jul 2021 23:16:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230476AbhGKGQI (ORCPT + 99 others); Sun, 11 Jul 2021 02:16:08 -0400 Received: from out05.smtpout.orange.fr ([193.252.22.214]:29894 "EHLO out.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230058AbhGKGQI (ORCPT ); Sun, 11 Jul 2021 02:16:08 -0400 Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d42 with ME id TiDL2500221Fzsu03iDLkq; Sun, 11 Jul 2021 08:13:20 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 11 Jul 2021 08:13:20 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: giovanni.cabiddu@intel.com, herbert@gondor.apana.org.au, davem@davemloft.net, tomaszx.kowalik@intel.com, marco.chiappero@intel.com, andriy.shevchenko@linux.intel.com, fiona.trahe@intel.com, wojciech.ziemba@intel.com, ztong0001@gmail.com, qat-linux@intel.com Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 1/3] crypto: qat - Simplify code and axe the use of a deprecated API Date: Sun, 11 Jul 2021 08:13:18 +0200 Message-Id: <7283306389ffa7fe230e2a40f7328f064b872757.1625983602.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The wrappers in include/linux/pci-dma-compat.h should go away. Replace 'pci_set_dma_mask/pci_set_consistent_dma_mask' by an equivalent and less verbose 'dma_set_mask_and_coherent()' call. Signed-off-by: Christophe JAILLET --- If needed, see post from Christoph Hellwig on the kernel-janitors ML: https://marc.info/?l=kernel-janitors&m=158745678307186&w=4 We could also reduce indentation by merging the 2 'if' together. If this is the preferred style, I'll send a v2. --- drivers/crypto/qat/qat_4xxx/adf_drv.c | 8 ++------ drivers/crypto/qat/qat_c3xxx/adf_drv.c | 9 ++------- drivers/crypto/qat/qat_c3xxxvf/adf_drv.c | 9 ++------- drivers/crypto/qat/qat_c62x/adf_drv.c | 9 ++------- drivers/crypto/qat/qat_c62xvf/adf_drv.c | 9 ++------- drivers/crypto/qat/qat_dh895xcc/adf_drv.c | 9 ++------- drivers/crypto/qat/qat_dh895xccvf/adf_drv.c | 9 ++------- 7 files changed, 14 insertions(+), 48 deletions(-) diff --git a/drivers/crypto/qat/qat_4xxx/adf_drv.c b/drivers/crypto/qat/qat_4xxx/adf_drv.c index a8805c815d16..f2b6c0ca039a 100644 --- a/drivers/crypto/qat/qat_4xxx/adf_drv.c +++ b/drivers/crypto/qat/qat_4xxx/adf_drv.c @@ -221,16 +221,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /* Set DMA identifier */ - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { - if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { + if ((dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))) { dev_err(&pdev->dev, "No usable DMA configuration.\n"); ret = -EFAULT; goto out_err; - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); } /* Get accelerator capabilities mask */ diff --git a/drivers/crypto/qat/qat_c3xxx/adf_drv.c b/drivers/crypto/qat/qat_c3xxx/adf_drv.c index 7fb3343ae8b0..cc4ed61478a8 100644 --- a/drivers/crypto/qat/qat_c3xxx/adf_drv.c +++ b/drivers/crypto/qat/qat_c3xxx/adf_drv.c @@ -159,17 +159,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /* set dma identifier */ - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { - if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { + if ((dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))) { dev_err(&pdev->dev, "No usable DMA configuration\n"); ret = -EFAULT; goto out_err_disable; - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } - - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); } if (pci_request_regions(pdev, ADF_C3XXX_DEVICE_NAME)) { diff --git a/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c b/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c index 067ca5e17d38..e271da064266 100644 --- a/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c +++ b/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c @@ -141,17 +141,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /* set dma identifier */ - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { - if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { + if ((dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))) { dev_err(&pdev->dev, "No usable DMA configuration\n"); ret = -EFAULT; goto out_err_disable; - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } - - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); } if (pci_request_regions(pdev, ADF_C3XXXVF_DEVICE_NAME)) { diff --git a/drivers/crypto/qat/qat_c62x/adf_drv.c b/drivers/crypto/qat/qat_c62x/adf_drv.c index 1f5de442e1e6..5e2fc0c1a759 100644 --- a/drivers/crypto/qat/qat_c62x/adf_drv.c +++ b/drivers/crypto/qat/qat_c62x/adf_drv.c @@ -159,17 +159,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /* set dma identifier */ - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { - if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { + if ((dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))) { dev_err(&pdev->dev, "No usable DMA configuration\n"); ret = -EFAULT; goto out_err_disable; - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } - - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); } if (pci_request_regions(pdev, ADF_C62X_DEVICE_NAME)) { diff --git a/drivers/crypto/qat/qat_c62xvf/adf_drv.c b/drivers/crypto/qat/qat_c62xvf/adf_drv.c index 51ea88c0b17d..8fa5660fe654 100644 --- a/drivers/crypto/qat/qat_c62xvf/adf_drv.c +++ b/drivers/crypto/qat/qat_c62xvf/adf_drv.c @@ -141,17 +141,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /* set dma identifier */ - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { - if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { + if ((dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))) { dev_err(&pdev->dev, "No usable DMA configuration\n"); ret = -EFAULT; goto out_err_disable; - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } - - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); } if (pci_request_regions(pdev, ADF_C62XVF_DEVICE_NAME)) { diff --git a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c index a9ec4357144c..d0bd18e65104 100644 --- a/drivers/crypto/qat/qat_dh895xcc/adf_drv.c +++ b/drivers/crypto/qat/qat_dh895xcc/adf_drv.c @@ -159,17 +159,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /* set dma identifier */ - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { - if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { + if ((dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))) { dev_err(&pdev->dev, "No usable DMA configuration\n"); ret = -EFAULT; goto out_err_disable; - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } - - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); } if (pci_request_regions(pdev, ADF_DH895XCC_DEVICE_NAME)) { diff --git a/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c b/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c index 29999da716cc..ce5eab45218e 100644 --- a/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c +++ b/drivers/crypto/qat/qat_dh895xccvf/adf_drv.c @@ -141,17 +141,12 @@ static int adf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) } /* set dma identifier */ - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { - if ((pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))) { + if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { + if ((dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))) { dev_err(&pdev->dev, "No usable DMA configuration\n"); ret = -EFAULT; goto out_err_disable; - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); } - - } else { - pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); } if (pci_request_regions(pdev, ADF_DH895XCCVF_DEVICE_NAME)) { -- 2.30.2