[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZedSJcBGj89-XQWY@smile.fi.intel.com>
Date: Tue, 5 Mar 2024 19:11:01 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: 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>, Arnd Bergmann <arnd@...db.de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH v2 2/3] mei: vsc: Don't use sleeping condition in
 wait_event_timeout()
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).
>  	if (!ret)
>  		return -ETIMEDOUT;
..
> +	return read_poll_timeout(gpiod_get_value_cansleep, ret, ret,
> +				 VSC_TP_WAIT_FW_POLL_DELAY_US,
> +				 VSC_TP_WAIT_FW_POLL_TIMEOUT, false,
Second, this is a bug as you are using jiffies as microseconds. How had it been tested?
> +				 tp->wakeuphost);
-- 
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists
 
