From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74F16299AB4 for ; Tue, 3 Feb 2026 10:28:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770114529; cv=none; b=jxu2Ru51cPMMY96RBs07z4Y6l6hlWaLt79ef2z6H7S3t1u+I81MSxuW/PEK2iuk1tCZMy01/HyOtrl6IfQzNnkpAKUfKWywD/H/UM7FNzHibu9i7mNod9+PM+gremaTV3H7PyOkVKgEw5Yk9JMZD8z8bgbSdoCj21WC5RPqLtJ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770114529; c=relaxed/simple; bh=/SUfDw43r3dt6Wpf0yKB09fpD6dxuIv6K0uCA4c4bYk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UyvlFXb9iAzL3ep+uLHPzIoPWUKRIiqCm8/uYQwCUjyoK/1IA8z0/ED22C+zuBEMVeaJbjGK0BPcCTbv7445NfxjvcJGifgXOo4iLofHaP+iNHb5vDF2hzuhHlNHoZSwLEI8Pzd3PT9hyeXcXSrhbdyi4dEfVy7qSMTGvbzg5u4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1vnDeI-0003ge-Dn; Tue, 03 Feb 2026 11:28:46 +0100 Received: from pty.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::c5]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vnDeH-003tCp-3C; Tue, 03 Feb 2026 11:28:45 +0100 Received: from ore by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1vnDeH-00E2NX-0c; Tue, 03 Feb 2026 11:28:45 +0100 Date: Tue, 3 Feb 2026 11:28:45 +0100 From: Oleksij Rempel To: Andy Shevchenko Cc: Andy Shevchenko , Rob Herring , Conor Dooley , devicetree@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Nuno =?utf-8?B?U8Oh?= , kernel@pengutronix.de, David Jander , Krzysztof Kozlowski , David Lechner , Jonathan Cameron Subject: Re: [PATCH v4 01/13] iio: dac: ds4424: reject -128 RAW value Message-ID: References: <20260203093434.2548978-1-o.rempel@pengutronix.de> <20260203093434.2548978-2-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: devicetree@vger.kernel.org On Tue, Feb 03, 2026 at 11:54:35AM +0200, Andy Shevchenko wrote: > On Tue, Feb 03, 2026 at 10:34:21AM +0100, Oleksij Rempel wrote: > > The DS442x DAC uses sign-magnitude encoding, so -128 cannot be represented > > in hardware (7-bit magnitude). > > > > Previously, passing -128 resulted in a truncated value that programmed > > 0mA (magnitude 0) instead of the expected maximum negative current, > > effectively failing silently. > > > > Reject -128 to avoid producing the wrong current. > > ... > > > case IIO_CHAN_INFO_RAW: > > - if (val < S8_MIN || val > S8_MAX) > > + if (val <= S8_MIN || val > S8_MAX) > > return -EINVAL; > > I still consider using -127, 127 is better than type _MIN/_MAX. > This is all due to '='. The use of S8_MIN here is intentional to satisfy the requirement for a minimal stable backport, as requested by Jonathan: https://lore.kernel.org/all/20260201144226.218a43cb@jic23-huawei/ This patch: Strict "Fix only" for stable. Uses minimal logic changes (<= S8_MIN) to avoid introducing new bugs during backporting. N++ patch: Full refactoring. Can we accept this temporary state to facilitate the stable process? -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |