
On 10/03/2015 08:14 AM, Simon Glass wrote:
Hi Stephen,
On 2 October 2015 at 00:29, Stephen Warren swarren@wwwdotorg.org wrote:
On 10/01/2015 05:00 PM, Simon Glass wrote:
On Friday, 25 September 2015, Stephen Warren swarren@wwwdotorg.org wrote:
From: Stephen Warren swarren@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.
It's just odd to use const int instead of enum I think.
What makes it odd?