Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Arun Ramadoss <arun.ramadoss@microchip.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Woojung Huh <woojung.huh@microchip.com>,
	UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Russell King <linux@armlinux.org.uk>
Subject: Re: [Patch net-next 00/13] net: dsa: microchip: common spi probe for the ksz series switches - part 2
Date: Fri, 24 Jun 2022 14:23:04 +0300	[thread overview]
Message-ID: <20220624112304.zg5qypzwervonsvc@skbuf> (raw)
In-Reply-To: <20220622090425.17709-1-arun.ramadoss@microchip.com>

On Wed, Jun 22, 2022 at 02:34:12PM +0530, Arun Ramadoss wrote:
> This patch series aims to refactor the ksz_switch_register routine to have the
> common flow for the ksz series switch. And this is the follow up patch series.
> 
> First, it tries moves the common implementation in the setup from individual
> files to ksz_setup. Then implements the common dsa_switch_ops structure instead
> of independent registration. And then moves the ksz_dev_ops to ksz_common.c,
> it allows the dynamic detection of which ksz_dev_ops to be used based on
> the switch detection function.
> 
> Finally, the patch updates the ksz_spi probe function to be same for all the
> ksz_switches.

Sorry for being late to the party again. I've looked over the resulting
code and it appears that there is still some cleanup to do.

We now have a stray struct ksz8 pointer being allocated by the common
ksz_spi_probe(), and passed as dev->priv to ksz_switch_alloc() by this
generic code.

Only ksz8 accesses dev->priv, although it is interesting to note that
ksz9477_i2c_probe() calls ksz_switch_alloc() with a type-incompatible
struct i2c_client *i2c that is unused but bogus.

The concept of struct ksz8 was added by commit 9f73e11250fb ("net: dsa:
microchip: ksz8795: move register offsets and shifts to separate
struct"), and in essence it isn't a bad idea, it's just that I wasn't
aware of it, and only ksz8 makes use of it.

You've added some register offsets yourself to ksz_chip_data
(stp_ctrl_reg, broadcast_ctrl_reg, multicast_ctrl_reg, start_ctrl_reg),
and it looks like struct ksz8 shares more or less the same purpose -
regs, masks, shifts etc. Would you mind doing some more consolidation
work and trying to figure out if we could eliminate a data structure
unique for ksz8 and integrate that information into struct ksz_chip_data
(and perhaps use it in more places)?

      parent reply	other threads:[~2022-06-24 11:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22  9:04 [Patch net-next 00/13] net: dsa: microchip: common spi probe for the ksz series switches - part 2 Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 01/13] net: dsa: microchip: rename shutdown to reset in ksz_dev_ops Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 02/13] net: dsa: microchip: add config_cpu_port to struct ksz_dev_ops Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 03/13] net: dsa: microchip: add the enable_stp_addr pointer in ksz_dev_ops Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 04/13] net: dsa: microchip: move setup function to ksz_common Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 05/13] net: dsa: microchip: move broadcast rate limit to ksz_setup Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 06/13] net: dsa: microchip: move multicast enable " Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 07/13] net: dsa: microchip: move start of switch " Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 08/13] net: dsa: microchip: common dsa_switch_ops for ksz switches Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 09/13] net: dsa: microchip: ksz9477: separate phylink mode from switch register Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 10/13] net: dsa: microchip: common menuconfig for ksz series switch Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 11/13] net: dsa: microchip: move ksz_dev_ops to ksz_common.c Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 12/13] net: dsa: microchip: remove the ksz8/ksz9477_switch_register Arun Ramadoss
2022-06-22  9:04 ` [Patch net-next 13/13] net: dsa: microchip: common ksz_spi_probe for ksz switches Arun Ramadoss
2022-06-24 10:50 ` [Patch net-next 00/13] net: dsa: microchip: common spi probe for the ksz series switches - part 2 patchwork-bot+netdevbpf
2022-06-24 11:23 ` Vladimir Oltean [this message]

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=20220624112304.zg5qypzwervonsvc@skbuf \
    --to=olteanv@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=arun.ramadoss@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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