From patchwork Sun Oct 14 15:59:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10640693 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 51AB113AD for ; Sun, 14 Oct 2018 16:00:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5054C29E19 for ; Sun, 14 Oct 2018 16:00:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44AD529E29; Sun, 14 Oct 2018 16:00:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6D3029E19 for ; Sun, 14 Oct 2018 16:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727622AbeJNXlt (ORCPT ); Sun, 14 Oct 2018 19:41:49 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46880 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727386AbeJNXlt (ORCPT ); Sun, 14 Oct 2018 19:41:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender: Reply-To:Cc:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=FSJWMFxXO1ReFuXqpwLVxbTMDB9CdujG0Hs3QyP1uDM=; b=ilUqwxdRRda1LZ89zsrlh+5nJ 6Ykl4HGqcgOsAhpG1nfyH6gTLnGS63OZBqthanBMxCe1pcN0R6bDzvi6gnw53r9EK4JDIVGxUq+fQ SoH7oL2r/uqA51Cwkph8lzxzbSJNUxfGy8qHRKzAg4GCvSkZdbq724FiGO/xppXA0ahfpumOgTPfZ sfRv6XAVUj2V38VVfKdVjd72ZJUGESTVT7vKShM6Ma3Fxh9rGNqGmnyB0soMKU/hhp0CdC15b0rJ+ +dlnj0kVvfuPkMf9pDqb8UPLFiCHmjMu/bexgMmsn08+vKAU5mydVs35FMpxR0Ph9m8iqZOTE3pnV N1T7Q81Ng==; Received: from 089144199123.atnat0008.highway.a1.net ([89.144.199.123] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gBioW-0002ud-V8 for linux-scsi@vger.kernel.org; Sun, 14 Oct 2018 16:00:21 +0000 From: Christoph Hellwig To: linux-scsi@vger.kernel.org Subject: [PATCH 06/28] a100u2w: switch to generic DMA API Date: Sun, 14 Oct 2018 17:59:40 +0200 Message-Id: <20181014160002.8383-7-hch@lst.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181014160002.8383-1-hch@lst.de> References: <20181014160002.8383-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Switch from the legacy PCI DMA API to the generic DMA API. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn --- drivers/scsi/a100u2w.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c index 23b17621b6d2..00072ed9540b 100644 --- a/drivers/scsi/a100u2w.c +++ b/drivers/scsi/a100u2w.c @@ -1094,7 +1094,7 @@ static int inia100_probe_one(struct pci_dev *pdev, if (pci_enable_device(pdev)) goto out; - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) { + if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "Unable to set 32bit DMA " "on inia100 adapter, ignoring.\n"); goto out_disable_device; @@ -1124,7 +1124,8 @@ static int inia100_probe_one(struct pci_dev *pdev, /* Get total memory needed for SCB */ sz = ORC_MAXQUEUE * sizeof(struct orc_scb); - host->scb_virt = pci_zalloc_consistent(pdev, sz, &host->scb_phys); + host->scb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->scb_phys, + GFP_KERNEL); if (!host->scb_virt) { printk("inia100: SCB memory allocation error\n"); goto out_host_put; @@ -1132,7 +1133,8 @@ static int inia100_probe_one(struct pci_dev *pdev, /* Get total memory needed for ESCB */ sz = ORC_MAXQUEUE * sizeof(struct orc_extended_scb); - host->escb_virt = pci_zalloc_consistent(pdev, sz, &host->escb_phys); + host->escb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->escb_phys, + GFP_KERNEL); if (!host->escb_virt) { printk("inia100: ESCB memory allocation error\n"); goto out_free_scb_array; @@ -1177,10 +1179,12 @@ static int inia100_probe_one(struct pci_dev *pdev, out_free_irq: free_irq(shost->irq, shost); out_free_escb_array: - pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_extended_scb), + dma_free_coherent(&pdev->dev, + ORC_MAXQUEUE * sizeof(struct orc_extended_scb), host->escb_virt, host->escb_phys); out_free_scb_array: - pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_scb), + dma_free_coherent(&pdev->dev, + ORC_MAXQUEUE * sizeof(struct orc_scb), host->scb_virt, host->scb_phys); out_host_put: scsi_host_put(shost); @@ -1200,9 +1204,11 @@ static void inia100_remove_one(struct pci_dev *pdev) scsi_remove_host(shost); free_irq(shost->irq, shost); - pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_extended_scb), + dma_free_coherent(&pdev->dev, + ORC_MAXQUEUE * sizeof(struct orc_extended_scb), host->escb_virt, host->escb_phys); - pci_free_consistent(pdev, ORC_MAXQUEUE * sizeof(struct orc_scb), + dma_free_coherent(&pdev->dev, + ORC_MAXQUEUE * sizeof(struct orc_scb), host->scb_virt, host->scb_phys); release_region(shost->io_port, 256);