From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E261C43334 for ; Sat, 11 Jun 2022 17:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Vj5JCMdWKlIwfIvQNVnI8TJ9TYUqKSYuFr/SFZ05uLo=; b=NP6eO8EtE2zVch wnldUemnfB/IRmrqH5PNECudm5Vr75+dRwjHyccw3hfnwtTIjL/ANrMSt+fr2yNBr0p5stUVC1x6k umwH2VmC90jOLkUyEiIOwQDwMlayIv1+9nuNew1shrWEkV4xZWN4WHEtgdtDC4KuoQz5DETBad4Oc OoPrJCdCv51v4tKNa8P5T7NdSEIN3omIZFSV9ciSoSVTL3TFpX+4xtSv/kY/tnWmVXwna8OiInrX9 AKegqB4aMzVteQWkMMfcrHMhnwKj3qR7aKpxn/KBrmL3oocnTerRTFOQ940Ugas9XTE3oUGjoUT7h z/mggNGMaEsG6JCrMLLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o04qy-00DxPD-8H; Sat, 11 Jun 2022 17:24:52 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o04qu-00DxOK-Vp for linux-arm-kernel@lists.infradead.org; Sat, 11 Jun 2022 17:24:50 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 93351B80AE4; Sat, 11 Jun 2022 17:24:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEFB1C34116; Sat, 11 Jun 2022 17:24:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654968286; bh=SDCYDjY3WJbmTI27Ho0/7Zfqxt3PHJ7jDyD8765WJCE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ZtYi3BQBV3GRP8nI3TqjRnZmjlpZ2AtIMxOG/5riaE5t2Z5IZJYIBH/LwlaWYB+Bt 5EvFEBD2GUAMSS1++XM61sP0qhnz+573f3ECcuFOhiwikH5eiIkssBaiN7c8MACpqX R4eRaJa/uwn9IBSOo+DbgTZ/i0ZcUYZ+cUwNib56pzWe+BDc7kVpscCyMzbsy3FrTu /K1ehnbwBPstJ3fnwzUl3tHm8hQuxQyMdKIYTM8qcw3y49WBQ/L69UpIdfHcae31NN 29R1K/GuotB3t5WIWhf3KVC3pTXB7DyYjKpXL/g5ErM8avsTGEURUjO4Z4FBrpFzPq WHv8kycFjH4HQ== Date: Sat, 11 Jun 2022 18:33:54 +0100 From: Jonathan Cameron To: Claudiu Beznea Subject: Re: [PATCH 03/16] iio: adc: at91-sama5d2_adc: exit from write_raw() when buffers are enabled Message-ID: <20220611183354.08788921@jic23-huawei> In-Reply-To: <20220609083213.1795019-4-claudiu.beznea@microchip.com> References: <20220609083213.1795019-1-claudiu.beznea@microchip.com> <20220609083213.1795019-4-claudiu.beznea@microchip.com> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220611_102449_222156_02F40D04 X-CRM114-Status: GOOD ( 20.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alexandre.belloni@bootlin.com, lars@metafoo.de, ludovic.desroches@atmel.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, eugen.hristev@microchip.com, krzk+dt@kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, 9 Jun 2022 11:32:00 +0300 Claudiu Beznea wrote: > When buffers are enabled conversion may start asynchronously thus > allowing changes on actual hardware could lead to bad behavior. Thus > do not allow changing oversampling ratio and sample frequency when > buffers are enabled. Less than desirable behavior perhaps, but broken? I don't see this as a fix from what you have mentioned - though I'm not against it. (just drop the fixes tag) It is an ABI change, but unlikely to be one any sane code hits. > > Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support") > Signed-off-by: Claudiu Beznea > --- > drivers/iio/adc/at91-sama5d2_adc.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c > index a672a520cdc0..b76328da0cb2 100644 > --- a/drivers/iio/adc/at91-sama5d2_adc.c > +++ b/drivers/iio/adc/at91-sama5d2_adc.c > @@ -1644,6 +1644,9 @@ static int at91_adc_write_raw(struct iio_dev *indio_dev, > { > struct at91_adc_state *st = iio_priv(indio_dev); > > + if (iio_buffer_enabled(indio_dev)) > + return -EBUSY; This is racy as nothing stops buffers being enabled after this point. Use the iio_device_claim_direct_mode() and release for this as they protect against the race. > + > switch (mask) { > case IIO_CHAN_INFO_OVERSAMPLING_RATIO: > if ((val != AT91_OSR_1SAMPLES) && (val != AT91_OSR_4SAMPLES) && _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel