[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <4de9e676-74e7-4bd0-b821-4e3270487dbb@app.fastmail.com>
Date: Tue, 05 Mar 2024 18:17:46 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Andy Shevchenko" <andriy.shevchenko@...el.com>,
"Sakari Ailus" <sakari.ailus@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org, "Hans de Goede" <hdegoede@...hat.com>,
"Tomas Winkler" <tomas.winkler@...el.com>,
"Wentong Wu" <wentong.wu@...el.com>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v2 2/3] mei: vsc: Don't use sleeping condition in
wait_event_timeout()
On Tue, Mar 5, 2024, at 18:11, Andy Shevchenko wrote:
> On Mon, Feb 19, 2024 at 09:58:06PM +0200, Sakari Ailus wrote:
>> vsc_tp_wakeup_request() called wait_event_timeout() with
>> gpiod_get_value_cansleep() which may sleep, and does so as the
>> implementation is that of gpio-ljca.
>>
>> Move the GPIO state check outside the call.
>
> ...
>
>> +#define VSC_TP_WAIT_FW_POLL_TIMEOUT (2 * HZ)
>> +#define VSC_TP_WAIT_FW_POLL_DELAY_US (20 * USEC_PER_MSEC)
>
> ...
>
>> ret = wait_event_timeout(tp->xfer_wait,
>> - atomic_read(&tp->assert_cnt) &&
>> - gpiod_get_value_cansleep(tp->wakeuphost),
>> - VSC_TP_WAIT_FW_ASSERTED_TIMEOUT);
>> + atomic_read(&tp->assert_cnt),
>> + VSC_TP_WAIT_FW_POLL_TIMEOUT);
>
> First of all, there is an API for such cases (wait_woken_up() IIRC).
I think wait_for_completion_timeout() would be the obvious
replacement if the wait_event is no longer waiting for the
gpio but only for the irq handler to complete.
Arnd
Powered by blists - more mailing lists