public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Marangi <ansuelsmth@gmail.com>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: 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>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jens Axboe <axboe@kernel.dk>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [net-next RFC PATCH 1/4] net: dsa: qca8k: drop qca8k_read/write/rmw for regmap variant
Date: Mon, 18 Jul 2022 19:55:26 +0200	[thread overview]
Message-ID: <62d5a291.1c69fb81.e8ebe.287f@mx.google.com> (raw)
In-Reply-To: <20220718180452.ysqaxzguqc3urgov@skbuf>

On Mon, Jul 18, 2022 at 09:04:52PM +0300, Vladimir Oltean wrote:
> On Sat, Jul 16, 2022 at 07:49:55PM +0200, Christian Marangi wrote:
> > In preparation for code split, drop the remaining qca8k_read/write/rmw
> > and use regmap helper directly.
> > 
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> >  drivers/net/dsa/qca/qca8k.c | 206 +++++++++++++++++-------------------
> >  1 file changed, 95 insertions(+), 111 deletions(-)
> > 
> > diff --git a/drivers/net/dsa/qca/qca8k.c b/drivers/net/dsa/qca/qca8k.c
> > index 1cbb05b0323f..2d34e15c2e6f 100644
> > --- a/drivers/net/dsa/qca/qca8k.c
> > +++ b/drivers/net/dsa/qca/qca8k.c
> > @@ -184,24 +184,6 @@ qca8k_set_page(struct qca8k_priv *priv, u16 page)
> >  	return 0;
> >  }
> >  
> > -static int
> > -qca8k_read(struct qca8k_priv *priv, u32 reg, u32 *val)
> > -{
> > -	return regmap_read(priv->regmap, reg, val);
> > -}
> > -
> > -static int
> > -qca8k_write(struct qca8k_priv *priv, u32 reg, u32 val)
> > -{
> > -	return regmap_write(priv->regmap, reg, val);
> > -}
> > -
> > -static int
> > -qca8k_rmw(struct qca8k_priv *priv, u32 reg, u32 mask, u32 write_val)
> > -{
> > -	return regmap_update_bits(priv->regmap, reg, mask, write_val);
> > -}
> > -
> 
> Could you please explain slowly to me why this change is needed? I don't get it.
> Can't qca8k_read(), qca8k_write() and qca8k_rmw() be part of qca8k-common.c?

Sure.
When the regmap conversion was done at times, to limit patch delta it
was suggested to keep these function. This was to not get crazy with
eventual backports and fixes.

The logic here is:
As we are moving these function AND the function will use regmap api
anyway, we can finally drop them and user the regmap api directly
instead of these additional function.

When the regmap conversion was done, I pointed out that in the future
the driver had to be split in specific and common code and it was said
that only at that times there was a good reason to make all these
changes and drop these special functions.

Now these function are used by both setup function for qca8k and by
common function that will be moved to a different file.


If we really want I can skip the dropping of these function and move
them to qca8k common code.

An alternative is to keep them for qca8k specific code and migrate the
common function to regmap api.

So it's really a choice of drop these additional function or keep using
them for the sake of not modifying too much source.

Hope it's clear now the reason of this change.

-- 
	Ansuel

  reply	other threads:[~2022-07-18 18:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-16 17:49 [net-next RFC PATCH 0/4] net: dsa: qca8k: code split for qca8k Christian Marangi
2022-07-16 17:49 ` [net-next RFC PATCH 1/4] net: dsa: qca8k: drop qca8k_read/write/rmw for regmap variant Christian Marangi
2022-07-18 18:04   ` Vladimir Oltean
2022-07-18 17:55     ` Christian Marangi [this message]
2022-07-18 18:40       ` Vladimir Oltean
2022-07-18 18:40         ` Christian Marangi
2022-07-18 19:35           ` Vladimir Oltean
2022-07-18 19:30             ` Christian Marangi
2022-07-18 20:30               ` Vladimir Oltean
2022-07-18 21:54                 ` Christian Marangi
2022-07-18 23:43                   ` Vladimir Oltean
2022-07-18 23:32                     ` Christian Marangi
2022-07-19  0:18                       ` Vladimir Oltean
2022-07-19  0:17                         ` Christian Marangi
2022-07-19  0:41                           ` Vladimir Oltean
2022-07-16 17:49 ` [net-next RFC PATCH 2/4] net: dsa: qca8k: convert to regmap read/write API Christian Marangi
2022-07-16 17:49 ` [net-next RFC PATCH 3/4] net: dsa: qca8k: rework mib autocast handling Christian Marangi
2022-07-18 17:27   ` Vladimir Oltean
2022-07-18 17:20     ` Christian Marangi
2022-07-18 17:58       ` Vladimir Oltean
2022-07-16 17:49 ` [net-next RFC PATCH 4/4] net: dsa: qca8k: split qca8k in common and 8xxx specific code Christian Marangi
2022-07-18 17:21   ` Vladimir Oltean
2022-07-18 17:10     ` Christian Marangi
2022-07-18 17:38       ` Vladimir Oltean
2022-07-18 14:46 ` [net-next RFC PATCH 0/4] net: dsa: qca8k: code split for qca8k Christian Marangi
2022-07-18 17:35   ` Vladimir Oltean
2022-07-18 17:23     ` Christian Marangi
2022-07-18 18:15       ` Vladimir Oltean
2022-07-18 18:02         ` Christian Marangi

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=62d5a291.1c69fb81.e8ebe.287f@mx.google.com \
    --to=ansuelsmth@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=axboe@kernel.dk \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=vivien.didelot@gmail.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