[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yyewrm+/viScefKC@sol>
Date: Mon, 19 Sep 2022 07:58:38 +0800
From: Kent Gibson <warthog618@...il.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Pali Rohár <pali@...nel.org>,
Shawn Guo <shawn.guo@...aro.org>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Wilczyński <kw@...ux.com>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] PCI: mvebu: switch to using gpiod API
On Fri, Sep 16, 2022 at 09:22:59AM +0200, Bartosz Golaszewski wrote:
> On Thu, Sep 15, 2022 at 11:30 AM Kent Gibson <warthog618@...il.com> wrote:
> >
> > Enums work for me - especially if the goal is to differentiate
> > logical from physical - there should be a distinct enum for each.
> >
>
> We won't even have to change the function signatures if we go with
> enums - they already take an int and I'm in general against putting
> enum types into function signatures in C as they give you a false
> sense of a strong type.
>
IMO it is far easier to remember that C doesn't range check enums than it
is to remember what specific values are appropriate for a function
accepting an enum as int. A specified type is a strong hint, and unlike
documentation is one that an IDE can parse and provide valid options for.
Passing enums as int is the norm in the kernel, so fair enough to keep
it that way, but that does contribute to the confusion that we are trying
to address here.
Cheers,
Kent.
Powered by blists - more mailing lists