Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH 2/2] core: Removing unnecessary check for monitoring multiple lines.
@ 2020-02-08 10:01 Daniel Mor
  2020-02-09 11:27 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Mor @ 2020-02-08 10:01 UTC (permalink / raw)
  To: linux-gpio; +Cc: Daniel Mor

In case when needed to monitor multiple line`s on different chip`s
function gpiod_line_event_wait_bulk() blocking it, by checking if
the line`s in a bulk from same chip.
In current state the API forsing the user to wait for notification on multiple threads.

Signed-off-by: Daniel Mor <dmlinuxnewbie@gmail.com>
---
 lib/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/core.c b/lib/core.c
index ed63012..2a46074 100644
--- a/lib/core.c
+++ b/lib/core.c
@@ -977,7 +977,7 @@ int gpiod_line_event_wait_bulk(struct gpiod_line_bulk *bulk,
 	struct gpiod_line *line;
 	int rv;
 
-	if (!line_bulk_same_chip(bulk) || !line_bulk_all_requested(bulk))
+	if (!line_bulk_all_requested(bulk))
 		return -1;
 
 	memset(fds, 0, sizeof(fds));
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] core: Removing unnecessary check for monitoring multiple lines.
  2020-02-08 10:01 [PATCH 2/2] core: Removing unnecessary check for monitoring multiple lines Daniel Mor
@ 2020-02-09 11:27 ` Bartosz Golaszewski
  0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2020-02-09 11:27 UTC (permalink / raw)
  To: Daniel Mor; +Cc: open list:GPIO SUBSYSTEM

sob., 8 lut 2020 o 11:01 Daniel Mor <dmlinuxnewbie@gmail.com> napisał(a):
>
> In case when needed to monitor multiple line`s on different chip`s
> function gpiod_line_event_wait_bulk() blocking it, by checking if
> the line`s in a bulk from same chip.
> In current state the API forsing the user to wait for notification on multiple threads.
>
> Signed-off-by: Daniel Mor <dmlinuxnewbie@gmail.com>
> ---
>  lib/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/core.c b/lib/core.c
> index ed63012..2a46074 100644
> --- a/lib/core.c
> +++ b/lib/core.c
> @@ -977,7 +977,7 @@ int gpiod_line_event_wait_bulk(struct gpiod_line_bulk *bulk,
>         struct gpiod_line *line;
>         int rv;
>
> -       if (!line_bulk_same_chip(bulk) || !line_bulk_all_requested(bulk))
> +       if (!line_bulk_all_requested(bulk))
>                 return -1;
>
>         memset(fds, 0, sizeof(fds));
> --
> 2.17.1
>

The subject tag suggests there's another patch in this series but I
never got anything and don't see anything on patchwork. For the
future: please also add [libgpiod] tag before [PATCH] to make it
easier to spot user-space patches on the list.

I specifically made this function only accept lines from a single chip
- this is the same for all gpiod_line_bulk operations. To do otherwise
would lead to redundant code as you would have to retrieve the chip
reference from the line every time there's a new event and compare it
to something to know which one this is. If you need to modify lines
from several chips - please just retrieve the associated file
descriptor and use poll() or select() and then you can easily map
descriptor numbers to specific lines.

Bartosz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-09 11:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-08 10:01 [PATCH 2/2] core: Removing unnecessary check for monitoring multiple lines Daniel Mor
2020-02-09 11:27 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox