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: 13824896 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 268771D54E9 for ; Mon, 7 Oct 2024 15:09:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728313790; cv=none; b=frpEeqg2mPuw691VxH/nmCYsdlhj0KBPnkkLc7CL4JAmYXpzMaZOFutHqpPkFGpdlcVC7XrKqYL6QB1yGLH29QoFCGmhhEABPBizuISO/koRP0kJxtWJoopyYwhOb4iNA3jFJasJo42MiH+D000a8kYo7wh0cp981XCObQajeNo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728313790; c=relaxed/simple; bh=jjUrqSMvD+TNkk6dISyjVWCLL2O2l9uhCDaFAXlWcKY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q1KdUQPeCTKwWvpVpOCdmQcqsrE87dWDeRv2c2smcj/z5ogf+g5BWs1os1EVRO2whWvW3Oa4BhfuiR7lynfsbwBLgU8LyFaQPGoG1ggWi3jeAzXlNMVJFTmwRvSA/IobJDsjEpzjRpzoGlkdcPuzTJyGNXbPt6OT7U7CQSwEtIA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=OS+f84JE; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OS+f84JE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728313790; x=1759849790; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jjUrqSMvD+TNkk6dISyjVWCLL2O2l9uhCDaFAXlWcKY=; b=OS+f84JEVYwiaYFbAOJH/j0CylmIUBUIpGSY+W1CdUUzYem4q1jtbDTc E2CHagbbxRDOz6sA0t5KjZUtlZw34Tgtj+whL3kHTc00C0vIR5+Ek1JOx hRB4HhfbuCedRAi6G+HVle7oyPD2z34dWu7DjF1gYhqwwNZSS5I+eNB4S Ye/ZZ7Iylp1GxYWJkf772YwJ7IISixKptW/MZPsGvc1zTR6oM1zBgATBn bn/M0GZxA6iOik7NnzuGx4y2zDVxeX6VPqwsMZ8koLMSEMiW3Nmva0CsR WY1zlM305MFY41MQbz60tzu61RDCdWFEwS22sfHdubO8XvDz2wK4qFJp7 g==; X-CSE-ConnectionGUID: yVh02PkpSuuBP6gil3chhA== X-CSE-MsgGUID: Z0Z+LG4aR7S9W/74/UGHpw== X-IronPort-AV: E=McAfee;i="6700,10204,11218"; a="27346848" X-IronPort-AV: E=Sophos;i="6.11,184,1725346800"; d="scan'208";a="27346848" 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> Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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)