dmaengine: Unify checks in dma_request_chan()

Use dev_fwnode() to simplify the check logic for Device Tree and ACPI
in dma_request_chan().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250205145757.889247-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Andy Shevchenko 2025-02-05 16:57:12 +02:00 committed by Vinod Koul
parent 1722fb4a13
commit 91d8560c15

View File

@ -40,6 +40,8 @@
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/hardirq.h> #include <linux/hardirq.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/of.h>
#include <linux/property.h>
#include <linux/percpu.h> #include <linux/percpu.h>
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include <linux/mutex.h> #include <linux/mutex.h>
@ -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 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_device *d, *_d;
struct dma_chan *chan = NULL; struct dma_chan *chan = NULL;
/* If device-tree is present get slave info from here */ if (is_of_node(fwnode))
if (dev->of_node) chan = of_dma_request_slave_channel(to_of_node(fwnode), name);
chan = of_dma_request_slave_channel(dev->of_node, name); else if (is_acpi_device_node(fwnode))
/* If device was enumerated by ACPI get slave info from here */
if (has_acpi_companion(dev) && !chan)
chan = acpi_dma_request_slave_chan_by_name(dev, name); chan = acpi_dma_request_slave_chan_by_name(dev, name);
if (PTR_ERR(chan) == -EPROBE_DEFER) if (PTR_ERR(chan) == -EPROBE_DEFER)