From nobody Wed Apr 15 16:24:27 2026 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B8053890E4 for ; Wed, 4 Mar 2026 08:06:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772611604; cv=none; b=E3MWn7cEVcl9+szAlAV80NuxDw72ClcGW0vOnj8Gt8+wLIT7TGm7XxKjoGveD2Fd7ZhCOoSBLV6TOjqtiiVqPvOTmMcao8Ep6AfuWxkqN0XZZd5vFE7PP6QFrkWzXxdujFIIWs1DcHBLxA+YtfXaxZ5Qb5nfx0xU8lAY0HVxxcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772611604; c=relaxed/simple; bh=nbcIj9p/rJtGfpI+6gAVQl8LH4vGeVEesGIMEW3TiWI=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VtSdZEJzjF0HEXtHuFLBbJ8M1gtVSI6AV7t9NdZET7syEWxFpoy9MXX+3Fval3tpHV3UYua+2OM7u6xI7i79n787ignVHbsGtNYtYUS6KjCX4Xvr1cYCNetFi1fBsY7cfIapiDPw6/HXm/0n007ccddhNQkIq0aqdMFLwz4OBW0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=HYNso38T; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="HYNso38T" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4837584120eso47823255e9.1 for ; Wed, 04 Mar 2026 00:06:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1772611602; x=1773216402; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=hWAQuloq0on7zfLhaTWn8GaYtLAbCLs7s2S7wp1warE=; b=HYNso38TFXZ1EvN6FfE8ObP8MFoVUNiykDKBIMfHfsVe813Cl0XQSWivuoylPfqCWG AvyC6D2EV9Wmw20KuoqlGMIvScHMnN7gUqMXTvxrNAUx+m7lMgBFHrBl1FVqbPBHCFz3 4dWd3P5S2uTalnG5OL2Zbglc26IcAiP8hZ/XMnHiqqLZlwf8cwUJLnmnj71exlFjAemN YNURHSln4BxLR2rBJuLehXOsHto3POf0pyqcHxPWwf53AzFl8UmokbYMoFdu2TRFkhbB haEGUOu88zQujfTYiWdJY3ulhDu9fCyILwhwq2YTCm8dah7Gxc9WFagS0P4/LPIsaQS6 m0zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772611602; x=1773216402; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=hWAQuloq0on7zfLhaTWn8GaYtLAbCLs7s2S7wp1warE=; b=em8NSLlSnw/RfDyKwLr0ERy/Gc8JdaXxVHBMzNd01R3gLC24ShrmVMr1tIqe1jaZg1 fbza5GnAf48VZE7CTUx0POzTDWBVGQInpNcnVp+MtmQ5Uw0I4yZaM+ycBf5rLmCN4olW xOLEfhzvknvCgJflf5TLOMifAhzuPLfFtaht6zoDHfV73iw50BQV0SHHS/KPEpHvu7np 2gYpawnL47EDAFhGOlG6FO3sF3Hx2A+Rl7AKaCXAT82elj83CaJN9lF3egECM+Q5qMEZ +l02uE5bk9kJFHV4eL+Pnwg43Vo/Q6wVi2p1G9HBtl3rZ4sRP4yn91HfI9quby26gj0v HJgg== X-Forwarded-Encrypted: i=1; AJvYcCUAkTGjkOwsEJSmfMyifgnEtojhMP04jt8gARPh+4z/S8mRKtRzumbhoap8fN1oOie99CrXfqNO6YQtt04=@vger.kernel.org X-Gm-Message-State: AOJu0Yw+6bD5sObpiSwYygRiweRsSnCcVWbrKgHjoUmKWXJgAZmc8YAH o6C3aSK/Jm7jlFRFu9XZWNgtpkXGi+7ciIf3iHFVpY0lNRm2bytds7xkd6rNZ06e4CR5y/uO194 laJbG9Kg= X-Gm-Gg: ATEYQzyk+yc0Ip865kfRjW/7eSYSCNxasWncZ+XTVhlYh9F9WczoYqJj1w+/kBozKuf Fn8M43wM/BIpEQB27NW0Lk86iS5YUKpJCip7Cz+K1+7l/CPXdxh7K5JMJ2meFYO32hztVLaTLzX 9uRfhNTB1HBs6j9ETS+AS++qfLHZURtFZ51pmKHK03fVhz7EJKa74T8CpwMCH2c/P0Lnc7X6Ca/ ruFaWUODF2He9mDBEXc/LSFs8KgMMY1SB3x+IEYSSewhPv2RxZnCLm2CVlbUFsop/cTSMAhPN5Q /Cj0j5pduGLJCWihTdCvX8sDDMYO7PsKQgvyAD7E7LEB98F+GaoiL4+URoeTr95BzPbKiedvBW8 7l6oerzXiP87+aKZb9SGF4BQ6ncDF6HJ2/pIEst9evHBp44HbJ6vydihv8oNiHliczRcN X-Received: by 2002:a05:600c:1c18:b0:480:69ae:f0e9 with SMTP id 5b1f17b1804b1-48519871aa4mr20809055e9.16.1772611601805; Wed, 04 Mar 2026 00:06:41 -0800 (PST) Received: from localhost ([151.19.177.89]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439b130abfasm24333017f8f.34.2026.03.04.00.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 00:06:41 -0800 (PST) From: Francesco Lavra To: Jonathan Corbet , Shuah Khan , Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: [PATCH v7 2/6] iio: Replace 'sign' field with union in struct iio_scan_type Date: Wed, 4 Mar 2026 09:06:40 +0100 Message-Id: <20260304080640.2844366-1-flavra@baylibre.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260304080519.2844101-1-flavra@baylibre.com> References: <20260304080519.2844101-1-flavra@baylibre.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2147; i=flavra@baylibre.com; h=from:subject; bh=nbcIj9p/rJtGfpI+6gAVQl8LH4vGeVEesGIMEW3TiWI=; b=owEB7QES/pANAwAKAe3xO3POlDZfAcsmYgBpp+gQu9y/kVgjMpuub/OeUVKw7GKOLTUITzZ4O p/kp6DTbTeJAbMEAAEKAB0WIQSGV4VPlTvcox7DFObt8TtzzpQ2XwUCaafoEAAKCRDt8TtzzpQ2 X3mrC/4tgZlCQIi7HexBqikkIq9gk6RMxPqYaE6WUY3kz1jD11r5sI9GIDnKORWLOC6J44fDroC Pqr29x3VAGHqCFOybqCHkCfrYpwB6kby+UQggt0MrfYUy2tIRrxLr6zL7zpeQIFAA7a2MreEwi4 6QuUa1WBLh/lQijRNmzkLDyDWbKHNHycDZxQTLyqdtNSlDp9z6AWsmXm0KAl4fuLp/PEQWk9aJK VA2uiULdlSPU3MWHCgW/RQqYgSzaZuGlxk4gBvz/6PvN8+W4IBQA5UhBuhI+4fnjekAfHBY/uLR wnAjKXeexOFARMFbVSgfaogoluq26flyNTrkNM8L8iBJTyVN/WE4YB3v0vpjyNqftCqvmhbf3iT uEtRFKveyw8VsSmySYyLn66959C25aagPfr0IEXEDrghtAYhJiI8IL+A7K+Nj2J5mplE95xpmuU W2LheAYQUGIq7q5+Y6lYryLlZLZYQdPsapzHEhXN424o5N0L0iHURa8MbfGIfN1fSX0g8= X-Developer-Key: i=flavra@baylibre.com; a=openpgp; fpr=8657854F953BDCA31EC314E6EDF13B73CE94365F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This field is used to differentiate between signed and unsigned integers. A following commit will extend its use in order to add support for non- integer scan elements; therefore, replace it with a union that contains a more generic 'format' field. This union will be dropped when all drivers are changed to use the format field. Signed-off-by: Francesco Lavra --- Documentation/driver-api/iio/buffers.rst | 4 ++-- include/linux/iio/iio.h | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Documentation/driver-api/iio/buffers.rst b/Documentation/drive= r-api/iio/buffers.rst index 63f364e862d1..f36e6d00173f 100644 --- a/Documentation/driver-api/iio/buffers.rst +++ b/Documentation/driver-api/iio/buffers.rst @@ -78,7 +78,7 @@ fields in iio_chan_spec definition:: /* other members */ int scan_index struct { - char sign; + char format; u8 realbits; u8 storagebits; u8 shift; @@ -98,7 +98,7 @@ following channel definition:: /* other stuff here */ .scan_index =3D 0, .scan_type =3D { - .sign =3D 's', + .format =3D 's', .realbits =3D 12, .storagebits =3D 16, .shift =3D 4, diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index a9ecff191bd9..61f1dfc14e02 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -178,7 +178,7 @@ struct iio_event_spec { =20 /** * struct iio_scan_type - specification for channel data format in buffer - * @sign: 's' or 'u' to specify signed or unsigned + * @format: (signed or unsigned) integer, or floating point * @realbits: Number of valid bits of data * @storagebits: Realbits + padding * @shift: Shift right by this before masking out realbits. @@ -189,7 +189,10 @@ struct iio_event_spec { * @endianness: little or big endian */ struct iio_scan_type { - char sign; + union { + char sign; + char format; + }; u8 realbits; u8 storagebits; u8 shift; --=20 2.39.5