Commit e0275034 authored by Axel Haslam's avatar Axel Haslam Committed by Linus Walleij

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: default avatarAxel Haslam <ahaslam@baylibre.com>
Reviewed-by: default avatarSekhar Nori <nsekhar@ti.com>
Acked-by: default avatarKevin Hilman <khilman@baylibre.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 43bbf94c
...@@ -40,6 +40,7 @@ struct davinci_gpio_regs { ...@@ -40,6 +40,7 @@ struct davinci_gpio_regs {
typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq); typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq);
#define BINTEN 0x8 /* GPIO Interrupt Per-Bank Enable Register */ #define BINTEN 0x8 /* GPIO Interrupt Per-Bank Enable Register */
#define MAX_LABEL_SIZE 20
static void __iomem *gpio_base; static void __iomem *gpio_base;
...@@ -201,6 +202,7 @@ static int davinci_gpio_probe(struct platform_device *pdev) ...@@ -201,6 +202,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
struct davinci_gpio_regs __iomem *regs; struct davinci_gpio_regs __iomem *regs;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct resource *res; struct resource *res;
char label[MAX_LABEL_SIZE];
pdata = davinci_gpio_get_pdata(pdev); pdata = davinci_gpio_get_pdata(pdev);
if (!pdata) { if (!pdata) {
...@@ -237,7 +239,10 @@ static int davinci_gpio_probe(struct platform_device *pdev) ...@@ -237,7 +239,10 @@ static int davinci_gpio_probe(struct platform_device *pdev)
return PTR_ERR(gpio_base); return PTR_ERR(gpio_base);
for (i = 0, base = 0; base < ngpio; i++, base += 32) { for (i = 0, base = 0; base < ngpio; i++, base += 32) {
chips[i].chip.label = "DaVinci"; snprintf(label, MAX_LABEL_SIZE, "davinci_gpio.%d", i);
chips[i].chip.label = devm_kstrdup(dev, label, GFP_KERNEL);
if (!chips[i].chip.label)
return -ENOMEM;
chips[i].chip.direction_input = davinci_direction_in; chips[i].chip.direction_input = davinci_direction_in;
chips[i].chip.get = davinci_gpio_get; chips[i].chip.get = davinci_gpio_get;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment