From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] gpio: tegra: use named constants
Date: Sat, 3 Oct 2015 13:17:58 -0600 [thread overview]
Message-ID: <561029E6.9070501@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ1VpsyFA-NFX1+0eHSxJ6=cTi8JYPBpS=eQ8GH-PFhMjQ@mail.gmail.com>
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?
next prev parent reply other threads:[~2015-10-03 19:17 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
2015-10-03 14:14 ` Simon Glass
2015-10-03 19:17 ` Stephen Warren [this message]
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=561029E6.9070501@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.