Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Daniel Golle <daniel@makrotopia.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
	netdev@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	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>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	Sean Wang <sean.wang@mediatek.com>,
	Landen Chao <Landen.Chao@mediatek.com>,
	DENG Qingfang <dqfext@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Sam Shih <Sam.Shih@mediatek.com>,
	Lorenzo Bianconi <lorenzo@kernel.org>,
	John Crispin <john@phrozen.org>, Felix Fietkau <nbd@nbd.name>
Subject: Re: [RFC PATCH net-next 2/2] net: dsa: mt7530: introduce MMIO driver for MT7988 SoC
Date: Tue, 28 Mar 2023 18:17:16 +0300	[thread overview]
Message-ID: <20230328151716.ulvfqrvgsffjnhgc@skbuf> (raw)
In-Reply-To: <ZCMBDm31AzDGBKyL@makrotopia.org>

On Tue, Mar 28, 2023 at 04:00:30PM +0100, Daniel Golle wrote:
> On Tue, Mar 28, 2023 at 05:16:28PM +0300, Vladimir Oltean wrote:
> > On Tue, Mar 28, 2023 at 02:08:18PM +0100, Daniel Golle wrote:
> > > I agree that using regmap would be better and I have evaluated that
> > > approach as well. As regmap doesn't allow lock-skipping and mt7530.c is
> > > much more complex than xrs700x in the way indirect access to its MDIO bus
> > > and interrupts work, using regmap accessors for everything would not be
> > > trivial.
> > > 
> > > So here we can of course use regmap_read_poll_timeout and a bunch of
> > > readmap_write operations. However, each of them will individually acquire
> > > and release the mdio bus mutex while the current code acquires the lock
> > > at the top of the function and then uses unlocked operations.
> > > regmap currently doesn't offer any way to skip the locking and/or perform
> > > locking manually. regmap_read, regmap_write, regmap_update_bits, ... always
> > > acquire and release the lock on each operation.
> > 
> > What does struct regmap_config :: disable_locking do?
> 
> I thought I can't use that on a per-operation base because the
> instance of struct regmap_config itself isn't protected by any lock
> and hence setting disable_locking=false before calling one of the
> accessor functions may affect also other congruent calls to the
> accessors which will then ignore locking and screw things up.
> Please correct me if I'm wrong there.

It's not supposed to be used like that. You set disable_locking = true
once, and take care of locking from the mt7530 driver. Not before every
operation.

> Yet another way I thought about now could also be to have two regmap
> instances, one for locked and one for unlocked accessed to the same
> regmap_bus.

That would also be theoretically possible, but the above would be
equivalent and would require a single regmap.

      reply	other threads:[~2023-03-28 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-27 21:35 [RFC PATCH net-next 2/2] net: dsa: mt7530: introduce MMIO driver for MT7988 SoC Daniel Golle
2023-03-28  1:58 ` Andrew Lunn
2023-03-28 13:08   ` Daniel Golle
2023-03-28 13:59     ` Andrew Lunn
2023-03-28 14:16     ` Vladimir Oltean
2023-03-28 15:00       ` Daniel Golle
2023-03-28 15:17         ` 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=20230328151716.ulvfqrvgsffjnhgc@skbuf \
    --to=olteanv@gmail.com \
    --cc=Landen.Chao@mediatek.com \
    --cc=Sam.Shih@mediatek.com \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=john@phrozen.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=lorenzo@kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --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