Files
android_kernel_fxtec_sm6115/include/linux
Denis OSTERLAND-HEIM ab82c3d982 pps: fix poll support
[ Upstream commit 12c409aa1ec2592280a2ddcc66ff8f3c7f7bb171 ]

Because pps_cdev_poll() returns unconditionally EPOLLIN,
a user space program that calls select/poll get always an immediate data
ready-to-read response. As a result the intended use to wait until next
data becomes ready does not work.

User space snippet:

    struct pollfd pollfd = {
      .fd = open("/dev/pps0", O_RDONLY),
      .events = POLLIN|POLLERR,
      .revents = 0 };
    while(1) {
      poll(&pollfd, 1, 2000/*ms*/); // returns immediate, but should wait
      if(revents & EPOLLIN) { // always true
        struct pps_fdata fdata;
        memset(&fdata, 0, sizeof(memdata));
        ioctl(PPS_FETCH, &fdata); // currently fetches data at max speed
      }
    }

Lets remember the last fetch event counter and compare this value
in pps_cdev_poll() with most recent event counter
and return 0 if they are equal.

Signed-off-by: Denis OSTERLAND-HEIM <denis.osterland@diehl.com>
Co-developed-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Rodolfo Giometti <giometti@enneenne.com>
Fixes: eae9d2ba0c ("LinuxPPS: core support")
Link: https://lore.kernel.org/all/f6bed779-6d59-4f0f-8a59-b6312bd83b4e@enneenne.com/
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Link: https://lore.kernel.org/r/c3c50ad1eb19ef553eca8a57c17f4c006413ab70.camel@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Ulrich Hecht <uli@kernel.org>
2025-09-16 13:55:10 +02:00
..
2024-02-23 08:12:39 +01:00
2022-10-26 13:19:32 +02:00
2023-08-08 19:49:17 +02:00
2023-12-20 15:38:01 +01:00
2021-12-08 08:50:13 +01:00
2024-04-13 12:50:14 +02:00
2021-01-30 13:32:12 +01:00
2021-05-22 10:59:50 +02:00
2022-10-26 13:19:35 +02:00
2021-03-04 09:39:44 +01:00
2022-08-25 11:15:23 +02:00
2021-02-07 14:48:38 +01:00
2023-09-23 10:47:59 +02:00
2021-06-30 08:48:18 -04:00
2025-04-04 11:11:26 +02:00
2023-06-21 15:39:57 +02:00
2023-02-22 12:47:17 +01:00
2025-09-16 13:55:10 +02:00
2023-11-28 16:46:33 +00:00
2023-10-25 11:16:20 +02:00
2023-10-25 11:16:20 +02:00
2021-12-14 10:18:04 +01:00
2024-07-05 09:00:35 +02:00
2024-02-23 08:12:39 +01:00
2021-12-14 10:18:06 +01:00