All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] dma: tegra: don't open code of_device_get_match_data()
@ 2016-03-02 14:29 ` Laxman Dewangan
  0 siblings, 0 replies; 5+ messages in thread
From: Laxman Dewangan @ 2016-03-02 14:29 UTC (permalink / raw)
  To: vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
	dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
	swarren-3lzwWm7+Weoh9ZMKESR00Q,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w
  Cc: gnurou-Re5JQEeQqe8AvxtiuMwx3w, dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Laxman Dewangan

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

Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>

---
Changes form V1:
- Found that it is possible to move of_device_id table to down
  where this is used i.e. just above the platform driver structure.
  Make this change on V2.
- Added Acked by from Thierry.

 drivers/dma/tegra20-apb-dma.c | 47 ++++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 25 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index 935da81..3871f29 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -1292,40 +1292,19 @@ static const struct tegra_dma_chip_data tegra148_dma_chip_data = {
 	.support_separate_wcount_reg = true,
 };
 
-
-static const struct of_device_id tegra_dma_of_match[] = {
-	{
-		.compatible = "nvidia,tegra148-apbdma",
-		.data = &tegra148_dma_chip_data,
-	}, {
-		.compatible = "nvidia,tegra114-apbdma",
-		.data = &tegra114_dma_chip_data,
-	}, {
-		.compatible = "nvidia,tegra30-apbdma",
-		.data = &tegra30_dma_chip_data,
-	}, {
-		.compatible = "nvidia,tegra20-apbdma",
-		.data = &tegra20_dma_chip_data,
-	}, {
-	},
-};
-MODULE_DEVICE_TABLE(of, tegra_dma_of_match);
-
 static int tegra_dma_probe(struct platform_device *pdev)
 {
 	struct resource	*res;
 	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);
@@ -1612,6 +1591,24 @@ static const struct dev_pm_ops tegra_dma_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(tegra_dma_pm_suspend, tegra_dma_pm_resume)
 };
 
+static const struct of_device_id tegra_dma_of_match[] = {
+	{
+		.compatible = "nvidia,tegra148-apbdma",
+		.data = &tegra148_dma_chip_data,
+	}, {
+		.compatible = "nvidia,tegra114-apbdma",
+		.data = &tegra114_dma_chip_data,
+	}, {
+		.compatible = "nvidia,tegra30-apbdma",
+		.data = &tegra30_dma_chip_data,
+	}, {
+		.compatible = "nvidia,tegra20-apbdma",
+		.data = &tegra20_dma_chip_data,
+	}, {
+	},
+};
+MODULE_DEVICE_TABLE(of, tegra_dma_of_match);
+
 static struct platform_driver tegra_dmac_driver = {
 	.driver = {
 		.name	= "tegra-apbdma",
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH V2] dma: tegra: don't open code of_device_get_match_data()
@ 2016-03-02 14:29 ` Laxman Dewangan
  0 siblings, 0 replies; 5+ messages in thread
From: Laxman Dewangan @ 2016-03-02 14:29 UTC (permalink / raw)
  To: vinod.koul, dan.j.williams, swarren, thierry.reding
  Cc: gnurou, dmaengine, linux-tegra, linux-kernel, Laxman Dewangan

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

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>

---
Changes form V1:
- Found that it is possible to move of_device_id table to down
  where this is used i.e. just above the platform driver structure.
  Make this change on V2.
- Added Acked by from Thierry.

 drivers/dma/tegra20-apb-dma.c | 47 ++++++++++++++++++++-----------------------
 1 file changed, 22 insertions(+), 25 deletions(-)

diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
index 935da81..3871f29 100644
--- a/drivers/dma/tegra20-apb-dma.c
+++ b/drivers/dma/tegra20-apb-dma.c
@@ -1292,40 +1292,19 @@ static const struct tegra_dma_chip_data tegra148_dma_chip_data = {
 	.support_separate_wcount_reg = true,
 };
 
-
-static const struct of_device_id tegra_dma_of_match[] = {
-	{
-		.compatible = "nvidia,tegra148-apbdma",
-		.data = &tegra148_dma_chip_data,
-	}, {
-		.compatible = "nvidia,tegra114-apbdma",
-		.data = &tegra114_dma_chip_data,
-	}, {
-		.compatible = "nvidia,tegra30-apbdma",
-		.data = &tegra30_dma_chip_data,
-	}, {
-		.compatible = "nvidia,tegra20-apbdma",
-		.data = &tegra20_dma_chip_data,
-	}, {
-	},
-};
-MODULE_DEVICE_TABLE(of, tegra_dma_of_match);
-
 static int tegra_dma_probe(struct platform_device *pdev)
 {
 	struct resource	*res;
 	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);
@@ -1612,6 +1591,24 @@ static const struct dev_pm_ops tegra_dma_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(tegra_dma_pm_suspend, tegra_dma_pm_resume)
 };
 
+static const struct of_device_id tegra_dma_of_match[] = {
+	{
+		.compatible = "nvidia,tegra148-apbdma",
+		.data = &tegra148_dma_chip_data,
+	}, {
+		.compatible = "nvidia,tegra114-apbdma",
+		.data = &tegra114_dma_chip_data,
+	}, {
+		.compatible = "nvidia,tegra30-apbdma",
+		.data = &tegra30_dma_chip_data,
+	}, {
+		.compatible = "nvidia,tegra20-apbdma",
+		.data = &tegra20_dma_chip_data,
+	}, {
+	},
+};
+MODULE_DEVICE_TABLE(of, tegra_dma_of_match);
+
 static struct platform_driver tegra_dmac_driver = {
 	.driver = {
 		.name	= "tegra-apbdma",
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] dma: tegra: don't open code of_device_get_match_data()
  2016-03-02 14:29 ` Laxman Dewangan
  (?)
@ 2016-03-03 16:00 ` Vinod Koul
  2016-03-04  2:06     ` Laxman Dewangan
  -1 siblings, 1 reply; 5+ messages in thread
From: Vinod Koul @ 2016-03-03 16:00 UTC (permalink / raw)
  To: Laxman Dewangan
  Cc: dan.j.williams, swarren, thierry.reding, gnurou, dmaengine,
	linux-tegra, linux-kernel

On Wed, Mar 02, 2016 at 07:59:26PM +0530, Laxman Dewangan wrote:
> Use of_device_get_match_data() for getting matched data
> instead of implementing this locally.
> 
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
> Acked-by: Thierry Reding <treding@nvidia.com>
> 
> ---
> Changes form V1:
> - Found that it is possible to move of_device_id table to down
>   where this is used i.e. just above the platform driver structure.
>   Make this change on V2.

But that is just noise and not relevant to the title which patch says. If
you want to do this code move please send that separately. I have picked v1
for now

-- 
~Vinod

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] dma: tegra: don't open code of_device_get_match_data()
  2016-03-03 16:00 ` Vinod Koul
@ 2016-03-04  2:06     ` Laxman Dewangan
  0 siblings, 0 replies; 5+ messages in thread
From: Laxman Dewangan @ 2016-03-04  2:06 UTC (permalink / raw)
  To: Vinod Koul
  Cc: dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
	swarren-3lzwWm7+Weoh9ZMKESR00Q,
	thierry.reding-Re5JQEeQqe8AvxtiuMwx3w,
	gnurou-Re5JQEeQqe8AvxtiuMwx3w, dmaengine-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA


On Thursday 03 March 2016 09:30 PM, Vinod Koul wrote:
> On Wed, Mar 02, 2016 at 07:59:26PM +0530, Laxman Dewangan wrote:
>> Use of_device_get_match_data() for getting matched data
>> instead of implementing this locally.
>>
>> Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>> Acked-by: Thierry Reding <treding-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>>
>> ---
>> Changes form V1:
>> - Found that it is possible to move of_device_id table to down
>>    where this is used i.e. just above the platform driver structure.
>>    Make this change on V2.
> But that is just noise and not relevant to the title which patch says. If
> you want to do this code move please send that separately. I have picked v1
> for now
>

OK, fine with me. Will post another patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH V2] dma: tegra: don't open code of_device_get_match_data()
@ 2016-03-04  2:06     ` Laxman Dewangan
  0 siblings, 0 replies; 5+ messages in thread
From: Laxman Dewangan @ 2016-03-04  2:06 UTC (permalink / raw)
  To: Vinod Koul
  Cc: dan.j.williams, swarren, thierry.reding, gnurou, dmaengine,
	linux-tegra, linux-kernel


On Thursday 03 March 2016 09:30 PM, Vinod Koul wrote:
> On Wed, Mar 02, 2016 at 07:59:26PM +0530, Laxman Dewangan wrote:
>> Use of_device_get_match_data() for getting matched data
>> instead of implementing this locally.
>>
>> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
>> Acked-by: Thierry Reding <treding@nvidia.com>
>>
>> ---
>> Changes form V1:
>> - Found that it is possible to move of_device_id table to down
>>    where this is used i.e. just above the platform driver structure.
>>    Make this change on V2.
> But that is just noise and not relevant to the title which patch says. If
> you want to do this code move please send that separately. I have picked v1
> for now
>

OK, fine with me. Will post another patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-04  2:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-02 14:29 [PATCH V2] dma: tegra: don't open code of_device_get_match_data() Laxman Dewangan
2016-03-02 14:29 ` Laxman Dewangan
2016-03-03 16:00 ` Vinod Koul
2016-03-04  2:06   ` Laxman Dewangan
2016-03-04  2:06     ` Laxman Dewangan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.