From patchwork Thu Oct 11 18:49:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10637173 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 38FB4112B for ; Thu, 11 Oct 2018 18:51:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 294F62BFB5 for ; Thu, 11 Oct 2018 18:51:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27E222BFBF; Thu, 11 Oct 2018 18:51:18 +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 8B8EB2BFC0 for ; Thu, 11 Oct 2018 18:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729798AbeJLCTn (ORCPT ); Thu, 11 Oct 2018 22:19:43 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:35716 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729786AbeJLCTn (ORCPT ); Thu, 11 Oct 2018 22:19:43 -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=Q74+LlTu4Gezb5RLOQaRwNeZl4zWfO6fKfu8EhXvuz8=; b=dEv32uUT12xtcnJxs0cl6jQx0 H+/lGTwgk/KJYEQ6v2S72GCBNsT35IhTh68Kl+dWp7g3F5YNJifA0rhovOk4LxgCKtKLqXsLLkJra pEb4S3eDM6RWGn7hm51aaGw9if0nyLW7/b8JZvmwqap8UU79B1o7LdInHlakdjjbiEtgyPu4S4VcC m40Q/TuP7H3+QxVWFWfhEUMpOUrkARYyoDDtZs2CRMS6nocLefL3Z6Y59iOSnKv5eJZQpKdZ2LO1x +gqZ5V5dr8crHRDxmGHeDXTIlzqT3VYXaqiTb5rKnCyVixwgip+L8NSxefDyAyJai9oE4XrbPkRh2 a1DZV2mzw==; Received: from 089144207060.atnat0016.highway.bob.at ([89.144.207.60] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gAg3H-0001rZ-CN for linux-scsi@vger.kernel.org; Thu, 11 Oct 2018 18:51:15 +0000 From: Christoph Hellwig To: linux-scsi@vger.kernel.org Subject: [PATCH 21/28] qla1280: switch to generic DMA API Date: Thu, 11 Oct 2018 20:49:56 +0200 Message-Id: <20181011185003.16116-22-hch@lst.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181011185003.16116-1-hch@lst.de> References: <20181011185003.16116-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/qla1280.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c index 390775d5c918..15a50cc7e4b3 100644 --- a/drivers/scsi/qla1280.c +++ b/drivers/scsi/qla1280.c @@ -1750,7 +1750,7 @@ qla1280_load_firmware_dma(struct scsi_qla_host *ha) uint8_t *sp, *tbuf; dma_addr_t p_tbuf; - tbuf = pci_alloc_consistent(ha->pdev, 8000, &p_tbuf); + tbuf = dma_alloc_coherent(&ha->pdev->dev, 8000, &p_tbuf, GFP_KERNEL); if (!tbuf) return -ENOMEM; #endif @@ -1841,7 +1841,7 @@ qla1280_load_firmware_dma(struct scsi_qla_host *ha) out: #if DUMP_IT_BACK - pci_free_consistent(ha->pdev, 8000, tbuf, p_tbuf); + dma_free_coherent(&ha->pdev->dev, 8000, tbuf, p_tbuf); #endif return err; } @@ -4259,8 +4259,8 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) ha->devnum = devnum; /* specifies microcode load address */ #ifdef QLA_64BIT_PTR - if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(64))) { - if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32))) { + if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(64))) { + if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "scsi(%li): Unable to set a " "suitable DMA mask - aborting\n", ha->host_no); error = -ENODEV; @@ -4270,7 +4270,7 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) dprintk(2, "scsi(%li): 64 Bit PCI Addressing Enabled\n", ha->host_no); #else - if (pci_set_dma_mask(ha->pdev, DMA_BIT_MASK(32))) { + if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) { printk(KERN_WARNING "scsi(%li): Unable to set a " "suitable DMA mask - aborting\n", ha->host_no); error = -ENODEV; @@ -4278,17 +4278,17 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) } #endif - ha->request_ring = pci_alloc_consistent(ha->pdev, + ha->request_ring = dma_alloc_coherent(&ha->pdev->dev, ((REQUEST_ENTRY_CNT + 1) * sizeof(request_t)), - &ha->request_dma); + &ha->request_dma, GFP_KERNEL); if (!ha->request_ring) { printk(KERN_INFO "qla1280: Failed to get request memory\n"); goto error_put_host; } - ha->response_ring = pci_alloc_consistent(ha->pdev, + ha->response_ring = dma_alloc_coherent(&ha->pdev->dev, ((RESPONSE_ENTRY_CNT + 1) * sizeof(struct response)), - &ha->response_dma); + &ha->response_dma, GFP_KERNEL); if (!ha->response_ring) { printk(KERN_INFO "qla1280: Failed to get response memory\n"); goto error_free_request_ring; @@ -4370,11 +4370,11 @@ qla1280_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) release_region(host->io_port, 0xff); #endif error_free_response_ring: - pci_free_consistent(ha->pdev, + dma_free_coherent(&ha->pdev->dev, ((RESPONSE_ENTRY_CNT + 1) * sizeof(struct response)), ha->response_ring, ha->response_dma); error_free_request_ring: - pci_free_consistent(ha->pdev, + dma_free_coherent(&ha->pdev->dev, ((REQUEST_ENTRY_CNT + 1) * sizeof(request_t)), ha->request_ring, ha->request_dma); error_put_host: @@ -4404,10 +4404,10 @@ qla1280_remove_one(struct pci_dev *pdev) release_region(host->io_port, 0xff); #endif - pci_free_consistent(ha->pdev, + dma_free_coherent(&ha->pdev->dev, ((REQUEST_ENTRY_CNT + 1) * (sizeof(request_t))), ha->request_ring, ha->request_dma); - pci_free_consistent(ha->pdev, + dma_free_coherent(&ha->pdev->dev, ((RESPONSE_ENTRY_CNT + 1) * (sizeof(struct response))), ha->response_ring, ha->response_dma);