linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH 1/1] smiapp: Implement power-on and power-off sequences without runtime PM
Date: Fri, 25 Nov 2016 02:43:50 +0200	[thread overview]
Message-ID: <2929151.g7xCm3YOsX@avalon> (raw)
In-Reply-To: <3671263.RFBLxrVu2U@wuerfel>

Hello,

(CC'ing the linux-pm mailing list)

On Tuesday 22 Nov 2016 21:58:32 Arnd Bergmann wrote:
> On Tuesday, November 22, 2016 8:31:42 PM CET Laurent Pinchart wrote:
> >>> @@ -2915,7 +2906,11 @@ static int smiapp_probe(struct i2c_client
> >>> *client,
> >>> 
> >>>     pm_runtime_enable(&client->dev);
> >>> 
> >>> +#ifdef CONFIG_PM
> >>>     rval = pm_runtime_get_sync(&client->dev);
> >>> +#else
> >>> +   rval = smiapp_power_on(&client->dev);
> >>> +#endif
> >>>     if (rval < 0) {
> >>>             rval = -ENODEV;
> >>>             goto out_power_off;
> >> 
> >> I would suggest writing this as
> >> 
> >>       if (IS_ENABLED(CONFIG_PM))
> >>               rval = pm_runtime_get_sync(&client->dev);
> >>       else
> >>               rval = smiapp_power_on(&client->dev);
> >> 
> >> though that is a purely cosmetic change.
> > 
> > Are all drivers really supposed to code this kind of construct ? Shouldn't
> > this be handled in the PM core ? A very naive approach would be to call
> > .runtime_resume() and .runtime_suspend() from the non-CONFIG_PM versions
> > of pm_runtime_enable() and pm_runtime_disable() respectively. I assume
> > that would break things, but can't we implement something similar to that
> > that wouldn't require all drivers to open-code it ?
> 
> I know nothing about the details of how the suspend/resume code should
> do this, I was just commenting on the syntax above, preferring an
> IS_ENABLED() check over an #ifdef.

Dear linux-pm developers, what's the suggested way to ensure that a runtime-
pm-enabled driver can run fine on a system with CONFIG_PM disabled ?

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2016-11-25  0:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-18 13:50 [PATCH 1/1] smiapp: Implement power-on and power-off sequences without runtime PM Sakari Ailus
2016-11-18 16:09 ` Arnd Bergmann
2016-11-22 18:31   ` Laurent Pinchart
2016-11-22 20:58     ` Arnd Bergmann
2016-11-25  0:43       ` Laurent Pinchart [this message]
2016-11-25  2:15         ` Alan Stern
2016-11-25  7:48           ` Sakari Ailus
2016-11-25 15:21             ` Alan Stern
2016-11-25 19:34               ` Laurent Pinchart
2016-11-26 20:10                 ` Alan Stern
2016-11-28  7:58                   ` Laurent Pinchart
2016-11-28 15:45                     ` Alan Stern

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=2929151.g7xCm3YOsX@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=arnd@arndb.de \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.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;
as well as URLs for NNTP newsgroup(s).