All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Mark Brown <broonie@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH RFC 2/4] regcache: use the regmap scoped lock guard
Date: Tue, 22 Sep 2026 08:32:30 +0800	[thread overview]
Message-ID: <arHMnmeRbOqSeIQ9@shlinux89> (raw)
In-Reply-To: <arD2oclSWsFo551s@sirena.co.uk>

Hi Mark,

On Mon, Sep 21, 2026 at 11:19:29AM +0200, Mark Brown wrote:
>On Mon, Sep 21, 2026 at 02:03:34PM +0800, Peng Fan (OSS) wrote:
>> From: Peng Fan <peng.fan@nxp.com>
>> 
>> Convert the open-coded map->lock()/map->unlock() users in regcache.c
>> to the regmap scoped guard introduced for regmap.c. Use
>> scoped_guard(regmap, ...) where the locked region is a subsection of
>
>> @@ -432,73 +428,69 @@ int regcache_sync(struct regmap *map)
>
>> +		for (i = 0; i < map->patch_regs; i++) {
>> +			sync_ret = _regmap_write(map, map->patch[i].reg, map->patch[i].def);
>> +			if (sync_ret != 0) {
>> +				dev_err(map->dev, "Failed to write %x = %x: %d\n",
>> +					map->patch[i].reg, map->patch[i].def, sync_ret);
>> +				goto out;
>> +			}
>>  		}
>
>This has the mixing scoped guard and goto thing I keep raising.

The logic is as:
  scoped_guard(regmap, map) {
      if (xy)
          goto out;
  out:
      yz;
  }

The out is still in the scoped_guard region, so no issue per my understanding.

But indeed, it is not good to have goto in scoped_guard. V2 will not have
scoped_guard and goto mixed.

Thanks
Peng

  reply	other threads:[~2026-09-22  0:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  6:03 [PATCH RFC 0/4] regmap: convert map->lock/unlock users to a scoped guard Peng Fan (OSS)
2026-09-21  6:03 ` [PATCH RFC 1/4] regmap: convert lock/unlock " Peng Fan (OSS)
2026-09-21  6:03 ` [PATCH RFC 2/4] regcache: use the regmap scoped lock guard Peng Fan (OSS)
2026-09-21  9:19   ` Mark Brown
2026-09-22  0:32     ` Peng Fan [this message]
2026-09-21  6:03 ` [PATCH RFC 3/4] regcache: rbtree: " Peng Fan (OSS)
2026-09-21  6:03 ` [PATCH RFC 4/4] regmap: debugfs: " Peng Fan (OSS)

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=arHMnmeRbOqSeIQ9@shlinux89 \
    --to=peng.fan@oss.nxp.com \
    --cc=broonie@kernel.org \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=rafael@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.