Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1883902pxj; Sun, 13 Jun 2021 01:27:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgejO1DH7+q/FmqpAcRqJZCB4GgpiR4umz3CKLO6sWMf04SJF6lVlvUnB3FdsQqqM9oOV6 X-Received: by 2002:a17:906:3888:: with SMTP id q8mr10590169ejd.15.1623572861364; Sun, 13 Jun 2021 01:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623572861; cv=none; d=google.com; s=arc-20160816; b=xueCSKyE1n58FdaqqcbWQlhgtorxbWagAU8MeUExhGSpwEcTSUhgu2+k81i6Ijvor8 v5GYRxoWFeaY0OcDztruFUTg83Oh7yRyby4jyn0v8VmoEkACwHRB1RoGo3DXQiaGMGp7 XXOsEecFF9SMCk/EYqlH/9i4y+JFXg1pgtMZFTfhLnLw4hQszrwh5hhZRxodr3IyL6gW o+OIdjoCFfnun1Dxkn2l030iX8MnnOZF9612lOjjRTTnHYFI6FbSpPjeApfYG+qG7TXg jvLj5cseYZFNIgrJS9h+2gvdUIuf5REi+0+IGxUk/CwFUuqXtmEr2CYAVrnDxOxGe+5t ZRdg== 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=7D76HXQ42gmGg8CVseZVsquhjyfw5+4gcSQu0EopeSM=; b=arf3+eti5BKDWiwUKQ+DKF4Qnbprxvtuck2gRDJocRkS4CA79Fy0K5DcchzdOl8+VC YdMEafrKs8RUUgatumZjFYOBk/RcYp+dwK0t2ba7gnCkW6ts78H+7+fW5lUxcaHGQFS7 rpUYTBFtNt/LnPjCeqbbFDjXlIbBK7FfqZWB8/F6KK82cN2ZyxjETLTuvjDzBNWZ0IY3 vLS4evfU23h0LmN26P8wOBImpiYAZWWTEDmjG3sEnSiYYKnDIIAOlITtvXSmumzP9zkX 8AxL0TBGIeQo/tKXJIXsHEb43BT0rloyD/8uo0zdWE2F66y6iyEuxX5QQd3imTcO2IHb OcMw== 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 b13si2494385edy.312.2021.06.13.01.27.18; Sun, 13 Jun 2021 01:27:41 -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 S230095AbhFMIZO (ORCPT + 99 others); Sun, 13 Jun 2021 04:25:14 -0400 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:38805 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229870AbhFMIZO (ORCPT ); Sun, 13 Jun 2021 04:25:14 -0400 Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d41 with ME id GYPB2500E21Fzsu03YPBdx; Sun, 13 Jun 2021 10:23:12 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 13 Jun 2021 10:23:12 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: sathya.prakash@broadcom.com, sreekanth.reddy@broadcom.com, suganath-prabu.subramani@broadcom.com Cc: MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH 2/3] scsi: mptbase: switch from 'pci_' to 'dma_' API in 'mpt_alloc_fw_memory()' Date: Sun, 13 Jun 2021 10:23:09 +0200 Message-Id: <98e4d8fa2567fcb81a3eb7626b1e2cb0ebc3ee82.1623571676.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. 'mpt_alloc_fw_memory()' should still use GFP_ATOMIC, because it can be called from 'mpt_do_upload()' which might sleep. Signed-off-by: Christophe JAILLET --- Instead of using GFP_ATOMIC, we could pass the 'sleepFlag' from 'mpt_do_upload()' and check all other callers to pass the expected flag. --- drivers/message/fusion/mptbase.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c index a9f261b6f613..2add74f92323 100644 --- a/drivers/message/fusion/mptbase.c +++ b/drivers/message/fusion/mptbase.c @@ -3517,7 +3517,8 @@ mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size) rc = 0; goto out; } - ioc->cached_fw = pci_alloc_consistent(ioc->pcidev, size, &ioc->cached_fw_dma); + ioc->cached_fw = dma_alloc_coherent(&ioc->pcidev->dev, size, + &ioc->cached_fw_dma, GFP_ATOMIC); if (!ioc->cached_fw) { printk(MYIOC_s_ERR_FMT "Unable to allocate memory for the cached firmware image!\n", ioc->name); @@ -3550,7 +3551,8 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc) sz = ioc->facts.FWImageSize; dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "free_fw_memory: FW Image @ %p[%p], sz=%d[%x] bytes\n", ioc->name, ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz)); - pci_free_consistent(ioc->pcidev, sz, ioc->cached_fw, ioc->cached_fw_dma); + dma_free_coherent(&ioc->pcidev->dev, sz, ioc->cached_fw, + ioc->cached_fw_dma); ioc->alloc_total -= sz; ioc->cached_fw = NULL; } -- 2.30.2