[PATCH v2] pinctrl: at91: add driver data

Raphaël Poggi poggi.raph at gmail.com
Mon Sep 8 06:37:38 PDT 2014


This commit adds the driver data for the gpio-at91 driver.

Signed-off-by: Raphaël Poggi <poggi.raph at gmail.com>
---
 drivers/pinctrl/pinctrl-at91.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index d3423d0..3c6b38c 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -606,8 +606,10 @@ static struct gpio_ops at91_gpio_ops = {
 static struct of_device_id at91_gpio_dt_ids[] = {
 	{
 		.compatible = "atmel,at91rm9200-gpio",
+		.data = (unsigned long)&at91rm9200_ops,
 	}, {
 		.compatible = "atmel,at91sam9x5-gpio",
+		.data = (unsigned long)&at91sam9x5_ops,
 	}, {
 		/* sentinel */
 	},
@@ -629,6 +631,12 @@ static int at91_gpio_probe(struct device_d *dev)
 
 	at91_gpio = &gpio_chip[alias_idx];
 
+	ret = dev_get_drvdata(dev, (unsigned long *)&at91_gpio->ops);
+	if (ret) {
+		dev_err(dev, "dev_get_drvdata failed: %d\n", ret);
+		return ret;
+	}
+
 	clk = clk_get(dev, NULL);
 	if (IS_ERR(clk)) {
 		ret = PTR_ERR(clk);
@@ -667,8 +675,10 @@ static int at91_gpio_probe(struct device_d *dev)
 static struct platform_device_id at91_gpio_ids[] = {
 	{
 		.name = "at91rm9200-gpio",
+		.driver_data = (unsigned long)&at91rm9200_ops,
 	}, {
 		.name = "at91sam9x5-gpio",
+		.driver_data = (unsigned long)&at91sam9x5_ops,
 	}, {
 		/* sentinel */
 	},
-- 
2.1.0




More information about the barebox mailing list