From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] gpio: tegra: use named constants
Date: Thu, 1 Oct 2015 17:29:59 -0600 [thread overview]
Message-ID: <560DC1F7.6060905@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ3iDMQ9p2ZFUV-zNe4Ng8nyo=Hx2dcnUZPBbz1=8oa=uQ@mail.gmail.com>
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.
next prev parent reply other threads:[~2015-10-01 23:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 16:44 [U-Boot] [PATCH 1/2] gpio: tegra: remove unused type Stephen Warren
2015-09-25 16:44 ` [U-Boot] [PATCH 2/2] gpio: tegra: use named constants Stephen Warren
2015-10-01 23:00 ` Simon Glass
2015-10-01 23:29 ` Stephen Warren [this message]
2015-10-03 14:14 ` Simon Glass
2015-10-03 19:17 ` Stephen Warren
2015-10-01 23:00 ` [U-Boot] [PATCH 1/2] gpio: tegra: remove unused type Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=560DC1F7.6060905@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox