linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: rafael@kernel.org, andriy.shevchenko@linux.intel.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] PM: Discard runtime_xx() handles using pm_ptr()
Date: Thu, 20 Feb 2025 14:54:53 +0200	[thread overview]
Message-ID: <Z7cmHZ_uuM31mGRd@black.fi.intel.com> (raw)
In-Reply-To: <04b87029f2237e209d8c8b620d009692d80eea2f.camel@crapouillou.net>

On Thu, Feb 20, 2025 at 01:15:19PM +0100, Paul Cercueil wrote:
> Hi Raag,
> 
> Le jeudi 20 février 2025 à 13:33 +0530, Raag Jadav a écrit :
> > Discard runtime_xx() handles in RUNTIME_PM_OPS() using pm_ptr() macro
> > and drop unnecessary CONFIG_PM ifdeffery.
> 
> So the RUNTIME_PM_OPS() is newer and people should use that, but we're
> not yet at the point where the older SET_RUNTIME_PM_OPS() macro can be
> dropped.
> 
> The difference is that in the !CONFIG_PM case, the former will
> reference the suspend/resume functions, but they will be detected as
> dead code; on the other hand, the latter macro won't reference them at
> all. Many drivers still wrap their suspend/resume functions in a #ifdef
> CONFIG_PM to avoid warnings about unused static functions. Therefore if
> you unconditionally force the use of the first macro everywhere, many
> drivers will fail to compile in the !CONFIG_PM case.
> 
> As for adding pm_ptr() inside RUNTIME_PM_OPS(), it is unnecesary, as
> the whole pm_ops struct should be referenced through pm_ptr() or
> pm_sleep_ptr() anyway, which means that the whole struct and the
> callback functions will be garbage-collected if PM is disabled.

True. My intent was to garbage collect the runtime handles, atleast until
the users are converted to reference their struct pm_ops through it. I
didn't account for the driver wide CONFIG_PM ifdeffery though.

I guess pm.h has its own learning curve.

Raag

      reply	other threads:[~2025-02-20 12:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-20  8:03 [PATCH v1] PM: Discard runtime_xx() handles using pm_ptr() Raag Jadav
2025-02-20 10:35 ` kernel test robot
2025-02-20 11:27 ` kernel test robot
2025-02-20 12:15 ` Paul Cercueil
2025-02-20 12:54   ` Raag Jadav [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=Z7cmHZ_uuM31mGRd@black.fi.intel.com \
    --to=raag.jadav@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=paul@crapouillou.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).