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] [day] [month] [year] [list]
Message-ID: <6504f3dc-4e95-4f10-b46c-4583ceb74a4a@lunn.ch>
Date: Thu, 15 Jan 2026 18:23:14 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Vinitha Vijayan <vinithamvijayan723@...il.com>
Cc: netdev@...r.kernel.org, kuba@...nel.org, davem@...emloft.net,
	pabeni@...hat.com, linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH] net: phy: qcom: replace CDT poll magic numbers with
 named constants

On Thu, Jan 15, 2026 at 10:27:18PM +0530, Vinitha Vijayan wrote:
> Replace hard-coded poll interval and timeout values in
> at803x_cdt_wait_for_completion() with named macros.
> 
> This improves readability

  	ret = phy_read_poll_timeout(phydev, AT803X_CDT, val,
  				    !(val & cdt_en),
 				    30000, 100000, true);

	ret = phy_read_poll_timeout(phydev, AT803X_CDT, val,
				    !(val & cdt_en),
				    AT803X_CDT_POLL_INTERVAL_US,
				    AT803X_CDT_TIMEOUT_US,
				    true);

Is it really more readable?

The point about magic values is that you cannot easily see what they
mean. With BIT(4) is hard know that that means. But all the
read_poll_timeout() functions are very similar. If you know one, you
know them all.  I know the poll interval is 30,000us and timeout
happens after 100,000us. Using macros just means i need to go find the
definition of the macro to know the timers used in this polling
method.

    Andrew

---
pw-bot: cr



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ