From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795910955; b=qDesZMa0EsmzfgbqimaoBQyTI8yFsFmLWZkj4ORtTMuHQY1cLmhh2Kj0/OItmuTKuI+Y 7FNzqykBsmngyBcCknC5L4PiRvnnpXpW3h47KzD6IBNlNtPuxii/ucnCwWtTyERThEOby fUDrqOg8e4OIIhYhm2bC24244VwIhFRjsdxmnWK2QUmk7/n4rudpgDkHSiYVEDgbd2D0Q 1vnKEgBcE/kRRLfFY/YIQB/qx1un/yi3zNKTutqIt1r6lSJD3RcG2aMmDrfq+YcY8bFS4 GSYazm4BiQZpiTkjdFYGHQo0W6iV9eiweKwhoXbds0QZYpQ7GvAZNpLzLBLxn9cYMcg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795910955; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: In-Reply-To:References:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=ZT3uMY3ybM2nH8GgmNz0TIdciY1sPjaO646PD4RGzZk=; b=BzlYVImwgPfXjJ8k16lSodd1F70Ngnjubdo7OaBA4SpJiDLo22X0anKak0iPztXLfFoD SvaQf9Lc/DpGdsZK+pFNq17A5v0ZTA1jEnUHTCr/jQjjmfzIeDPs+8lnnIwJwsfJFjYC0 G331TLyPczUs8lkZz7mPtIw/jRzFxG27O6d9osOqwhqHDGxtYABpTd18hb0HrUV+zHJI8 LFeJjAISjztqmWuD1unvbearq9+qhUDW6BU6ZsJmqVZ4MtPcd2HNfC/AXG5XsauqfA1Pn duyQuHp6YKtRDnI2/z/z2tivdefumYDSsCzXNW/OKe5CLiAelVfYfzPfowQ70KaVToQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Qm2/uGYk"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 531F8606A31C; Sun, 29 Nov 2026 00:09:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Qm2/uGYk Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BB371F000C1; Sun, 29 Nov 2026 00:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795910954; bh=ZT3uMY3ybM2nH8GgmNz0TIdciY1sPjaO646PD4RGzZk=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Qm2/uGYkIGnsIMnPCZgdNoiZzd4+lO2iN63Jrk6ECmqHj70GWrwcbCr9dj1vlSb/a cASrhnOaDOzMxbkyGH5l/ruiLHQuiZQk4Tr/kunxYKsCYndw6v4TK5ovzx6GA6FvlI BA5/6T+W0SUA3C1PEzP33j1X/4pKjQaGFHVE4HxjTJFFVKOn6t+RYBdryHPE38A64g 1X4wsXdiWQ4KiccFL1/SmGXWcyQbBKWo02fLa4zHHNMuurOtvMqSLd2aEy0z+7gygx SZyT8M2cdpiYvPgiSYOXxHs9b95jQKlH/My1iZhIA6CPyxunoCMwry01jFUh+tcWez JxhqJMPqFFOUw== Date: Sun, 29 Nov 2026 00:09:07 +0000 From: Jonathan Cameron To: Miquel Raynal Cc: linux-iio@vger.kernel.org, David Lechner , Nuno =?UTF-8?B?U8Oh?= , Andy Shevchenko , linux-kernel@vger.kernel.org, Jonathan Cameron Subject: Re: [PATCH] iio: adc: max1027: complete the EOC wait when using an external trigger Message-ID: <20261129000907.64a444b8@jic23-hlaptop> In-Reply-To: <87mrr0ue10.fsf@bootlin.com> References: <20261115204551.2783884-1-jic23@kernel.org> <874idfn30h.fsf@bootlin.com> <20261122195249.13ee9686@jic23-hlaptop> <87mrr0ue10.fsf@bootlin.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 23 Nov 2026 09:51:07 +0100 Miquel Raynal wrote: > On 22/11/2026 at 19:52:49 GMT, Jonathan Cameron wrote: >=20 > > On Tue, 17 Nov 2026 11:52:46 +0100 > > Miquel Raynal wrote: > > =20 > >> Hi Jonathan, > >>=20 > >> On 15/11/2026 at 20:45:51 GMT, Jonathan Cameron wro= te: > >> =20 > >> > From: Jonathan Cameron > >> > > >> > When an external trigger is in use, max1027_trigger_handler() starts= the > >> > conversion and then waits in max1027_wait_eoc() for the end of conve= rsion > >> > interrupt to complete(&st->complete). However max1027_handler() only > >> > completes it when the buffer is disabled. With the buffer enabled it > >> > instead polls the current trigger, which is the external trigger > >> > that is still being handled, so the poll does nothing, > >> > the wait times out and every sample fails with -ETIMEDOUT. > >> > > >> > Complete the wait when the buffer is enabled but the device's own > >> > trigger is not in use, as the comment above the check already > >> > describes. > >> > > >> > Fixes: 075d3280b4a1 ("iio: adc: max1027: Allow all kind of triggers = to be used") > >> > Signed-off-by: Jonathan Cameron > >> > > >> > --- > >> > > >> > The comment clearly states that we should just complete for > >> > triggers other than the one provided by this device, but the > >> > code doesn't do this. Ideal would be if someone has the part and > >> > can test this. =20 > >>=20 > >> I no longer have an easy way to run that code, but looking at it 5 yea= rs > >> later, I agree with your description of the problem as well as your > >> solution. > >> =20 > >> > LLM spotted the issue whilst doing some other cleanup and > >> > prepared the patch. > >> > > >> > I think the reason this got past testing was that the code was > >> > fixed to actually return an error on timeout whereas a bug > >> > previously meant it always dropped through and carried on. =20 > >>=20 > >> Ah, right, intersting, I guess you talk about > >> 2021ef060900 ("iio: adc: max1027: fix error code in max1027_wait_eoc()= ") > >> =20 > >> > --- > >> > drivers/iio/adc/max1027.c | 2 +- > >> > 1 file changed, 1 insertion(+), 1 deletion(-) > >> > > >> > diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c > >> > index d475cc91108d..65a0e85faca9 100644 > >> > --- a/drivers/iio/adc/max1027.c > >> > +++ b/drivers/iio/adc/max1027.c > >> > @@ -478,7 +478,7 @@ static irqreturn_t max1027_handler(int irq, void= *private) > >> > * with another device. The core will then call the relevant handl= er to > >> > * perform the data processing step. > >> > */ > >> > - if (!iio_buffer_enabled(indio_dev)) > >> > + if (!iio_buffer_enabled(indio_dev) || !iio_trigger_using_own(indio= _dev)) > >> > complete(&st->complete); > >> > else > >> > iio_trigger_poll(st->trig); =20 > >>=20 > >> In case you want to make it closer to what other drivers do, you may > >> invert the condition to simplify the reading: > >>=20 > >> if (iio_buffer_enabled(indio_dev) && iio_trigger_using_own(indio_dev)) > >> iio_trigger_poll(st->trig); > >> else > >> complete(&st->complete); =20 > > That is indeed more natural so done what you suggest and applied. > > We are fairly late in the cycle so I'm not going to rush this in. > > > > Applied to the testing branch of iio.git, so targeting next merge > > window. =20 >=20 > At -rc4? There is still a month before the merge window, for such a > small change located in a driver, I would not bother delaying it :-) I'm getting a bit more paranoid about this as some push back from Linus on large fix series. + I think this is under the rather large tree I'm working on for some more significant refactors so this is making my own life easier too ;) Jonathan >=20 > Cheers, > Miqu=C3=A8l >=20