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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93A53C433EF for ; Sat, 4 Jun 2022 22:43:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242293AbiFDWlb (ORCPT ); Sat, 4 Jun 2022 18:41:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241336AbiFDWlZ (ORCPT ); Sat, 4 Jun 2022 18:41:25 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53744CE2E; Sat, 4 Jun 2022 15:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1654382472; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rptKCpjnSy70Y/kdV9v2auApDVZ4hLbfEas6KBoTjv8=; b=tL6I2zgJ5kdKetzLRAr2ijBcONtbibTSBYCswQWHEq7GECf1cAJoVl6FnE5giKxsrs31A7 /RQZma+2fZ+iT3rRdWvHnBIhpQQx93i8Kko9FWuxyCW50YU9DcAFeF2k3O2uRkHBQTbf3q SXKq+fDEPI+FhTpGTB58CXDod4yvFTk= Date: Sat, 04 Jun 2022 23:41:02 +0100 From: Paul Cercueil Subject: Re: [PATCH 2/2] iio: at91-sama5d2: Limit requested watermark value to hwfifo size To: Jonathan Cameron Cc: Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Eugen Hristev , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches Message-Id: In-Reply-To: <20220604160557.1e82077e@jic23-huawei> References: <20220117102512.31725-1-paul@crapouillou.net> <20220117102512.31725-2-paul@crapouillou.net> <20220122170447.68f35cfa@jic23-huawei> <20220604160557.1e82077e@jic23-huawei> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jonathan, Le sam., juin 4 2022 at 16:05:57 +0100, Jonathan Cameron=20 a =E9crit : > On Sat, 22 Jan 2022 17:04:47 +0000 > Jonathan Cameron wrote: >=20 >> On Mon, 17 Jan 2022 10:25:12 +0000 >> Paul Cercueil wrote: >>=20 >> > Instead of returning an error if the watermark value is too high,=20 >> which >> > the core will silently ignore anyway, limit the value to the=20 >> hardware >> > FIFO size; a lower-than-requested value is still better than=20 >> using the >> > default, which is usually 1. >>=20 >> There is another potential error condition in this function which=20 >> will >> also be ignored by the core. >>=20 >> As such whilst I agree this is a sensible thing to do in this >> particular case I think we should also be handling the error in the=20 >> core. >>=20 >> I think it would be better to clean that up at the same time >> as these improvements - particularly as I'd guess you have a=20 >> convenient >> test setup to check the error unwind is correct? >=20 > Hi Paul, >=20 > I was trawling through patchwork and realised this one is stalled. >=20 > Thoughts on the above? Totally forgot about this patch. Aren't you afraid that if we start handling these errors in the core,=20 we'll somehow break the ABI? -Paul > Thanks, >=20 > Jonathan >=20 >>=20 >> Thanks, >>=20 >> Jonathan >>=20 >> > >> > Cc: Eugen Hristev >> > Cc: Nicolas Ferre >> > Cc: Alexandre Belloni >> > Cc: Ludovic Desroches >> > Signed-off-by: Paul Cercueil >> > --- >> > drivers/iio/adc/at91-sama5d2_adc.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/drivers/iio/adc/at91-sama5d2_adc.c=20 >> b/drivers/iio/adc/at91-sama5d2_adc.c >> > index 854b1f81d807..5cc84f4a17bb 100644 >> > --- a/drivers/iio/adc/at91-sama5d2_adc.c >> > +++ b/drivers/iio/adc/at91-sama5d2_adc.c >> > @@ -1752,7 +1752,7 @@ static int at91_adc_set_watermark(struct=20 >> iio_dev *indio_dev, unsigned int val) >> > int ret; >> > >> > if (val > AT91_HWFIFO_MAX_SIZE) >> > - return -EINVAL; >> > + val =3D AT91_HWFIFO_MAX_SIZE; >> > >> > if (!st->selected_trig->hw_trig) { >> > dev_dbg(&indio_dev->dev, "we need hw trigger for DMA\n"); >>=20 >=20 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 BCBBBC43334 for ; Sat, 4 Jun 2022 22:43:05 +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-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:To: Subject:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eAdwksQq6LfJgk+/tCB+CmzmNK58Bxsr1TTN/hJqGek=; b=Hhi7Ov8+qtuGYfWQgl8l8cKXNB qVOdpu31h65s0uLT7h8Vhi9BucU46HkloVreIfKUNRduC+aOp42MklcIiYsoNMRY937j4zfNRT3Lj EEtVSAoCfWbCmfFHRxhAAcG4378XpGcws5xXiM9QKVilpbaeldfTmA8pBV+2yFWqSplSOjYiB1DW7 9CQMcBTTVg6NJ+t2CgCNxz3wIYg2ewyb0blMH54fYFOdwDFIOJgBF0BisG08IsCmqsYBUcJ27TyPB ylbI0Iz05vF1qgrWGJd7iEdVBEzX9UF3PO0KgVnHQ2KkFTFURkAhZ/RMdCSHsr+w4dc1YOAEbiCg4 Xg3RvCTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxcSd-00Can8-3U; Sat, 04 Jun 2022 22:41:35 +0000 Received: from aposti.net ([89.234.176.197]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nxcSZ-00Camd-9R for linux-arm-kernel@lists.infradead.org; Sat, 04 Jun 2022 22:41:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1654382472; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rptKCpjnSy70Y/kdV9v2auApDVZ4hLbfEas6KBoTjv8=; b=tL6I2zgJ5kdKetzLRAr2ijBcONtbibTSBYCswQWHEq7GECf1cAJoVl6FnE5giKxsrs31A7 /RQZma+2fZ+iT3rRdWvHnBIhpQQx93i8Kko9FWuxyCW50YU9DcAFeF2k3O2uRkHBQTbf3q SXKq+fDEPI+FhTpGTB58CXDod4yvFTk= Date: Sat, 04 Jun 2022 23:41:02 +0100 From: Paul Cercueil Subject: Re: [PATCH 2/2] iio: at91-sama5d2: Limit requested watermark value to hwfifo size To: Jonathan Cameron Message-Id: In-Reply-To: <20220604160557.1e82077e@jic23-huawei> References: <20220117102512.31725-1-paul@crapouillou.net> <20220117102512.31725-2-paul@crapouillou.net> <20220122170447.68f35cfa@jic23-huawei> <20220604160557.1e82077e@jic23-huawei> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220604_154131_575120_65476A5E X-CRM114-Status: GOOD ( 22.27 ) 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: Alexandre Belloni , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Ludovic Desroches , Eugen Hristev , linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Jonathan, Le sam., juin 4 2022 at 16:05:57 +0100, Jonathan Cameron = a =E9crit : > On Sat, 22 Jan 2022 17:04:47 +0000 > Jonathan Cameron wrote: > = >> On Mon, 17 Jan 2022 10:25:12 +0000 >> Paul Cercueil wrote: >> = >> > Instead of returning an error if the watermark value is too high, = >> which >> > the core will silently ignore anyway, limit the value to the = >> hardware >> > FIFO size; a lower-than-requested value is still better than = >> using the >> > default, which is usually 1. >> = >> There is another potential error condition in this function which = >> will >> also be ignored by the core. >> = >> As such whilst I agree this is a sensible thing to do in this >> particular case I think we should also be handling the error in the = >> core. >> = >> I think it would be better to clean that up at the same time >> as these improvements - particularly as I'd guess you have a = >> convenient >> test setup to check the error unwind is correct? > = > Hi Paul, > = > I was trawling through patchwork and realised this one is stalled. > = > Thoughts on the above? Totally forgot about this patch. Aren't you afraid that if we start handling these errors in the core, = we'll somehow break the ABI? -Paul > Thanks, > = > Jonathan > = >> = >> Thanks, >> = >> Jonathan >> = >> > >> > Cc: Eugen Hristev >> > Cc: Nicolas Ferre >> > Cc: Alexandre Belloni >> > Cc: Ludovic Desroches >> > Signed-off-by: Paul Cercueil >> > --- >> > drivers/iio/adc/at91-sama5d2_adc.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/drivers/iio/adc/at91-sama5d2_adc.c = >> b/drivers/iio/adc/at91-sama5d2_adc.c >> > index 854b1f81d807..5cc84f4a17bb 100644 >> > --- a/drivers/iio/adc/at91-sama5d2_adc.c >> > +++ b/drivers/iio/adc/at91-sama5d2_adc.c >> > @@ -1752,7 +1752,7 @@ static int at91_adc_set_watermark(struct = >> iio_dev *indio_dev, unsigned int val) >> > int ret; >> > >> > if (val > AT91_HWFIFO_MAX_SIZE) >> > - return -EINVAL; >> > + val =3D AT91_HWFIFO_MAX_SIZE; >> > >> > if (!st->selected_trig->hw_trig) { >> > dev_dbg(&indio_dev->dev, "we need hw trigger for DMA\n"); >> = > = _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel