From patchwork Mon Oct 7 15:06:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13824919 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 6EB75CFB44A for ; Mon, 7 Oct 2024 15:27:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=P2CvXVrRqmh4sFqPBb+q9K3gAiwFS2lNPnQAePsDizo=; b=x69I1rU3l6e+aBhGwTz7EHkIjK J3CoRHQXST0fJVK6VUyIlvSucPUPN+6RHprrkk5yt9+HGgn6qgudabdGoNxbctfSDNBcYFVhorRSp Nw4L68pbVetkXfrgd7pKxVfQZ4lH3kVUZKjvBJMJyP958Wdn/qJ5mafiGqjGm8dMCV42+d2HNdg3O OqOlSzOCmYb3AbiN2tV+1UREVScr4GxekMK1F7yC5SygXMFTxir1vDWLHuxFqX2IDDhhgO3CFGwqi kz0gllMVQgaZaoRWGbA9V/UVorLywMt9QklIWgaD/2Jn39sntQv6Zb95k3+JWM5Bk2qnwNT/0UreP pQSOVWEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxpde-00000002vsk-1VUF; Mon, 07 Oct 2024 15:27:10 +0000 Received: from mgamail.intel.com ([198.175.65.19]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxpMq-00000002snj-2BPC for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2024 15:09:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728313789; x=1759849789; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GdFJbEH9FuHcHkDgW9w9j0RlEqZ4KkfewDrDe8HQ5S0=; b=natmlS9aWv9YibpUWRIbokxeCxVQ9qwzOqLM5c/QNYWCdpHJy434xsqN 4oyI+t8sc5kfVGWmvJUCYm1+X5E7hPf5VynV8oORmg7UZ2degxSlX9HUw qy7Oqs6sUARNeQVnwjG8TuyIScAqM1PYPpOulfYIrNNZYSHWVIbgUvrCT YDyA/n8ehP/0ewVA5vyiwJVxLfyM7NX65/r+2GaZefdtkavSRcSZ42fxp bw8Bj/IY8Q9D1m3OFHGTzIVblUmTSG3rWr9qzM5Dj9U4WtHcou9hkQKSs GFXLGWk51xuEgbZIkEqqYFWSkQ2IOiPrtoOMIzb1lvv2TIMo1TNXN7Vf3 A==; X-CSE-ConnectionGUID: UlPSc0q/Tf2+3l5zeNnOrg== X-CSE-MsgGUID: DU7lg7sYSKuTBbTZvOfZ6A== X-IronPort-AV: E=McAfee;i="6700,10204,11218"; a="27346839" X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="27346839" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2024 08:08:58 -0700 X-CSE-ConnectionGUID: EVLZ8vnYQ3+e6g0dKKK1lA== X-CSE-MsgGUID: 4tzqZlrqSAGNiQT0kZMEmw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="79494665" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa003.fm.intel.com with ESMTP; 07 Oct 2024 08:08:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C116A27C; Mon, 07 Oct 2024 18:08:53 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Vinod Koul , Paul Cercueil , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Subject: [PATCH v1 1/4] dmaengine: Replace dma_request_slave_channel() by dma_request_chan() Date: Mon, 7 Oct 2024 18:06:45 +0300 Message-ID: <20241007150852.2183722-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241007150852.2183722-1-andriy.shevchenko@linux.intel.com> References: <20241007150852.2183722-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-20241007_080948_637418_F9B3843C X-CRM114-Status: GOOD ( 12.39 ) 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 Replace dma_request_slave_channel() by dma_request_chan() as suggested since the former is deprecated. Signed-off-by: Andy Shevchenko --- drivers/dma/imx-sdma.c | 5 ++--- include/linux/dmaengine.h | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 72299a08af44..3a769934c984 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -1459,9 +1459,8 @@ static int sdma_alloc_chan_resources(struct dma_chan *chan) * dmatest, thus create 'struct imx_dma_data mem_data' for this case. * Please note in any other slave case, you have to setup chan->private * with 'struct imx_dma_data' in your own filter function if you want to - * request dma channel by dma_request_channel() rather than - * dma_request_slave_channel(). Othwise, 'MEMCPY in case?' will appear - * to warn you to correct your filter function. + * request DMA channel by dma_request_channel(), otherwise, 'MEMCPY in + * case?' will appear to warn you to correct your filter function. */ if (!data) { dev_dbg(sdmac->sdma->dev, "MEMCPY in case?\n"); diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index b137fdb56093..b4e6de892d34 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -1632,8 +1632,8 @@ static inline struct dma_chan { struct dma_chan *chan; - chan = dma_request_slave_channel(dev, name); - if (chan) + chan = dma_request_chan(dev, name); + if (!IS_ERR(chan)) return chan; if (!fn || !fn_param) From patchwork Mon Oct 7 15:06:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13824920 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 D8FEECFB44B for ; Mon, 7 Oct 2024 15:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4XG7OGEFmNM/J443VUfGgMn6gKg1IJ/WTCSz8njMl9E=; b=AOXOWcdhkFQd1wn/xqfe1Rb2k/ BPlmysGKzHnasRyctatgps1PCLczNwnvMwqpTNVG9e423smbgltFtLpUDj5aae3tRdPWgdL90taZQ 1JHmiAkZxJHYZFNjdpUQHChRyms4392JYPlHIbLRfTBGijiHWbyLhDqK1t9wQCJeEM1DOiWm5GxjG bHf2XsPMW4OiMHlQ7ls5CDUdPI0vPSkbmtR24vKM3p4n+V9J+U8sHvHDRv+FGAyB5d4BCd8hff/DO 0lY1Efh5WxrHf3GxZF4t6RPrN2A3dWHWAMf57KAX4KRf9039yWUXnztMOpi2kdVTuYlmpXcrodeL6 vYybjUoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxpdd-00000002vs4-2apA; Mon, 07 Oct 2024 15:27:09 +0000 Received: from mgamail.intel.com ([198.175.65.19]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxpMo-00000002snj-4793 for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2024 15:09:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728313787; x=1759849787; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v+m7u6xYkCBvtRWhJdg+uTuu7BjwAyMzFJa9C4zYqqo=; b=Ub8rcmjCR6O0HPzR2xjd8q3I71MOKhs6BiazdDAbjF9R5QCCYz7N4mFD 4KGtX9vya+VwsC8gaNC1B+dt8yQuNkk4SDHnNXZaLV1X7qWjfpa8ptw5S PwezgsSWtnkNUuXj38N1IL+AmBDmqiN3riPZ/LFbAmYu3G0ESeWc69STp hhNlk16UOaxbJ4IbZrSyD7J4t415QiSDz/Mkorhfjw9VaJbac5Fz1uJt7 Uv+tdLIWUyNLhtN6tB+4/Y0A6N6K4rz7dKNWVA8D5fLshfo2YoVtHsMjG 31/nPh63vIG8D+Rg+3pWYqwhq26a7qNslhh5P8TNLyM13t0Y4J/vPar5x Q==; X-CSE-ConnectionGUID: Oi8w3ny2RJia/k6x1UTgmA== X-CSE-MsgGUID: Dorvbdq5RaKMJr8J75BerA== X-IronPort-AV: E=McAfee;i="6700,10204,11218"; a="27346845" X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="27346845" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2024 08:08:58 -0700 X-CSE-ConnectionGUID: N3tW80l1RxCuOo04E+yaXw== X-CSE-MsgGUID: JWCOqzuCTyCipaIKiLRelw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="79494666" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa003.fm.intel.com with ESMTP; 07 Oct 2024 08:08:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C68C337D; Mon, 07 Oct 2024 18:08:53 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Vinod Koul , Paul Cercueil , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Subject: [PATCH v1 2/4] dmaengine: Use dma_request_channel() instead of __dma_request_channel() Date: Mon, 7 Oct 2024 18:06:46 +0300 Message-ID: <20241007150852.2183722-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241007150852.2183722-1-andriy.shevchenko@linux.intel.com> References: <20241007150852.2183722-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-20241007_080947_098585_1AE19B18 X-CRM114-Status: GOOD ( 11.09 ) 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 Let's reduce the surface of the use of __dma_request_channel(). Hopefully we can make it internall to the DMA drivers or kill for good completely. Signed-off-by: Andy Shevchenko --- include/linux/dmaengine.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index b4e6de892d34..2f46056096d6 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -1639,7 +1639,7 @@ static inline struct dma_chan if (!fn || !fn_param) return NULL; - return __dma_request_channel(&mask, fn, fn_param, NULL); + return dma_request_channel(mask, fn, fn_param); } static inline char * From patchwork Mon Oct 7 15:06:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13824918 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 8C412CFB449 for ; Mon, 7 Oct 2024 15:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=N8Di9psVjG9pwzFvbHumRqIo93Ys2adbFlF/RnbTEvk=; b=bmj2eeVgKcbw6AWEPld1nlfS9c uibvpbuRXLJCtPbyrpTJ/MccYmqQf+dZSHXnvmCKqhHI7iZjm4+SlvD6PZnwhY0bH6rHCWMHyIQrM y3oPYq/oX4kyv6nLY31VsQCrt7xTSdV6LbvSrehV92n32GrF7yDaEALk4QzDMnQm7kyKrB4Hqiouy 3Z5fWJitvaiZ/mLLVB/nR4AXJ3uW1A31rr0IFzuBzI/Te6yB8JFxvgF/y1aOGv/4zGowvKDa4frWe 6ivAAoNEOhIGZycj5pcB1kN3kOxC2IVYEZDRyOX3O7IkIetuS+w8Nd493nAF6N0PBIAaWJsw8V5bf omg4xY8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxpdb-00000002vrq-2tz0; Mon, 07 Oct 2024 15:27:07 +0000 Received: from mgamail.intel.com ([192.198.163.7]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxpM3-00000002sYo-2xdx for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2024 15:09:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728313740; x=1759849740; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qGhUu9mdJXXubW4rlkY8zXABwAVgp9j7AomaOvWbYPc=; b=cg8/OFAf4RwKM1lGm7wfIVdx1AdA2DDPbQUEv5Ky3fRn+2Ibt91e0T34 1eUBX0SK4+Pau5C0mJIWWReiEXmT2QHq1qX6wjRRPoQ1LUn31wLAKFnKt 9jrbHVRmubLXa/tUGJAE7nW3mNDkxEqM6TREDEacYH67hj/WsqpE4AyaA zv5PdSfV1mL0GSegyl5+R3cJEY7DAxhLwYWYZz/MspKaufDjrgrbFpM7+ aPRnWcOg136TtCLBHNvDqZPsyT81XIohTq38jbIv7nMReZWK0m1JV0tln qEFaGVo+VmaMG0whStW6MX6ikTHhfeyjMeOjfVKZGNPjn8mfRbKpTa1aF g==; X-CSE-ConnectionGUID: oqEo9FVuQ46fylmOkseKAA== X-CSE-MsgGUID: jUdDGJNJR2aagy2+hJUxJQ== X-IronPort-AV: E=McAfee;i="6700,10204,11218"; a="52870238" X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="52870238" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2024 08:08:58 -0700 X-CSE-ConnectionGUID: pm590HrVQSGvXKUrqLQhkA== X-CSE-MsgGUID: vHncrqsZQFCU65LpdBLbvQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="80477332" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa004.jf.intel.com with ESMTP; 07 Oct 2024 08:08:55 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id DCC564FB; Mon, 07 Oct 2024 18:08:53 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Vinod Koul , Paul Cercueil , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Subject: [PATCH v1 3/4] dmaengine: Add a comment on why it's okay when kasprintf() fails Date: Mon, 7 Oct 2024 18:06:47 +0300 Message-ID: <20241007150852.2183722-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241007150852.2183722-1-andriy.shevchenko@linux.intel.com> References: <20241007150852.2183722-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-20241007_080859_810596_5E09FC3B X-CRM114-Status: GOOD ( 11.44 ) 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 In dma_request_chan() one of the kasprintf() call is not checked against NULL. This is completely fine right now, but make others aware of this aspect by adding a comment. Signed-off-by: Andy Shevchenko --- drivers/dma/dmaengine.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index c1357d7f3dc6..dd4224d90f07 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -854,8 +854,8 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name) found: #ifdef CONFIG_DEBUG_FS - chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev), - name); + chan->dbg_client_name = kasprintf(GFP_KERNEL, "%s:%s", dev_name(dev), name); + /* No functional issue if it fails, users are supposed to test before use */ #endif chan->name = kasprintf(GFP_KERNEL, "dma:%s", name); From patchwork Mon Oct 7 15:06:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13824921 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 3404CCFB446 for ; Mon, 7 Oct 2024 15:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wiwqAt+Y9oZdHbwarfu3F46IZil2jsSocZOJBMp2mkQ=; b=qC3sxaOu0+H3bL0HiQ7UVABsVr 80U2WlxDNRv6QKcM8Glwo0KeW6RF+QGOXetv3CsaRDYVozxfVSn50uqVq90Au4hbzUBUuLgcZyKfj EC1D7UH2Ef8qcjTP1TC712QgBvE5yM48iK1JENgQP1TYnyMIqZ77O/vsEH0x8fjbTbPINa58PyC4C 9WX9w9OYwBmHjNdWhOdC86uK30HSPDqz6JQnYZyyeJJel2/hby3uU+QKB+G0zKbZ459u44fq5H1k7 p195nAphOUob4COdW4B/XoZOLTfqaeRe09acP8U+YyY4Y0ozt/FDqO8yhA95ICnhTEB9UzM03O+jM 80zHDSNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sxpdf-00000002vt1-0Mju; Mon, 07 Oct 2024 15:27:11 +0000 Received: from mgamail.intel.com ([198.175.65.19]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sxpMq-00000002sol-3UqS for linux-arm-kernel@lists.infradead.org; Mon, 07 Oct 2024 15:09:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728313789; x=1759849789; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jjUrqSMvD+TNkk6dISyjVWCLL2O2l9uhCDaFAXlWcKY=; b=K4AxniVah24htxHO2j5+7mIboQQudzQ35leJKrfaYaC9K1wrhaliJsP5 0vtuhDmEv5dKzDt6e255c/PXRs14m+t0djQDRJpHcNdB10ikhBdM3/E47 R4RRwnSsXl3yANCDcA3Kb/uyJc/onj1iXZEIvVPk+z9VzpzaetPHvDTW+ tktkCc1vd95moJQyv3fSCfLUrBLkWuFK+MF5DbKu07NHkoLx/hCuZp7Zc YZbo90vGBXC/BM0UvMdpzZDjERP+1mm37LrkG6d7N3yMLqN6qa2G1Su1K j3GRVByvSf/3E56VN2/yFkT/b2l7J0VCd1EdqPQZ3zpSQXAaQSW80hZkT A==; X-CSE-ConnectionGUID: S5XPNpAmQw2tYoTcNUiUFA== X-CSE-MsgGUID: hJqDmqzkT/uDtCkxV5V6yg== X-IronPort-AV: E=McAfee;i="6700,10204,11218"; a="27346849" X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="27346849" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2024 08:08:58 -0700 X-CSE-ConnectionGUID: ewQNEzAwQ0GaSUbdLRDDZw== X-CSE-MsgGUID: VqR2QV4FQVKvxwDO3aRN1A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="79494670" Received: from black.fi.intel.com ([10.237.72.28]) by fmviesa003.fm.intel.com with ESMTP; 07 Oct 2024 08:08:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id EB25556D; Mon, 07 Oct 2024 18:08:53 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , Vinod Koul , Paul Cercueil , dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Subject: [PATCH v1 4/4] dmaengine: Unify checks in dma_request_chan() Date: Mon, 7 Oct 2024 18:06:48 +0300 Message-ID: <20241007150852.2183722-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20241007150852.2183722-1-andriy.shevchenko@linux.intel.com> References: <20241007150852.2183722-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-20241007_080948_980953_272904C8 X-CRM114-Status: GOOD ( 13.14 ) 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 Use firmware node and unify checks accordingly in dma_request_chan(). As a side effect we get rid of the node dereferencing in struct device. Signed-off-by: Andy Shevchenko --- drivers/dma/dmaengine.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index dd4224d90f07..758fcd0546d8 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include #include #include @@ -812,15 +814,13 @@ static const struct dma_slave_map *dma_filter_match(struct dma_device *device, */ struct dma_chan *dma_request_chan(struct device *dev, const char *name) { + struct fwnode_handle *fwnode = dev_fwnode(dev); struct dma_device *d, *_d; struct dma_chan *chan = NULL; - /* If device-tree is present get slave info from here */ - if (dev->of_node) - chan = of_dma_request_slave_channel(dev->of_node, name); - - /* If device was enumerated by ACPI get slave info from here */ - if (has_acpi_companion(dev) && !chan) + if (is_of_node(fwnode)) + chan = of_dma_request_slave_channel(to_of_node(fwnode), name); + else if (is_acpi_device_node(fwnode)) chan = acpi_dma_request_slave_chan_by_name(dev, name); if (PTR_ERR(chan) == -EPROBE_DEFER)