From patchwork Fri May 31 19:42:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13682072 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB18BC25B75 for ; Fri, 31 May 2024 19:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8EA33917PRok0k5lW2LqjoecNva0aeDcag9sG9PWTpw=; b=dHPDwcsh6/Vz2P EVXAG+LvshrlbNAT5kGpdMNGDnasLnpjxCEm/VApjfWbycI7W/uvf3v/FhYd4MUtGpNFsm4uq3Ko+ cCzS3HIYO1HXBW+4ME3Bvm6tJmTBiFlk5x4U5TG1CktiRE0DjAy/rdEVV41veghsdEbNqkNztN+VM /gIaNOOuDgnYTSqGzxQyyI+zVYKwMIxqVq87Jt04znFUiuWXLuzeHUnGguRdD2k73oQpPoRtLMQX4 lLcY/cI076Sdikau3MgDHZ+yAJJrTqvmFEOziK4xGs3VMHYZepqcoP1SS4R2AiugLXMISpwerl9G6 SEeW2TULHpv7lIeKFNfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sD8E6-0000000BISc-03Fl; Fri, 31 May 2024 19:47:46 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sD8Du-0000000BIOe-1swj for linux-arm-kernel@lists.infradead.org; Fri, 31 May 2024 19:47:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1717184854; x=1748720854; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dw73VBHvLlwJ5WnmcM+Jwh7n02iOvg6za1jV+ImKLH4=; b=DIjHp/xRrIpISTChamaEZRTseU4u5ru48MTtUntrnC4hXBPZLAt7dIrr AysEoeCj1+gzlg5Sps9/nSGW+GfajiU4A8fi+YqBLIi2OC35lPrlamBDg R11IUI/fARYBqJwx5LYzumtBu87mHN3CvL4QjaqRYGal0a72Gg09MRnU/ m/K2Gd6LZjCc4HFODvgiqvm/eKt5L0Es2dVBArbEmvIFHFob9NZbfj0PW 0fhywrjtKPKfrmUZ92Zt+gmJ+dMpLSIKGTK3lHalbAelFizhunfwKLZWE iKG/uqUwmdBWR+DaLXcja3tl/eAltXHPR7RwqdnfHMET1xfZDQCFLI3Cp g==; X-CSE-ConnectionGUID: ww1toHYDTJ6EJcHdOlg3YA== X-CSE-MsgGUID: owsVep7uSpmeqfXPW3nxlA== X-IronPort-AV: E=McAfee;i="6600,9927,11089"; a="31274002" X-IronPort-AV: E=Sophos;i="6.08,205,1712646000"; d="scan'208";a="31274002" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2024 12:47:30 -0700 X-CSE-ConnectionGUID: FTqvYBkEQNiQnSDTHsQIDQ== X-CSE-MsgGUID: F5BHzt2kRPyb0EUKNBFClg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,205,1712646000"; d="scan'208";a="41179049" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa005.jf.intel.com with ESMTP; 31 May 2024 12:47:27 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 013B7136; Fri, 31 May 2024 22:47:24 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Mark Brown , Yang Yingliang , Christophe JAILLET , Thangaraj Samynathan , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org Cc: Serge Semin , Daniel Mack , Haojian Zhuang , Robert Jarzmik , =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E?= =?utf-8?q?_A_=2E_Prado?= , Neil Armstrong Subject: [PATCH v1 1/8] spi: Introduce internal spi_xfer_is_dma_mapped() helper Date: Fri, 31 May 2024 22:42:33 +0300 Message-ID: <20240531194723.1761567-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240531194723.1761567-1-andriy.shevchenko@linux.intel.com> References: <20240531194723.1761567-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240531_124734_632245_A6EC9358 X-CRM114-Status: GOOD ( 10.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are few drivers that use the same pattern to check if the transfer is DMA mapped or not. Provide a helper. Signed-off-by: Andy Shevchenko Reviewed-by: Bryan O'Donoghue --- drivers/spi/internals.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/spi/internals.h b/drivers/spi/internals.h index 4a28a8395552..47a87c2a6979 100644 --- a/drivers/spi/internals.h +++ b/drivers/spi/internals.h @@ -40,4 +40,12 @@ static inline void spi_unmap_buf(struct spi_controller *ctlr, } #endif /* CONFIG_HAS_DMA */ +static inline bool spi_xfer_is_dma_mapped(struct spi_controller *ctlr, + struct spi_device *spi, + struct spi_transfer *xfer) +{ + return ctlr->can_dma && ctlr->can_dma(ctlr, spi, xfer) && + ctlr->cur_msg_mapped; +} + #endif /* __LINUX_SPI_INTERNALS_H */