netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: woojung.huh@microchip.com, UNGLinuxDriver@microchip.com,
	andrew@lunn.ch, vivien.didelot@gmail.com, olteanv@gmail.com,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com
Subject: Re: [PATCH net-next 1/6] net: dsa: microchip: lan937x: add regmap range validation
Date: Wed, 2 Nov 2022 10:15:54 -0700	[thread overview]
Message-ID: <cc5dd02f-7285-dfcf-76b1-bb258c8029fb@gmail.com> (raw)
In-Reply-To: <20221102041058.128779-2-rakesh.sankaranarayanan@microchip.com>

On 11/1/22 21:10, Rakesh Sankaranarayanan wrote:
> Add regmap_range and regmap_access_table to define valid
> register range for LAN937x switch family. LAN937x family
> have sku id's LAN9370, LAN9371, LAN9372, LAN9373 and
> LAN9374. regmap_range structure is arranged as Global
> Registers followed by Port Registers but they are distributed
> as Global Registers, T1 PHY Port Registers, Tx PHY Port Registers,
> RGMII Port Registers, SGMII Port Registers. On 16 bit addressing,
> most significant 4 bits are used for representing port number.
> So valid range of two different T1 PHY ports within a sku
> will differ on upper nibble only.
> 
> Signed-off-by: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
> ---
>   drivers/net/dsa/microchip/ksz_common.c | 1760 ++++++++++++++++++++++++
>   1 file changed, 1760 insertions(+)
> 
> diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
> index d612181b3226..b0905c5b701d 100644
> --- a/drivers/net/dsa/microchip/ksz_common.c
> +++ b/drivers/net/dsa/microchip/ksz_common.c
> @@ -1030,6 +1030,1756 @@ static const struct regmap_access_table ksz9896_register_set = {
>   	.n_yes_ranges = ARRAY_SIZE(ksz9896_valid_regs),
>   };
>   
> +static const struct regmap_range lan9370_valid_regs[] = {

Suggest you employ some macros for generating the valid register ranges 
for ports since there is a lot of repetition, and chances are that new 
registers may have to be added in the future, or corrected.

Between the fact that regmap makes you pull an entire subsystem into the 
kernel image thus adding to code sections, plus these big tables of 
register ranges adding to read-only data sections, this really makes me 
wonder what benefit there is just to expose a debugfs interface for 
dumping registers... value proposition does not seem so great to me.
-- 
Florian


  reply	other threads:[~2022-11-02 17:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02  4:10 [PATCH net-next 0/6] net: dsa: microchip: regmap range validation and ksz_pwrite status check for lan937x and irq and error checking updates for ksz series Rakesh Sankaranarayanan
2022-11-02  4:10 ` [PATCH net-next 1/6] net: dsa: microchip: lan937x: add regmap range validation Rakesh Sankaranarayanan
2022-11-02 17:15   ` Florian Fainelli [this message]
2022-11-03  8:44     ` Rakesh.Sankaranarayanan
2022-11-02  4:10 ` [PATCH net-next 2/6] net: dsa: microchip: add ksz9563 in ksz_switch_ops and select based on compatible string Rakesh Sankaranarayanan
2022-11-02  4:10 ` [PATCH net-next 3/6] net: dsa: microchip: add irq in i2c probe Rakesh Sankaranarayanan
2022-11-02  4:10 ` [PATCH net-next 4/6] net: dsa: microchip: add error checking for ksz_pwrite Rakesh Sankaranarayanan
2022-11-02  4:10 ` [PATCH net-next 5/6] net: dsa: microchip: ksz8563: Add number of port irq Rakesh Sankaranarayanan
2022-11-02  4:10 ` [PATCH net-next 6/6] net: dsa: microchip: add dev_err_probe in probe functions Rakesh Sankaranarayanan
2022-11-03  3:50   ` Jakub Kicinski
2022-11-03  8:55     ` Rakesh.Sankaranarayanan

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=cc5dd02f-7285-dfcf-76b1-bb258c8029fb@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=rakesh.sankaranarayanan@microchip.com \
    --cc=vivien.didelot@gmail.com \
    --cc=woojung.huh@microchip.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;
as well as URLs for NNTP newsgroup(s).