aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorAxel Haslam <ahaslam@baylibre.com>2016-11-03 07:34:10 -0400
committerLinus Walleij <linus.walleij@linaro.org>2016-11-09 03:13:35 -0500
commite0275034ad94c413090bab4bf65ccb70906725ed (patch)
tree3ab6b360344cfbb284c84abb748c7a532f2f6b1a /drivers/gpio
parent43bbf94c333ac1b1bee2bf05efb48e9ae8ea3e82 (diff)
gpio: davinci: Use unique labels for each gpio chip
The gpiod framework uses the chip label to match a specific chip. The davinci gpio driver, creates several chips using always the same label, which is not compatible with gpiod. To allow platform data to declare gpio lookup tables, and for drivers to use the gpiod framework, allocate unique label per registered chip. Signed-off-by: Axel Haslam <ahaslam@baylibre.com> Reviewed-by: Sekhar Nori <nsekhar@ti.com> Acked-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-davinci.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index dd262f00295d..9191056548fe 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -40,6 +40,7 @@ struct davinci_gpio_regs {
40typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq); 40typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq);
41 41
42#define BINTEN 0x8 /* GPIO Interrupt Per-Bank Enable Register */ 42#define BINTEN 0x8 /* GPIO Interrupt Per-Bank Enable Register */
43#define MAX_LABEL_SIZE 20
43 44
44static void __iomem *gpio_base; 45static void __iomem *gpio_base;
45 46
@@ -201,6 +202,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
201 struct davinci_gpio_regs __iomem *regs; 202 struct davinci_gpio_regs __iomem *regs;
202 struct device *dev = &pdev->dev; 203 struct device *dev = &pdev->dev;
203 struct resource *res; 204 struct resource *res;
205 char label[MAX_LABEL_SIZE];
204 206
205 pdata = davinci_gpio_get_pdata(pdev); 207 pdata = davinci_gpio_get_pdata(pdev);
206 if (!pdata) { 208 if (!pdata) {
@@ -237,7 +239,10 @@ static int davinci_gpio_probe(struct platform_device *pdev)
237 return PTR_ERR(gpio_base); 239 return PTR_ERR(gpio_base);
238 240
239 for (i = 0, base = 0; base < ngpio; i++, base += 32) { 241 for (i = 0, base = 0; base < ngpio; i++, base += 32) {
240 chips[i].chip.label = "DaVinci"; 242 snprintf(label, MAX_LABEL_SIZE, "davinci_gpio.%d", i);
243 chips[i].chip.label = devm_kstrdup(dev, label, GFP_KERNEL);
244 if (!chips[i].chip.label)
245 return -ENOMEM;
241 246
242 chips[i].chip.direction_input = davinci_direction_in; 247 chips[i].chip.direction_input = davinci_direction_in;
243 chips[i].chip.get = davinci_gpio_get; 248 chips[i].chip.get = davinci_gpio_get;