All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4 1/4] gpio: tegra: Don't open code of_device_get_match_data()
@ 2016-04-22 10:09 ` Laxman Dewangan
  0 siblings, 0 replies; 21+ messages in thread
From: Laxman Dewangan @ 2016-04-22 10:09 UTC (permalink / raw)
  To: swarren, linus.walleij, gnurou, thierry.reding, linux-gpio,
	linux-tegra, linux-kernel
  Cc: 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>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Thierry Reding <treding@nvidia.com>

---
Collected reviewed/ack by from Stephen, Alexandre and Thieery.

 drivers/gpio/gpio-tegra.c | 50 +++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 26 deletions(-)

diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 790bb11..1b0c497 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -75,6 +75,11 @@ struct tegra_gpio_bank {
 #endif
 };
 
+struct tegra_gpio_soc_config {
+	u32 bank_stride;
+	u32 upper_offset;
+};
+
 static struct device *dev;
 static struct irq_domain *irq_domain;
 static void __iomem *regs;
@@ -445,27 +450,6 @@ static const struct dev_pm_ops tegra_gpio_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(tegra_gpio_suspend, tegra_gpio_resume)
 };
 
-struct tegra_gpio_soc_config {
-	u32 bank_stride;
-	u32 upper_offset;
-};
-
-static struct tegra_gpio_soc_config tegra20_gpio_config = {
-	.bank_stride = 0x80,
-	.upper_offset = 0x800,
-};
-
-static struct tegra_gpio_soc_config tegra30_gpio_config = {
-	.bank_stride = 0x100,
-	.upper_offset = 0x80,
-};
-
-static const struct of_device_id tegra_gpio_of_match[] = {
-	{ .compatible = "nvidia,tegra30-gpio", .data = &tegra30_gpio_config },
-	{ .compatible = "nvidia,tegra20-gpio", .data = &tegra20_gpio_config },
-	{ },
-};
-
 /* This lock class tells lockdep that GPIO irqs are in a different
  * category than their parents, so it won't report false recursion.
  */
@@ -473,8 +457,7 @@ static struct lock_class_key gpio_lock_class;
 
 static int tegra_gpio_probe(struct platform_device *pdev)
 {
-	const struct of_device_id *match;
-	struct tegra_gpio_soc_config *config;
+	const struct tegra_gpio_soc_config *config;
 	struct resource *res;
 	struct tegra_gpio_bank *bank;
 	int ret;
@@ -484,12 +467,11 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 
 	dev = &pdev->dev;
 
-	match = of_match_device(tegra_gpio_of_match, &pdev->dev);
-	if (!match) {
+	config = of_device_get_match_data(&pdev->dev);
+	if (!config) {
 		dev_err(&pdev->dev, "Error: No device match found\n");
 		return -ENODEV;
 	}
-	config = (struct tegra_gpio_soc_config *)match->data;
 
 	tegra_gpio_bank_stride = config->bank_stride;
 	tegra_gpio_upper_offset = config->upper_offset;
@@ -578,6 +560,22 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static struct tegra_gpio_soc_config tegra20_gpio_config = {
+	.bank_stride = 0x80,
+	.upper_offset = 0x800,
+};
+
+static struct tegra_gpio_soc_config tegra30_gpio_config = {
+	.bank_stride = 0x100,
+	.upper_offset = 0x80,
+};
+
+static const struct of_device_id tegra_gpio_of_match[] = {
+	{ .compatible = "nvidia,tegra30-gpio", .data = &tegra30_gpio_config },
+	{ .compatible = "nvidia,tegra20-gpio", .data = &tegra20_gpio_config },
+	{ },
+};
+
 static struct platform_driver tegra_gpio_driver = {
 	.driver		= {
 		.name	= "tegra-gpio",
-- 
2.1.4


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

end of thread, other threads:[~2016-04-25 10:11 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-22 10:09 [PATCH V4 1/4] gpio: tegra: Don't open code of_device_get_match_data() Laxman Dewangan
2016-04-22 10:09 ` Laxman Dewangan
2016-04-22 10:09 ` [PATCH V4 2/4] gpio: tegra: Make of_device_id compatible data to constant Laxman Dewangan
2016-04-22 10:09   ` Laxman Dewangan
2016-04-22 10:09 ` [PATCH V4 3/4] gpio: tegra: Get rid of all file scoped global variables Laxman Dewangan
2016-04-22 10:09   ` Laxman Dewangan
     [not found]   ` <1461319754-12040-3-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-04-25  5:13     ` Alexandre Courbot
2016-04-25  5:13       ` Alexandre Courbot
2016-04-25  8:36       ` Laxman Dewangan
2016-04-25 10:00     ` Thierry Reding
2016-04-25 10:00       ` Thierry Reding
2016-04-25  9:53       ` Laxman Dewangan
2016-04-25  9:53         ` Laxman Dewangan
     [not found]         ` <571DE912.3060602-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-04-25 10:11           ` Thierry Reding
2016-04-25 10:11             ` Thierry Reding
2016-04-22 10:09 ` [PATCH V4 4/4] gpio: tegra: Add support for gpio debounce Laxman Dewangan
2016-04-22 10:09   ` Laxman Dewangan
2016-04-22 19:53   ` Stephen Warren
2016-04-25  5:36   ` Alexandre Courbot
     [not found]     ` <CAAVeFuJykGNGj95r4P8vatxOA_yjsP1eQkDf9zS-dYV1piHTJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-25  8:40       ` Laxman Dewangan
2016-04-25  8:40         ` 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.