[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <80ed9b12-ba0a-4d1a-bd54-122218edc8a1@linux.dev>
Date: Tue, 15 Jul 2025 11:47:07 -0400
From: Sean Anderson <sean.anderson@...ux.dev>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Jonathan Cameron <jic23@...nel.org>, Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>, linux-iio@...r.kernel.org,
linux-hwmon@...r.kernel.org, Andy Shevchenko <andy@...nel.org>,
Nuno Sá <nuno.sa@...log.com>, linux-kernel@...r.kernel.org,
David Lechner <dlechner@...libre.com>
Subject: Re: [PATCH 3/7] iio: Add in-kernel API for events
On 7/15/25 04:20, Andy Shevchenko wrote:
> On Mon, Jul 14, 2025 at 09:20:19PM -0400, Sean Anderson wrote:
>> Add an API to notify consumers about events. Events still need to be
>> enabled using the iio_read_event/iio_write_event functions. Of course,
>> userspace can also manipulate the enabled events. I don't think this is
>> too much of an issue, since userspace can also manipulate the event
>> thresholds. But enabling events may cause existing programs to be
>> surprised when they get something unexpected. Maybe we should set the
>> interface as busy when there are any in-kernel listeners?
>
> ...
>
>> #include <linux/wait.h>
>
> While at it...
>
> + blank line here...
>
>> +#include <linux/iio/consumer.h>
>> #include <linux/iio/iio.h>
>> #include <linux/iio/iio-opaque.h>
>
> ...and here?
>
>> #include "iio_core.h"
>
> ...
>
>> + struct iio_event_data ev = {
>> + .id = ev_code,
>> + .timestamp = timestamp,
>> + };
>
> ...
>
>> /* Does anyone care? */
>> if (iio_event_enabled(ev_int)) {
>> -
>> - ev.id = ev_code;
>> - ev.timestamp = timestamp;
>> -
>> copied = kfifo_put(&ev_int->det_events, ev);
>> if (copied != 0)
>> wake_up_poll(&ev_int->wait, EPOLLIN);
>
> Looks like this refactoring can be done before main change.
I think it is clearer to keep this in the same patch as the
functionality that uses it.
> ...
>
>> + WARN_ON(atomic_notifier_chain_unregister(&ev_int->notifier, block));
>
> Is bug.h already included?
I assume so. No build errors.
--Sean
Powered by blists - more mailing lists