Skip to content

Commit 91d8560

Browse files
andy-shevvinodkoul
authored andcommitted
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>
1 parent 1722fb4 commit 91d8560

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/dma/dmaengine.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#include <linux/dmaengine.h>
4141
#include <linux/hardirq.h>
4242
#include <linux/spinlock.h>
43+
#include <linux/of.h>
44+
#include <linux/property.h>
4345
#include <linux/percpu.h>
4446
#include <linux/rcupdate.h>
4547
#include <linux/mutex.h>
@@ -812,15 +814,13 @@ static const struct dma_slave_map *dma_filter_match(struct dma_device *device,
812814
*/
813815
struct dma_chan *dma_request_chan(struct device *dev, const char *name)
814816
{
817+
struct fwnode_handle *fwnode = dev_fwnode(dev);
815818
struct dma_device *d, *_d;
816819
struct dma_chan *chan = NULL;
817820

818-
/* If device-tree is present get slave info from here */
819-
if (dev->of_node)
820-
chan = of_dma_request_slave_channel(dev->of_node, name);
821-
822-
/* If device was enumerated by ACPI get slave info from here */
823-
if (has_acpi_companion(dev) && !chan)
821+
if (is_of_node(fwnode))
822+
chan = of_dma_request_slave_channel(to_of_node(fwnode), name);
823+
else if (is_acpi_device_node(fwnode))
824824
chan = acpi_dma_request_slave_chan_by_name(dev, name);
825825

826826
if (PTR_ERR(chan) == -EPROBE_DEFER)

0 commit comments

Comments
 (0)