From: Daniel Golle <daniel@makrotopia.org>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: "Chester A. Unal" <chester.a.unal@arinc9.com>,
DENG Qingfang <dqfext@gmail.com>,
Sean Wang <sean.wang@mediatek.com>, Andrew Lunn <andrew@lunn.ch>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH net-next] net: dsa: mt7530: Constify struct regmap_config
Date: Sun, 13 Jul 2025 21:36:34 +0100 [thread overview]
Message-ID: <aHQY0hVsua5pP0QC@makrotopia.org> (raw)
In-Reply-To: <1b20b2e717e9ff15aa0d1e73442dde613174cfef.1752419299.git.christophe.jaillet@wanadoo.fr>
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@wanadoo.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@makrotopia.org>
next prev parent reply other threads:[~2025-07-13 20:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-13 15:09 [PATCH net-next] net: dsa: mt7530: Constify struct regmap_config Christophe JAILLET
2025-07-13 20:36 ` Daniel Golle [this message]
2025-07-13 21:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aHQY0hVsua5pP0QC@makrotopia.org \
--to=daniel@makrotopia.org \
--cc=andrew@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chester.a.unal@arinc9.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=dqfext@gmail.com \
--cc=edumazet@google.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=sean.wang@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox