Skip to contentSkip to conversation

dma: tegra: don't open code of_device_get_match_data()

PATCH Superseded Laxman Dewangan 3 participants 4 messages Mar 1, 2016 – Mar 4, 2016

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Laxman Dewangan

author maintainer
#0 lore raw

PATCH 1/1 dma: tegra: don't open code of_device_get_match_data()

Use of_device_get_match_data() for getting matched data instead of implementing this locally.

---
 drivers/dma/tegra20-apb-dma.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/dma/tegra20-apb-dma.c +4 -6
index 935da81..ced588f 100644
@@ -1317,15 +1317,13 @@ static int tegra_dma_probe(struct platform_device *pdev)
 	struct tegra_dma *tdma;
 	int ret;
 	int i;
-	const struct tegra_dma_chip_data *cdata = NULL;
-	const struct of_device_id *match;
+	const struct tegra_dma_chip_data *cdata;
 
-	match = of_match_device(tegra_dma_of_match, &pdev->dev);
-	if (!match) {
-		dev_err(&pdev->dev, "Error: No device match found\n");
+	cdata = of_device_get_match_data(&pdev->dev);
+	if (!cdata) {
+		dev_err(&pdev->dev, "Error: No device match data found\n");
 		return -ENODEV;
 	}
-	cdata = match->data;
 
 	tdma = devm_kzalloc(&pdev->dev, sizeof(*tdma) + cdata->nr_channels *
 			sizeof(struct tegra_dma_channel), GFP_KERNEL);
Signature · 1 line
2.1.4
#2 lore raw
In reply to Laxman Dewangan
Quoted 2 lines · Laxman Dewangan

Use of_device_get_match_data() for getting matched data instead of implementing this locally.

I have applied this after fixing subsystem name. Please ensure you use the right name

Signature · 1 line
~Vinod
author maintainer
#3 lore raw
Quoted 7 lines · Vinod Koul
Quoted 2 lines · Laxman Dewangan

Use of_device_get_match_data() for getting matched data instead of implementing this locally.

I have applied this after fixing subsystem name. Please ensure you use the right name

Ooops, the directory name is "dma" and hence I used subsystem name as "dma". File names are also containing dma only and so this mistake happened. Will keep in mind in future patches.