From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Sat, 3 Oct 2015 13:17:58 -0600 Subject: [U-Boot] [PATCH 2/2] gpio: tegra: use named constants In-Reply-To: References: <1443199448-18180-1-git-send-email-swarren@wwwdotorg.org> <1443199448-18180-2-git-send-email-swarren@wwwdotorg.org> <560DC1F7.6060905@wwwdotorg.org> Message-ID: <561029E6.9070501@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 10/03/2015 08:14 AM, Simon Glass wrote: > Hi Stephen, > > On 2 October 2015 at 00:29, Stephen Warren wrote: >> On 10/01/2015 05:00 PM, Simon Glass wrote: >>> >>> On Friday, 25 September 2015, Stephen Warren >>> wrote: >>>> >>>> From: Stephen Warren >>>> >>>> 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?