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>,
Viresh Kumar <viresh.kumar@linaro.org>,
linux-gpio@vger.kernel.org
Subject: Re: [libgpiod v2][PATCH 1/4] line-request: don't accept NULL line config
Date: Thu, 17 Feb 2022 11:02:43 +0800 [thread overview]
Message-ID: <20220217030243.GA8970@sol> (raw)
In-Reply-To: <20220210140745.1059087-2-brgl@bgdev.pl>
On Thu, Feb 10, 2022 at 03:07:42PM +0100, Bartosz Golaszewski wrote:
> While it was initially agreed that NULL line_config passed to
> gpiod_chip_request_lines() would result in lines being requested with
> default config (just like a newly created struct gpiod_line_config),
> I believe this is unintuitive in the context of all other functions in
> the C library not being NULL-aware (as advertised in one of the first
> paragraphs of the documentation) and should be changed to make both
> config structures mandatory.
>
> This is C after all and it should be both explicit and spartan. :)
>
Fair enough.
Reviewed-by: Kent Gibson <warthog618@gmail.com>
> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> ---
> include/gpiod.h | 4 +---
> lib/line-config.c | 5 -----
> 2 files changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/include/gpiod.h b/include/gpiod.h
> index 68130ad..074e395 100644
> --- a/include/gpiod.h
> +++ b/include/gpiod.h
> @@ -173,11 +173,9 @@ int gpiod_chip_find_line(struct gpiod_chip *chip, const char *name);
> * @brief Request a set of lines for exclusive usage.
> * @param chip GPIO chip object.
> * @param req_cfg Request config object.
> - * @param line_cfg Line config object. May be NULL.
> + * @param line_cfg Line config object.
> * @return New line request object or NULL if an error occurred. The request
> * must be released by the caller using ::gpiod_line_request_release.
> - * @note If line_cfg is NULL, lines will be requested in input mode with no
> - * additional parameters set.
> */
> struct gpiod_line_request *
> gpiod_chip_request_lines(struct gpiod_chip *chip,
> diff --git a/lib/line-config.c b/lib/line-config.c
> index 2ac9f5f..346d331 100644
> --- a/lib/line-config.c
> +++ b/lib/line-config.c
> @@ -903,11 +903,6 @@ int gpiod_line_config_to_kernel(struct gpiod_line_config *config,
> uint64_t mask, values;
> int ret;
>
> - if (!config) {
> - cfgbuf->flags = GPIO_V2_LINE_FLAG_INPUT;
> - return 0;
> - }
> -
> if (config->too_complex)
> goto err_2big;
>
> --
> 2.30.1
>
next prev parent reply other threads:[~2022-02-17 3:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 14:07 [libgpiod v2][PATCH 0/4] libgpiod v2: rewrite tests for the C library Bartosz Golaszewski
2022-02-10 14:07 ` [libgpiod v2][PATCH 1/4] line-request: don't accept NULL line config Bartosz Golaszewski
2022-02-17 3:02 ` Kent Gibson [this message]
2022-02-10 14:07 ` [libgpiod v2][PATCH 2/4] line-config: expose the override logic to users Bartosz Golaszewski
2022-02-17 4:32 ` Kent Gibson
2022-02-10 14:07 ` [libgpiod v2][PATCH 3/4] build: add a configure option for enabling gcov profiling Bartosz Golaszewski
2022-02-10 14:07 ` [libgpiod v2][PATCH 4/4] tests: rewrite core C tests using libgpiosim Bartosz Golaszewski
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=20220217030243.GA8970@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 \
--cc=viresh.kumar@linaro.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).