linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-gpio@vger.kernel.org
Subject: Re: [libgpiod v2][PATCH v3 1/3] API: add an enum for line values
Date: Sat, 5 Mar 2022 13:50:40 +0800	[thread overview]
Message-ID: <20220305055040.GA9638@sol> (raw)
In-Reply-To: <20220303091836.168223-2-brgl@bgdev.pl>

On Thu, Mar 03, 2022 at 10:18:34AM +0100, Bartosz Golaszewski wrote:
> In order to explicitly stress that line values as understood by libgpiod
> are logical values, expose a two-value enum with values called: ACTIVE
> and INACTIVE that should be used whenever referring to the state of GPIO
> lines.
> 
> The value of INACTIVE is set to 0 while that of ACTIVE to 1 so that users
> can still use integers in C (where no scoped enums exist).
> 
> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>

Works for me.

Reviewed-by: Kent Gibson <warthog618@gmail.com>


> ---
>  include/gpiod.h | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/include/gpiod.h b/include/gpiod.h
> index 074e395..34fdad6 100644
> --- a/include/gpiod.h
> +++ b/include/gpiod.h
> @@ -185,12 +185,20 @@ gpiod_chip_request_lines(struct gpiod_chip *chip,
>  /**
>   * @}
>   *
> - * @defgroup line_settings Line settings
> + * @defgroup line_settings Line definitions
>   * @{
>   *
> - * These defines are used both by gpiod_line_info and gpiod_line_config.
> + * These defines are used across the API.
>   */
>  
> +/**
> + * @brief Logical line state.
> + */
> +enum {
> +	GPIOD_LINE_VALUE_INACTIVE = 0,
> +	GPIOD_LINE_VALUE_ACTIVE = 1,
> +};
> +
>  /**
>   * @brief Direction settings.
>   */
> -- 
> 2.30.1
> 

  reply	other threads:[~2022-03-05  5:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03  9:18 [libgpiod v2][PATCH v3 0/3] libgpiod v2: rewrite tests for the C library Bartosz Golaszewski
2022-03-03  9:18 ` [libgpiod v2][PATCH v3 1/3] API: add an enum for line values Bartosz Golaszewski
2022-03-05  5:50   ` Kent Gibson [this message]
2022-03-03  9:18 ` [libgpiod v2][PATCH v3 2/3] line-config: expose the override logic to users Bartosz Golaszewski
2022-03-05  5:51   ` Kent Gibson
2022-03-05 20:57     ` Bartosz Golaszewski
2022-03-03  9:18 ` [libgpiod v2][PATCH v3 3/3] tests: rewrite core C tests using libgpiosim Bartosz Golaszewski
2022-03-05  5:51   ` Kent Gibson

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=20220305055040.GA9638@sol \
    --to=warthog618@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).