Skip to content

Commit c48de45

Browse files
robherringvinodkoul
authored andcommitted
dmaengine: Drop unnecessary of_match_device() calls
If probe is reached, we've already matched the device and in the case of DT matching, the struct device_node pointer will be set. Therefore, there is no need to call of_match_device() in probe. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20231006213835.332848-1-robh@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent a67ba97 commit c48de45

File tree

4 files changed

+13
-32
lines changed

4 files changed

+13
-32
lines changed

drivers/dma/k3dma.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/platform_device.h>
1616
#include <linux/slab.h>
1717
#include <linux/spinlock.h>
18-
#include <linux/of_device.h>
1918
#include <linux/of.h>
2019
#include <linux/clk.h>
2120
#include <linux/of_dma.h>
@@ -839,7 +838,6 @@ static int k3_dma_probe(struct platform_device *op)
839838
{
840839
const struct k3dma_soc_data *soc_data;
841840
struct k3_dma_dev *d;
842-
const struct of_device_id *of_id;
843841
int i, ret, irq = 0;
844842

845843
d = devm_kzalloc(&op->dev, sizeof(*d), GFP_KERNEL);
@@ -854,19 +852,16 @@ static int k3_dma_probe(struct platform_device *op)
854852
if (IS_ERR(d->base))
855853
return PTR_ERR(d->base);
856854

857-
of_id = of_match_device(k3_pdma_dt_ids, &op->dev);
858-
if (of_id) {
859-
of_property_read_u32((&op->dev)->of_node,
860-
"dma-channels", &d->dma_channels);
861-
of_property_read_u32((&op->dev)->of_node,
862-
"dma-requests", &d->dma_requests);
863-
ret = of_property_read_u32((&op->dev)->of_node,
864-
"dma-channel-mask", &d->dma_channel_mask);
865-
if (ret) {
866-
dev_warn(&op->dev,
867-
"dma-channel-mask doesn't exist, considering all as available.\n");
868-
d->dma_channel_mask = (u32)~0UL;
869-
}
855+
of_property_read_u32((&op->dev)->of_node,
856+
"dma-channels", &d->dma_channels);
857+
of_property_read_u32((&op->dev)->of_node,
858+
"dma-requests", &d->dma_requests);
859+
ret = of_property_read_u32((&op->dev)->of_node,
860+
"dma-channel-mask", &d->dma_channel_mask);
861+
if (ret) {
862+
dev_warn(&op->dev,
863+
"dma-channel-mask doesn't exist, considering all as available.\n");
864+
d->dma_channel_mask = (u32)~0UL;
870865
}
871866

872867
if (!(soc_data->flags & K3_FLAG_NOCLK)) {

drivers/dma/mmp_pdma.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <linux/device.h>
1616
#include <linux/platform_data/mmp_dma.h>
1717
#include <linux/dmapool.h>
18-
#include <linux/of_device.h>
1918
#include <linux/of_dma.h>
2019
#include <linux/of.h>
2120

@@ -1019,7 +1018,6 @@ static struct dma_chan *mmp_pdma_dma_xlate(struct of_phandle_args *dma_spec,
10191018
static int mmp_pdma_probe(struct platform_device *op)
10201019
{
10211020
struct mmp_pdma_device *pdev;
1022-
const struct of_device_id *of_id;
10231021
struct mmp_dma_platdata *pdata = dev_get_platdata(&op->dev);
10241022
int i, ret, irq = 0;
10251023
int dma_channels = 0, irq_num = 0;
@@ -1039,8 +1037,7 @@ static int mmp_pdma_probe(struct platform_device *op)
10391037
if (IS_ERR(pdev->base))
10401038
return PTR_ERR(pdev->base);
10411039

1042-
of_id = of_match_device(mmp_pdma_dt_ids, pdev->dev);
1043-
if (of_id) {
1040+
if (pdev->dev->of_node) {
10441041
/* Parse new and deprecated dma-channels properties */
10451042
if (of_property_read_u32(pdev->dev->of_node, "dma-channels",
10461043
&dma_channels))

drivers/dma/pxa_dma.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
#include <linux/device.h>
1616
#include <linux/platform_data/mmp_dma.h>
1717
#include <linux/dmapool.h>
18-
#include <linux/of_device.h>
19-
#include <linux/of_dma.h>
2018
#include <linux/of.h>
19+
#include <linux/of_dma.h>
2120
#include <linux/wait.h>
2221
#include <linux/dma/pxa-dma.h>
2322

@@ -1344,7 +1343,6 @@ static int pxad_init_dmadev(struct platform_device *op,
13441343
static int pxad_probe(struct platform_device *op)
13451344
{
13461345
struct pxad_device *pdev;
1347-
const struct of_device_id *of_id;
13481346
const struct dma_slave_map *slave_map = NULL;
13491347
struct mmp_dma_platdata *pdata = dev_get_platdata(&op->dev);
13501348
int ret, dma_channels = 0, nb_requestors = 0, slave_map_cnt = 0;
@@ -1362,8 +1360,7 @@ static int pxad_probe(struct platform_device *op)
13621360
if (IS_ERR(pdev->base))
13631361
return PTR_ERR(pdev->base);
13641362

1365-
of_id = of_match_device(pxad_dt_ids, &op->dev);
1366-
if (of_id) {
1363+
if (op->dev.of_node) {
13671364
/* Parse new and deprecated dma-channels properties */
13681365
if (of_property_read_u32(op->dev.of_node, "dma-channels",
13691366
&dma_channels))

drivers/dma/stm32-dma.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <linux/list.h>
2222
#include <linux/module.h>
2323
#include <linux/of.h>
24-
#include <linux/of_device.h>
2524
#include <linux/of_dma.h>
2625
#include <linux/platform_device.h>
2726
#include <linux/pm_runtime.h>
@@ -1561,17 +1560,10 @@ static int stm32_dma_probe(struct platform_device *pdev)
15611560
struct stm32_dma_chan *chan;
15621561
struct stm32_dma_device *dmadev;
15631562
struct dma_device *dd;
1564-
const struct of_device_id *match;
15651563
struct resource *res;
15661564
struct reset_control *rst;
15671565
int i, ret;
15681566

1569-
match = of_match_device(stm32_dma_of_match, &pdev->dev);
1570-
if (!match) {
1571-
dev_err(&pdev->dev, "Error: No device match found\n");
1572-
return -ENODEV;
1573-
}
1574-
15751567
dmadev = devm_kzalloc(&pdev->dev, sizeof(*dmadev), GFP_KERNEL);
15761568
if (!dmadev)
15771569
return -ENOMEM;

0 commit comments

Comments
 (0)