Re: [PATCH V1] regulator: da9211: fix unmatched of_node and add gpio control

From: Mark Brown
Date: Thu Jan 15 2015 - 06:21:48 EST


On Thu, Jan 15, 2015 at 10:29:08AM +0900, James Ban wrote:
> This is a patch for fixing unmatched of_node and adding gpio control.

That sounds like two separate changes to me...

> Optional properties:
> +- bucka-uses-gpio: BUCKA can be controlled by gpio.
> +- bucka-enable-platform-gpio: platform gpio for control of BUCKA.
> +- bucka-enable-init-state: initial state of gpio for BUCKA

Even for a single GPIO specifiers are usually called -gpios. It also
seems redundant to have the -uses property, if there is a GPIO specifier
for the enable then we can just assume it's supposed to be used without
the extra property.

> + bucka-uses-gpio;
> + bucka-enable-platform-gpio = <&gpio 27 0>;
> + bucka-enable-init-state = <0>;
> +
> + buckb-uses-gpio;
> + buckb-enable-platform-gpio = <&gpio 17 0>;
> + buckb-enable-init-state = <0>;
> +
> regulators {
> BUCKA {
> regulator-name = "VBUCKA";

Would it not be more natural to have the properties in the node for the
regulator (the recently added of_parse_cb will help with that)?

> + if (of_get_property(dev->of_node, "bucka-uses-gpio", NULL)) {
> + gpio = of_get_named_gpio(dev->of_node,
> + "bucka-enable-platform-gpio", 0);
> + if (!gpio_is_valid(gpio)) {
> + dev_err(dev, "invalid gpio: %d\n", gpio);
> + return ERR_PTR(-EINVAL);
> + }

This will be broken for deferred probe, it's better to pass through any
errors.

Attachment: signature.asc
Description: Digital signature