lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251128003634.247529-5-rafael.v.volkmer@gmail.com>
Date: Thu, 27 Nov 2025 21:36:29 -0300
From: "Rafael V. Volkmer" <rafael.v.volkmer@...il.com>
To: ukleinek@...nel.org
Cc: linux-kernel@...r.kernel.org,
	linux-pwm@...r.kernel.org,
	rafael.v.volkmer@...il.com
Subject: [PATCH v7 4/9] pwm: tiehrpwm: derive PERIOD_MAX from TBPRD field

Replace the open-coded PERIOD_MAX constant (0x10000) with a definition
derived from the TBPRD field layout. Introduce TIEHRPWM_TBPRD_TBPRD to
describe the 16-bit TBPRD field and compute TIEHRPWM_PERIOD_MAX as
FIELD_MAX(TIEHRPWM_TBPRD_TBPRD) + 1.

This keeps the effective upper bound unchanged while tying it directly
to the hardware register layout instead of a hard-coded literal.

No functional change intended.

Signed-off-by: Rafael V. Volkmer <rafael.v.volkmer@...il.com>
---
 drivers/pwm/pwm-tiehrpwm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index 0802f0553587..4b8b4a9e7379 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -38,7 +38,9 @@
 
 #define TIEHRPWM_CLKDIV_MAX			7
 #define TIEHRPWM_HSPCLKDIV_MAX			7
-#define TIEHRPWM_PERIOD_MAX			0x10000
+
+#define TIEHRPWM_TBPRD_TBPRD			GENMASK(15, 0)
+#define TIEHRPWM_PERIOD_MAX			(FIELD_MAX(TIEHRPWM_TBPRD_TBPRD) + 1)
 
 /* compare module registers */
 #define TIEHRPWM_CMPA				0x12
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ