Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp70531lqb; Tue, 4 Jun 2024 05:33:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVZ7gu7pe9HcYgFF/cdBuoIrGDcjc6TV67rrvpd1CIxeTflT9c3HXoqaqQ1jPEdNqPpGiCrxqiNTyVko2qRNLL6d6uvaIwJS9F/tKOoDg== X-Google-Smtp-Source: AGHT+IEbR4CmG7gLYpiYegWEfb+Bn/xSg/PMCgCbAB+sIRCVbx3x0LGfSdTvjpNn8zyCD5sNQYbL X-Received: by 2002:a05:6358:7f0f:b0:19c:5531:8cb6 with SMTP id e5c5f4694b2df-19c5531914emr80077555d.27.1717504417460; Tue, 04 Jun 2024 05:33:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717504417; cv=pass; d=google.com; s=arc-20160816; b=F9IfvAN5VuLmajPyh3krh9UXeXJc/ed1HAK2tDfVLZ9Wee4keXJy/8vR1fInOED0bP U5Q3pt3E3hZwkepr8f8WMrRHYBMV4ZeBZJlQgDwYwNrBHCb9G4uyuO97CZBB2Oy7nn0a SCTj5UzGcMVPFSOTVTtFzsgXvPfbQubD5HkoYwC7rqc5u1ucgSr1QSgxeAm7xLDSEWTw MmMeUyj9OX1MJjEJ2rVciuOVGjOpx/hJFtTRXPqStKNiHHsJG0ZVc892WAeEfvQUR1Ha eMSVFsukLf5dU7XzteElsF3x0rC5RlSUEhMlCPc+kWjiVaExM4Kv37yyXBQ/toMpVzha rwLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=75atZ5FmlzeC0V+ciPMxXDA3LpQ2wg6e974n2Q9TZ+4=; fh=JQ3ikGhlcptO474a/cwMfUas3YJbAJtlEXumRDo7cM4=; b=OdCdg+j5hOadG7BHp4ZVl56kV4FPYTOgetSlpopF27FwUDEBJAazfLviKVoQ2++SeR nnPO1rA7kPr0EtCotMjs4mB8rpOki72NCs5OZen/x+muufgjUKM7WPhLGOR/KaIOEWyT 527WcJ1j0vz0njlgebMa8RCwHSFCuWRYKFS33RHxnr3ZllZEDEVmR6SZdzVv+/14r6+4 KcN9S5lmVUp0syxxcln8ad6EU4/ICt4lSVqA4dcRAvw06mJGMnMTMzJFbunn0uLpVgMq HF6ywOsv3j6FqHz2Z1Zwal5yhxe2kw+OuctvBcpKaUeOnOy99aU1DWcH6WWwJ0vuYWNi oWZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Dr+rYusL; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-200597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35b40c51asi179527a12.553.2024.06.04.05.33.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 05:33:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Dr+rYusL; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-200597-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4248FB22FEA for ; Tue, 4 Jun 2024 12:31:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D75C1465B7; Tue, 4 Jun 2024 12:30:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Dr+rYusL" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 74329146A92; Tue, 4 Jun 2024 12:30:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717504223; cv=none; b=HLx10/qk68hA4aQwDI244mVTfc/8YmBC0eDkZLt7FYyC6/MnZN8dDZ/oQ/IJ3NVCHgqOso5MlLR8S0lDRwZJ1NpU1juHUyaugFe+LKC+4pPjHy1NlkVPhJEf85CmGq+JgdovNIjs2A2JoN4jv31uDDhPchBeqbLJCi+2DU50odI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717504223; c=relaxed/simple; bh=fKt22plDiq37Whi44C+GK1htAfZF0xNWBNbbUorI/T0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I6S05YZabpfMQJSgd0qVyJc2e3r2X439gmM0El0862/FSWXdvW1NvkFwfxnGVpQ/vgJtvAVsyJAllVRf7UXY5IADGXqHMOEWqp232SnoQe0PZLxOrq5yVZDIHCRtrkVN31HEB0modzfv6RkzSjrOWCUQXAlfOA4ElxMen1yAfG4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=Dr+rYusL; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1717504219; bh=fKt22plDiq37Whi44C+GK1htAfZF0xNWBNbbUorI/T0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dr+rYusLTtwGNRBZguQ9EKPGnhZ+NuVPaiSMHOrJpK4YD64f3Q8l3vuuwXW9d8q5o 6RINkfBJMkI804Ou/Xx1be0VIhtVKk4mz+m0IhCep/uLczfgFh0K15z6nPqXt8SLZ3 eXZA7LZ57VV3N3ZQz5o6hSibqOTS6XIYRFjTMp7MfeG/MiVmXkHL5YQ+HGkifqmadS wKnWFw3pXdlK8bZv1dgFH+ZAtBNsklJ/aLXXqVoE2zSfMKbSH54eYAAlrJ1v6DWHzy yJJ5HDBkvfgSmir6aXWG1AJMgB6bbwvrjHNkMCGdbFD3KLj6ODAcZ4BX07o8m6YWAt 8B2RftNyVDnFA== Received: from IcarusMOD.eternityproject.eu (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 3A78B37821F2; Tue, 4 Jun 2024 12:30:18 +0000 (UTC) From: AngeloGioacchino Del Regno To: jic23@kernel.org Cc: lars@metafoo.de, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, lee@kernel.org, andy@kernel.org, nuno.sa@analog.com, bigunclemax@gmail.com, dlechner@baylibre.com, marius.cristea@microchip.com, marcelo.schmitt@analog.com, fr0st61te@gmail.com, mitrutzceclan@gmail.com, mike.looijmans@topic.nl, marcus.folkesson@gmail.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, andy.shevchenko@gmail.com, kernel@collabora.com Subject: [PATCH v2 3/5] math.h: Add unsigned 8 bits fractional numbers type Date: Tue, 4 Jun 2024 14:30:06 +0200 Message-ID: <20240604123008.327424-4-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604123008.327424-1-angelogioacchino.delregno@collabora.com> References: <20240604123008.327424-1-angelogioacchino.delregno@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Some users may be requiring only rather small numbers as both numerator and denominator: add signed and unsigned 8 bits structs {s8,u8}_fract. Signed-off-by: AngeloGioacchino Del Regno --- include/linux/math.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/math.h b/include/linux/math.h index dd4152711de7..f5f18dc3616b 100644 --- a/include/linux/math.h +++ b/include/linux/math.h @@ -112,6 +112,8 @@ struct type##_fract { \ __##type numerator; \ __##type denominator; \ }; +__STRUCT_FRACT(s8) +__STRUCT_FRACT(u8) __STRUCT_FRACT(s16) __STRUCT_FRACT(u16) __STRUCT_FRACT(s32) -- 2.45.1