gpio: Convert to using %pOF instead of full_name
Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Tien Hock Loh <thloh@altera.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Alexandre Courbot <gnurou@gmail.com> Cc: Brian Norris <computersforpeace@gmail.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: bcm-kernel-feedback-list@broadcom.com Cc: Michal Simek <michal.simek@xilinx.com> Cc: "Sören Brinkmann" <soren.brinkmann@xilinx.com> Cc: linux-gpio@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Acked-by: Gregory Fong <gregory.0xf0@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
1a9ef909ac
commit
7eb6ce2f27
|
@ -324,8 +324,8 @@ skip_irq:
|
||||||
return 0;
|
return 0;
|
||||||
teardown:
|
teardown:
|
||||||
of_mm_gpiochip_remove(&altera_gc->mmchip);
|
of_mm_gpiochip_remove(&altera_gc->mmchip);
|
||||||
pr_err("%s: registration failed with status %d\n",
|
pr_err("%pOF: registration failed with status %d\n",
|
||||||
node->full_name, ret);
|
node, ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -483,7 +483,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
gc->of_node = np;
|
gc->of_node = np;
|
||||||
gc->owner = THIS_MODULE;
|
gc->owner = THIS_MODULE;
|
||||||
gc->label = np->full_name;
|
gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pOF", dev->of_node);
|
||||||
gc->base = gpio_base;
|
gc->base = gpio_base;
|
||||||
gc->of_gpio_n_cells = 2;
|
gc->of_gpio_n_cells = 2;
|
||||||
gc->of_xlate = brcmstb_gpio_of_xlate;
|
gc->of_xlate = brcmstb_gpio_of_xlate;
|
||||||
|
|
|
@ -76,8 +76,7 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup pointers to chip functions */
|
/* Setup pointers to chip functions */
|
||||||
gc->label = devm_kstrdup(&pdev->dev, pdev->dev.of_node->full_name,
|
gc->label = devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOF", pdev->dev.of_node);
|
||||||
GFP_KERNEL);
|
|
||||||
if (!gc->label) {
|
if (!gc->label) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto err0;
|
goto err0;
|
||||||
|
@ -96,8 +95,7 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
err0:
|
err0:
|
||||||
iounmap(regs);
|
iounmap(regs);
|
||||||
pr_err("%s: GPIO chip registration failed\n",
|
pr_err("%pOF: GPIO chip registration failed\n", pdev->dev.of_node);
|
||||||
pdev->dev.of_node->full_name);
|
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -367,7 +367,7 @@ static int grgpio_probe(struct platform_device *ofdev)
|
||||||
gc->of_node = np;
|
gc->of_node = np;
|
||||||
gc->owner = THIS_MODULE;
|
gc->owner = THIS_MODULE;
|
||||||
gc->to_irq = grgpio_to_irq;
|
gc->to_irq = grgpio_to_irq;
|
||||||
gc->label = np->full_name;
|
gc->label = devm_kasprintf(&ofdev->dev, GFP_KERNEL, "%pOF", np);
|
||||||
gc->base = -1;
|
gc->base = -1;
|
||||||
|
|
||||||
err = of_property_read_u32(np, "nbits", &prop);
|
err = of_property_read_u32(np, "nbits", &prop);
|
||||||
|
|
|
@ -348,8 +348,8 @@ static int mpc8xxx_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
ret = gpiochip_add_data(gc, mpc8xxx_gc);
|
ret = gpiochip_add_data(gc, mpc8xxx_gc);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_err("%s: GPIO chip registration failed with status %d\n",
|
pr_err("%pOF: GPIO chip registration failed with status %d\n",
|
||||||
np->full_name, ret);
|
np, ret);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,7 +191,8 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
|
||||||
if (IS_ERR(tb10x_gpio->base))
|
if (IS_ERR(tb10x_gpio->base))
|
||||||
return PTR_ERR(tb10x_gpio->base);
|
return PTR_ERR(tb10x_gpio->base);
|
||||||
|
|
||||||
tb10x_gpio->gc.label = of_node_full_name(dn);
|
tb10x_gpio->gc.label =
|
||||||
|
devm_kasprintf(&pdev->dev, GFP_KERNEL, "%pOF", pdev->dev.of_node);
|
||||||
tb10x_gpio->gc.parent = &pdev->dev;
|
tb10x_gpio->gc.parent = &pdev->dev;
|
||||||
tb10x_gpio->gc.owner = THIS_MODULE;
|
tb10x_gpio->gc.owner = THIS_MODULE;
|
||||||
tb10x_gpio->gc.direction_input = tb10x_gpio_direction_in;
|
tb10x_gpio->gc.direction_input = tb10x_gpio_direction_in;
|
||||||
|
|
|
@ -527,13 +527,12 @@ static void tz1090_gpio_register_banks(struct tz1090_gpio *priv)
|
||||||
|
|
||||||
ret = of_property_read_u32(node, "reg", &addr);
|
ret = of_property_read_u32(node, "reg", &addr);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(priv->dev, "invalid reg on %s\n",
|
dev_err(priv->dev, "invalid reg on %pOF\n", node);
|
||||||
node->full_name);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (addr >= 3) {
|
if (addr >= 3) {
|
||||||
dev_err(priv->dev, "index %u in %s out of range\n",
|
dev_err(priv->dev, "index %u in %pOF out of range\n",
|
||||||
addr, node->full_name);
|
addr, node);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,8 +542,7 @@ static void tz1090_gpio_register_banks(struct tz1090_gpio *priv)
|
||||||
|
|
||||||
ret = tz1090_gpio_bank_probe(&info);
|
ret = tz1090_gpio_bank_probe(&info);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(priv->dev, "failure registering %s\n",
|
dev_err(priv->dev, "failure registering %pOF\n", node);
|
||||||
node->full_name);
|
|
||||||
of_node_put(node);
|
of_node_put(node);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,8 +360,8 @@ static int xgpio_probe(struct platform_device *pdev)
|
||||||
/* Call the OF gpio helper to setup and register the GPIO device */
|
/* Call the OF gpio helper to setup and register the GPIO device */
|
||||||
status = of_mm_gpiochip_add_data(np, &chip->mmchip, chip);
|
status = of_mm_gpiochip_add_data(np, &chip->mmchip, chip);
|
||||||
if (status) {
|
if (status) {
|
||||||
pr_err("%s: error in probe function with status %d\n",
|
pr_err("%pOF: error in probe function with status %d\n",
|
||||||
np->full_name, status);
|
np, status);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,8 @@ struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
|
||||||
ret = of_parse_phandle_with_args(np, propname, "#gpio-cells", index,
|
ret = of_parse_phandle_with_args(np, propname, "#gpio-cells", index,
|
||||||
&gpiospec);
|
&gpiospec);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_debug("%s: can't parse '%s' property of node '%s[%d]'\n",
|
pr_debug("%s: can't parse '%s' property of node '%pOF[%d]'\n",
|
||||||
__func__, propname, np->full_name, index);
|
__func__, propname, np, index);
|
||||||
return ERR_PTR(ret);
|
return ERR_PTR(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +93,8 @@ struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
|
||||||
if (IS_ERR(desc))
|
if (IS_ERR(desc))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
pr_debug("%s: parsed '%s' property of node '%s[%d]' - status (%d)\n",
|
pr_debug("%s: parsed '%s' property of node '%pOF[%d]' - status (%d)\n",
|
||||||
__func__, propname, np->full_name, index,
|
__func__, propname, np, index,
|
||||||
PTR_ERR_OR_ZERO(desc));
|
PTR_ERR_OR_ZERO(desc));
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -337,7 +337,7 @@ int of_mm_gpiochip_add_data(struct device_node *np,
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
struct gpio_chip *gc = &mm_gc->gc;
|
struct gpio_chip *gc = &mm_gc->gc;
|
||||||
|
|
||||||
gc->label = kstrdup(np->full_name, GFP_KERNEL);
|
gc->label = kasprintf(GFP_KERNEL, "%pOF", np);
|
||||||
if (!gc->label)
|
if (!gc->label)
|
||||||
goto err0;
|
goto err0;
|
||||||
|
|
||||||
|
@ -362,8 +362,7 @@ err2:
|
||||||
err1:
|
err1:
|
||||||
kfree(gc->label);
|
kfree(gc->label);
|
||||||
err0:
|
err0:
|
||||||
pr_err("%s: GPIO chip registration failed with status %d\n",
|
pr_err("%pOF: GPIO chip registration failed with status %d\n", np, ret);
|
||||||
np->full_name, ret);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(of_mm_gpiochip_add_data);
|
EXPORT_SYMBOL(of_mm_gpiochip_add_data);
|
||||||
|
@ -418,8 +417,8 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
|
||||||
group_names_propname,
|
group_names_propname,
|
||||||
index, &name);
|
index, &name);
|
||||||
if (strlen(name)) {
|
if (strlen(name)) {
|
||||||
pr_err("%s: Group name of numeric GPIO ranges must be the empty string.\n",
|
pr_err("%pOF: Group name of numeric GPIO ranges must be the empty string.\n",
|
||||||
np->full_name);
|
np);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -434,14 +433,14 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
|
||||||
} else {
|
} else {
|
||||||
/* npins == 0: special range */
|
/* npins == 0: special range */
|
||||||
if (pinspec.args[1]) {
|
if (pinspec.args[1]) {
|
||||||
pr_err("%s: Illegal gpio-range format.\n",
|
pr_err("%pOF: Illegal gpio-range format.\n",
|
||||||
np->full_name);
|
np);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group_names) {
|
if (!group_names) {
|
||||||
pr_err("%s: GPIO group range requested but no %s property.\n",
|
pr_err("%pOF: GPIO group range requested but no %s property.\n",
|
||||||
np->full_name, group_names_propname);
|
np, group_names_propname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,8 +451,8 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!strlen(name)) {
|
if (!strlen(name)) {
|
||||||
pr_err("%s: Group name of GPIO group range cannot be the empty string.\n",
|
pr_err("%pOF: Group name of GPIO group range cannot be the empty string.\n",
|
||||||
np->full_name);
|
np);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1787,7 +1787,7 @@ int gpiochip_irqchip_add_key(struct gpio_chip *gpiochip,
|
||||||
* conflicting triggers. Tell the user, and reset to NONE.
|
* conflicting triggers. Tell the user, and reset to NONE.
|
||||||
*/
|
*/
|
||||||
if (WARN(of_node && type != IRQ_TYPE_NONE,
|
if (WARN(of_node && type != IRQ_TYPE_NONE,
|
||||||
"%s: Ignoring %d default trigger\n", of_node->full_name, type))
|
"%pOF: Ignoring %d default trigger\n", of_node, type))
|
||||||
type = IRQ_TYPE_NONE;
|
type = IRQ_TYPE_NONE;
|
||||||
if (has_acpi_companion(gpiochip->parent) && type != IRQ_TYPE_NONE) {
|
if (has_acpi_companion(gpiochip->parent) && type != IRQ_TYPE_NONE) {
|
||||||
acpi_handle_warn(ACPI_HANDLE(gpiochip->parent),
|
acpi_handle_warn(ACPI_HANDLE(gpiochip->parent),
|
||||||
|
|
Loading…
Reference in New Issue