public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dhruva Gole <d-gole@ti.com>
To: <dan.j.williams@intel.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Frank Li <Frank.Li@nxp.com>, Linux PM <linux-pm@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	"Takashi Iwai" <tiwai@suse.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Zhang Qilong <zhangqilong3@huawei.com>,
	Linux PCI <linux-pci@vger.kernel.org>,
	"Bjorn Helgaas" <helgaas@kernel.org>,
	Alex Williamson <alex.williamson@redhat.com>
Subject: Re: [PATCH v1 0/3] PM: runtime: Wrapper macros for usage counter guards
Date: Thu, 13 Nov 2025 17:05:29 +0530	[thread overview]
Message-ID: <20251113113529.vnfvc6cqmk2ct4kl@lcpd911> (raw)
In-Reply-To: <6914fbb5a6ce_1d911001b@dwillia2-mobl4.notmuch>

On Nov 12, 2025 at 13:27:17 -0800, dan.j.williams@intel.com wrote:
> Rafael J. Wysocki wrote:
> > On Wednesday, November 12, 2025 7:39:41 AM CET Dhruva Gole wrote:
> > > On Nov 07, 2025 at 19:35:09 +0100, Rafael J. Wysocki wrote:
> > > > Hi All,
> > > > 
> > > > The runtime PM usage counter guards introduced recently:
> > > > 
> > > > https://lore.kernel.org/linux-pm/6196611.lOV4Wx5bFT@rafael.j.wysocki/
> > > > 
> > > > and then fixed:
> > > > 
> > > > https://lore.kernel.org/linux-pm/5943878.DvuYhMxLoT@rafael.j.wysocki/
> > > > 
> > > > should generally work, but using them feels sort of arcane and cryptic
> > > > even though the underlying concept is relatively straightforward.
> > > > 
> > > > For this reason, runtime PM wrapper macros around ACQUIRE() and
> > > > ACQUIRE_ERR() involving the new guards are introduced in this series
> > > > (patch [1/3]) and then used in the code already using the guards (patches
> > > > [2/3] and [3/3]) to make it look more straightforward.
> > > 
> > > The patches look okay to me,
> > > Reviewed-by: Dhruva Gole <d-gole@ti.com>
> > 
> > Thank you and Jonathan for the tags, but since Frank is not convinced, let me
> > bounce one more idea off all of you.
> > 
> > Namely, I think that Frank has a point when he wonders if PM_RUNTIME_ACQUIRE_ERR
> > hides too much information and I agree with Jonathan that may be misunderstood,
> > so what about defining the wrapper macros so they don't hide the guard variable
> > name, like in the patch below?
> 
> I had been reluctant about offering an enthusiastic tag on this series
> given that information hiding, but with this change:
> 
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> 
> However, I prefer that the scope variable declaration vs usage
> (reference) cases should maintain visual separation with an operator,
> i.e.:
> 
>         PM_RUNTIME_ACQUIRE(dev, pm);
>         if (PM_RUNTIME_ACQUIRE_ERR(&pm))
>                 return -ENXIO;
> 
> Otherwise we have a case of different flavors of *_ACQUIRE_ERR
> implementing various styles. I initially looked at hiding the '&':
> 
> http://lore.kernel.org/681ea7d5ea04b_2a2bb100cf@dwillia2-mobl4.notmuch
> 
> ...but it grew on me precisely because it provides a clue about how this
> magic operates.

Yeah you're right, I agree. Having users explicitly pass on the '&' provides much
more clarity on what's going on than hiding it internally.

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated

      parent reply	other threads:[~2025-11-13 11:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-07 18:35 [PATCH v1 0/3] PM: runtime: Wrapper macros for usage counter guards Rafael J. Wysocki
2025-11-07 18:39 ` [PATCH v1 1/3] PM: runtime: Wrapper macros for ACQUIRE()/ACQUIRE_ERR() Rafael J. Wysocki
2025-11-10 16:06   ` Frank Li
2025-11-07 18:40 ` [PATCH v1 2/3] PCI/sysfs: Use PM_RUNTIME_ACQUIRE()/PM_RUNTIME_ACQUIRE_ERR Rafael J. Wysocki
2025-11-07 18:41 ` [PATCH v1 3/3] ACPI: TAD: " Rafael J. Wysocki
2025-11-10 12:06 ` [PATCH v1 0/3] PM: runtime: Wrapper macros for usage counter guards Jonathan Cameron
2025-11-12  6:39 ` Dhruva Gole
2025-11-12 19:44   ` Rafael J. Wysocki
2025-11-12 21:27     ` dan.j.williams
2025-11-12 21:38       ` Rafael J. Wysocki
2025-11-13 11:26         ` Jonathan Cameron
2025-11-13 11:35       ` Dhruva Gole [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=20251113113529.vnfvc6cqmk2ct4kl@lcpd911 \
    --to=d-gole@ti.com \
    --cc=Frank.Li@nxp.com \
    --cc=alex.williamson@redhat.com \
    --cc=dan.j.williams@intel.com \
    --cc=helgaas@kernel.org \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=tiwai@suse.de \
    --cc=zhangqilong3@huawei.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