浏览代码

gpio: htc-egpio: Unique label per chip

Give the HTC EGPIO chips unique names, htc-egpio-0,
htc-egpio-1 etc, so that it gets possible to associate
machine descriptor tables with individual chips.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Linus Walleij 6 年之前
父节点
当前提交
212d706961
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      drivers/gpio/gpio-htc-egpio.c

+ 7 - 1
drivers/gpio/gpio-htc-egpio.c

@@ -334,7 +334,13 @@ static int __init egpio_probe(struct platform_device *pdev)
 		ei->chip[i].is_out = pdata->chip[i].direction;
 		ei->chip[i].is_out = pdata->chip[i].direction;
 		ei->chip[i].dev = &(pdev->dev);
 		ei->chip[i].dev = &(pdev->dev);
 		chip = &(ei->chip[i].chip);
 		chip = &(ei->chip[i].chip);
-		chip->label           = "htc-egpio";
+		chip->label = devm_kasprintf(&pdev->dev, GFP_KERNEL,
+					     "htc-egpio-%d",
+					     i);
+		if (!chip->label) {
+			ret = -ENOMEM;
+			goto fail;
+		}
 		chip->parent          = &pdev->dev;
 		chip->parent          = &pdev->dev;
 		chip->owner           = THIS_MODULE;
 		chip->owner           = THIS_MODULE;
 		chip->get             = egpio_get;
 		chip->get             = egpio_get;