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 AB214C433F5 for ; Mon, 17 Jan 2022 10:57:23 +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: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=12HexglmBuUXrY9owDwlw54GdA/rwt1ZNZN9VndXU0U=; b=oW5/ldfNXO8E3E1jklkK+NZyij LxrWwPk+/yEYWGkcfAyNffpTbXgCDipg240GzT8odUYN426Xo9zpP+P2u75rI0AXb+WDoBfGvf90k nrFwiVX7jc8fIqgDbDUnuIR7jgLrpXs8NJoM0rQZaKxsDweD9LTyvyttOR9fc4VZ5kxXtmwfEUCz6 9DnnYLjOS1oKs6Au0ecX6Q7OccO1E8QHqlRWL/rI9SjkFhgKK7x6HDEAQMGFdT/F+Ijac526R1hmI +NU9g9Klapcu7w5ENgAZLHMdsQUf0FAdllfoVqzya8FUxE0vZhLvJirpFd2fP9CC91d2Xhqezn/8a 9l2dr7sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9PgN-00EZh6-TC; Mon, 17 Jan 2022 10:56:16 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n9PgL-00EZgf-5i for linux-arm-kernel@lists.infradead.org; Mon, 17 Jan 2022 10:56:14 +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 dfw.source.kernel.org (Postfix) with ESMTPS id F34BE60FA5; Mon, 17 Jan 2022 10:56:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C0F6C36AE7; Mon, 17 Jan 2022 10:56:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642416971; bh=WyPJvdRmUEPwRoLB14a6aObUcdcSgZBUxYOv6PmK66E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WOJ7Mq1g21hn5lAnuRXnhsSIsJe7Q5UD3AEdAhkk6F0ZFFampyGRfr0J6nI0YITWS TyTRUN59zdVVukOzE2m1aOnE5Yt36n27x3of1zmX1PBxiAcItWc0EZXuwBcAbY6ErW h5HKkIp4EuBiyokFdArbhOt0JZUiKy5XfInxgAOhAHjvtMX94anV8P99Xr+rQ5BZlz ZNdw9+ZF07ybL9svsVxBICN7pLrgz4ilGetxGvwVMEkF0ZbxYY8Ry4/uQXxXshpZwz osrsjQViITL7XNUg+QyMXorCJtUyPqRd2LjkCyoHKrC71MOrBnc0ig/2CXyS7W0+z1 AsGYw3vFwHQ1g== Date: Mon, 17 Jan 2022 11:56:07 +0100 From: Lorenzo Bianconi To: Paul Cercueil Cc: Jonathan Cameron , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Lorenzo Bianconi Subject: Re: [PATCH 1/2] iio: imu: st_lsm6dsx: Limit requested watermark value to hwfifo size Message-ID: References: <20220117102512.31725-1-paul@crapouillou.net> MIME-Version: 1.0 In-Reply-To: <20220117102512.31725-1-paul@crapouillou.net> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220117_025613_297940_FFE3F869 X-CRM114-Status: GOOD ( 19.35 ) 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: , Content-Type: multipart/mixed; boundary="===============5750225275554117918==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============5750225275554117918== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="bP2/75p4uu4UIPkj" Content-Disposition: inline --bP2/75p4uu4UIPkj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > 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. >=20 Acked-by: Lorenzo Bianconi > Cc: Lorenzo Bianconi > Signed-off-by: Paul Cercueil > --- > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/i= mu/st_lsm6dsx/st_lsm6dsx_core.c > index 727b4b6ac696..5fd46bf1a11b 100644 > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > @@ -54,6 +54,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1607,8 +1608,7 @@ int st_lsm6dsx_set_watermark(struct iio_dev *iio_de= v, unsigned int val) > struct st_lsm6dsx_hw *hw =3D sensor->hw; > int err; > =20 > - if (val < 1 || val > hw->settings->fifo_ops.max_size) > - return -EINVAL; > + val =3D clamp_val(val, 1, hw->settings->fifo_ops.max_size); > =20 > mutex_lock(&hw->conf_lock); > =20 > --=20 > 2.34.1 >=20 --bP2/75p4uu4UIPkj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCYeVLRgAKCRA6cBh0uS2t rM07AP4nFkyIdNtLaE6ZhYiaSwvF1FlkQJNl3Hsa7eTwNQwWSwD/e6jifcjD2e53 sQcPYAXSVQEW/aPuHbAoY8i8f/GO8Q4= =Gqbr -----END PGP SIGNATURE----- --bP2/75p4uu4UIPkj-- --===============5750225275554117918== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============5750225275554117918==--