From: Kent Gibson <warthog618@gmail.com>
To: linux-gpio@vger.kernel.org, brgl@bgdev.pl
Cc: Kent Gibson <warthog618@gmail.com>
Subject: [libgpiod v2][PATCH 3/3] line-info: rename infobuf to uinfo
Date: Tue, 15 Mar 2022 13:32:20 +0800 [thread overview]
Message-ID: <20220315053220.102934-4-warthog618@gmail.com> (raw)
In-Reply-To: <20220315053220.102934-1-warthog618@gmail.com>
The infobuf variable in gpiod_line_info_from_kernel() refers to the
uAPI version of the info, and the "buf" suffix doesn't really
emphasise that, so rename it to uinfo.
Signed-off-by: Kent Gibson <warthog618@gmail.com>
---
lib/line-info.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/lib/line-info.c b/lib/line-info.c
index fc656f9..168fc86 100644
--- a/lib/line-info.c
+++ b/lib/line-info.c
@@ -106,7 +106,7 @@ gpiod_line_info_get_debounce_period_us(struct gpiod_line_info *info)
}
struct gpiod_line_info *
-gpiod_line_info_from_kernel(struct gpio_v2_line_info *infobuf)
+gpiod_line_info_from_kernel(struct gpio_v2_line_info *uinfo)
{
struct gpio_v2_line_attribute *attr;
struct gpiod_line_info *info;
@@ -118,47 +118,47 @@ gpiod_line_info_from_kernel(struct gpio_v2_line_info *infobuf)
memset(info, 0, sizeof(*info));
- info->offset = infobuf->offset;
- strncpy(info->name, infobuf->name, GPIO_MAX_NAME_SIZE);
+ info->offset = uinfo->offset;
+ strncpy(info->name, uinfo->name, GPIO_MAX_NAME_SIZE);
- info->used = !!(infobuf->flags & GPIO_V2_LINE_FLAG_USED);
- strncpy(info->consumer, infobuf->consumer, GPIO_MAX_NAME_SIZE);
+ info->used = !!(uinfo->flags & GPIO_V2_LINE_FLAG_USED);
+ strncpy(info->consumer, uinfo->consumer, GPIO_MAX_NAME_SIZE);
- if (infobuf->flags & GPIO_V2_LINE_FLAG_OUTPUT)
+ if (uinfo->flags & GPIO_V2_LINE_FLAG_OUTPUT)
info->direction = GPIOD_LINE_DIRECTION_OUTPUT;
else
info->direction = GPIOD_LINE_DIRECTION_INPUT;
- if (infobuf->flags & GPIO_V2_LINE_FLAG_ACTIVE_LOW)
+ if (uinfo->flags & GPIO_V2_LINE_FLAG_ACTIVE_LOW)
info->active_low = true;
- if (infobuf->flags & GPIO_V2_LINE_FLAG_BIAS_PULL_UP)
+ if (uinfo->flags & GPIO_V2_LINE_FLAG_BIAS_PULL_UP)
info->bias = GPIOD_LINE_BIAS_PULL_UP;
- else if (infobuf->flags & GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN)
+ else if (uinfo->flags & GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN)
info->bias = GPIOD_LINE_BIAS_PULL_DOWN;
- else if (infobuf->flags & GPIO_V2_LINE_FLAG_BIAS_DISABLED)
+ else if (uinfo->flags & GPIO_V2_LINE_FLAG_BIAS_DISABLED)
info->bias = GPIOD_LINE_BIAS_DISABLED;
else
info->bias = GPIOD_LINE_BIAS_UNKNOWN;
- if (infobuf->flags & GPIO_V2_LINE_FLAG_OPEN_DRAIN)
+ if (uinfo->flags & GPIO_V2_LINE_FLAG_OPEN_DRAIN)
info->drive = GPIOD_LINE_DRIVE_OPEN_DRAIN;
- else if (infobuf->flags & GPIO_V2_LINE_FLAG_OPEN_SOURCE)
+ else if (uinfo->flags & GPIO_V2_LINE_FLAG_OPEN_SOURCE)
info->drive = GPIOD_LINE_DRIVE_OPEN_SOURCE;
else
info->drive = GPIOD_LINE_DRIVE_PUSH_PULL;
- if ((infobuf->flags & GPIO_V2_LINE_FLAG_EDGE_RISING) &&
- (infobuf->flags & GPIO_V2_LINE_FLAG_EDGE_FALLING))
+ if ((uinfo->flags & GPIO_V2_LINE_FLAG_EDGE_RISING) &&
+ (uinfo->flags & GPIO_V2_LINE_FLAG_EDGE_FALLING))
info->edge = GPIOD_LINE_EDGE_BOTH;
- else if (infobuf->flags & GPIO_V2_LINE_FLAG_EDGE_RISING)
+ else if (uinfo->flags & GPIO_V2_LINE_FLAG_EDGE_RISING)
info->edge = GPIOD_LINE_EDGE_RISING;
- else if (infobuf->flags & GPIO_V2_LINE_FLAG_EDGE_FALLING)
+ else if (uinfo->flags & GPIO_V2_LINE_FLAG_EDGE_FALLING)
info->edge = GPIOD_LINE_EDGE_FALLING;
else
info->edge = GPIOD_LINE_EDGE_NONE;
- if (infobuf->flags & GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME)
+ if (uinfo->flags & GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME)
info->event_clock = GPIOD_LINE_EVENT_CLOCK_REALTIME;
else
info->event_clock = GPIOD_LINE_EVENT_CLOCK_MONOTONIC;
@@ -167,8 +167,8 @@ gpiod_line_info_from_kernel(struct gpio_v2_line_info *infobuf)
* We assume that the kernel returns correct configuration and that no
* attributes repeat.
*/
- for (i = 0; i < infobuf->num_attrs; i++) {
- attr = &infobuf->attrs[i];
+ for (i = 0; i < uinfo->num_attrs; i++) {
+ attr = &uinfo->attrs[i];
if (attr->id == GPIO_V2_LINE_ATTR_ID_DEBOUNCE) {
info->debounced = true;
--
2.35.1
next prev parent reply other threads:[~2022-03-15 5:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 5:32 [libgpiod v2][PATCH 0/3] api tweaks Kent Gibson
2022-03-15 5:32 ` [libgpiod v2][PATCH 1/3] core: rename gpiod_chip_info_event_wait and gpiod_chip_info_event_read Kent Gibson
2022-03-15 11:58 ` Bartosz Golaszewski
2022-03-15 5:32 ` [libgpiod v2][PATCH 2/3] core: split chip_info out of chip Kent Gibson
2022-03-15 11:59 ` Bartosz Golaszewski
2022-03-15 12:12 ` Kent Gibson
2022-03-15 12:15 ` Bartosz Golaszewski
2022-03-15 5:32 ` Kent Gibson [this message]
2022-03-15 12:14 ` [libgpiod v2][PATCH 3/3] line-info: rename infobuf to uinfo Bartosz Golaszewski
2022-03-15 12:24 ` 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=20220315053220.102934-4-warthog618@gmail.com \
--to=warthog618@gmail.com \
--cc=brgl@bgdev.pl \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.