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)