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: <aHQY0hVsua5pP0QC@makrotopia.org>
Date: Sun, 13 Jul 2025 21:36:34 +0100
From: Daniel Golle <daniel@...rotopia.org>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: "Chester A. Unal" <chester.a.unal@...nc9.com>,
	DENG Qingfang <dqfext@...il.com>,
	Sean Wang <sean.wang@...iatek.com>, Andrew Lunn <andrew@...n.ch>,
	Vladimir Oltean <olteanv@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Matthias Brugger <matthias.bgg@...il.com>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
	netdev@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH net-next] net: dsa: mt7530: Constify struct regmap_config

On Sun, Jul 13, 2025 at 05:09:24PM +0200, Christophe JAILLET wrote:
> 'struct regmap_config' are not modified in these drivers. They be
> statically defined instead of allocated and populated at run-time.
> 
> The main benefits are:
>   - it saves some memory at runtime
>   - the structures can be declared as 'const', which is always better for
>     structures that hold some function pointers
>   - the code is less verbose
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
>  drivers/net/dsa/mt7530-mdio.c | 21 +++++++++------------
>  drivers/net/dsa/mt7530-mmio.c | 21 ++++++++++-----------
>  2 files changed, 19 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/net/dsa/mt7530-mdio.c b/drivers/net/dsa/mt7530-mdio.c
> index 51df42ccdbe6..0286a6cecb6f 100644
> --- a/drivers/net/dsa/mt7530-mdio.c
> +++ b/drivers/net/dsa/mt7530-mdio.c
> @@ -136,10 +136,17 @@ static const struct of_device_id mt7530_of_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, mt7530_of_match);
>  
> +static const struct regmap_config regmap_config = {

Maybe calling this one 'regmap_config_mdio'...


> +	.reg_bits = 16,
> +	.val_bits = 32,
> +	.reg_stride = 4,
> +	.max_register = MT7530_CREV,
> +	.disable_locking = true,
> +};
> +
> ...

> diff --git a/drivers/net/dsa/mt7530-mmio.c b/drivers/net/dsa/mt7530-mmio.c
> index 842d74268e77..1dc8b93fb51a 100644
> --- a/drivers/net/dsa/mt7530-mmio.c
> +++ b/drivers/net/dsa/mt7530-mmio.c
> @@ -18,10 +18,17 @@ static const struct of_device_id mt7988_of_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, mt7988_of_match);
>  
> +static const struct regmap_config sw_regmap_config = {

... and this one 'regmap_config_mmio' would be a bit nicer.

> +	.name = "switch",
> +	.reg_bits = 16,
> +	.val_bits = 32,
> +	.reg_stride = 4,
> +	.max_register = MT7530_CREV,
> +};
> +

Other than that:

Reviewed-by: Daniel Golle <daniel@...rotopia.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ