Re: [libgpiod v2][PATCH] core: make line values unsigned

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 27, 2022 at 4:26 PM Kent Gibson <warthog618@xxxxxxxxx> wrote:
>
> Line values are either 0 or 1, so remove the possibility of a value
> being negative by changing the type from int to unsigned int, similar
> to offsets.
>
> The exception is the value returned by gpiod_line_request_get_value()
> which uses a negative value to indicate an error, as is common practice.
>
> Signed-off-by: Kent Gibson <warthog618@xxxxxxxxx>
> ---

I don't see value in this. We now have an enum to represent the
logical states in the C API and enum's type in C is int. This change
would make it inconsistent with all other line properties for which we
use ints and represent their values with enumerations. If anything -
we shouldn't accept any value other than 0 and 1 but just like we do
with other properties in gpiod_line_config - when we fall-back to a
sane default for invalid values - we'd just use INACTIVE for 0 and
ACTIVE for everything else.

Bart



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux