Re: [PATCH 2/2] PCI: mvebu: switch to using gpiod API

From: Kent Gibson
Date: Sun Sep 18 2022 - 19:58:51 EST


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@xxxxxxxxx> 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.