On 10/01/2015 05:00 PM, Simon Glass wrote:
On Friday, 25 September 2015, Stephen Warren <swar...@wwwdotorg.org> wrote:
From: Stephen Warren <swar...@nvidia.com>

In order to make it clear what the parameters to set_config() and
set_direction() mean, and similarly for the return values from the
respective get_*(), define named constants for these values.

Disassembly shows no diff in the generated code, except that the
order of the code in the branches of tegra_gpio_get_function() gets
modified without affecting behaviour.

diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c

+static const int CONFIG_SFIO = 0;
+static const int CONFIG_GPIO = 1;
+static const int DIRECTION_INPUT = 0;
+static const int DIRECTION_OUTPUT = 1;

Why not use an enum?

I don't think it gives any benefit does it?

Doing so would entail 5 extra lines of overhead for the enum { and } lines. I'd want to define two separate enum blocks since I dislike putting logically unrelated enum values into a single enum definition. Even if I didn't do that, it's still 2 lines of useless overhead to add everything into a single enum.
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to