Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1235164

Re: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no callbacks

From Alan Stern <stern@rowland.harvard.edu>
Newsgroups linux.kernel
Subject Re: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no callbacks
Date 2015-09-29 16:40 +0200
Message-ID <qe4ev-Oh-39@gated-at.bofh.it> (permalink)
References <qe2mm-6A8-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 29 Sep 2015, Tomeu Vizoso wrote:

> If a suitable prepare callback cannot be found for a given device and
> its driver has no PM callbacks at all, assume that it can go direct to
> complete when the system goes to sleep.
> 
> The reason for this is that there's lots of devices in a system that do
> no PM at all and there's no reason for them to prevent their ancestors
> to do direct_complete if they can support it.
> 
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>

> +void device_check_pm_callbacks(struct device *dev)
> +{
> +	dev->power.no_pm_callbacks =
> +		(!dev->bus || pm_ops_is_empty(dev->bus->pm)) &&
> +		(!dev->class || pm_ops_is_empty(dev->class->pm)) &&
> +		(!dev->type || pm_ops_is_empty(dev->type->pm)) &&
> +		(!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) &&
> +		(!dev->driver || pm_ops_is_empty(dev->driver->pm));
> +}

One fairly minor point: You should lock dev->power.lock before setting
this bitfield.  This is because bitfields are not SMP-safe.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no callbacks Tomeu Vizoso <tomeu.vizoso@collabora.com> - 2015-09-29 14:40 +0200
  Re: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no  callbacks kbuild test robot <lkp@intel.com> - 2015-09-29 15:40 +0200
  Re: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no  callbacks kbuild test robot <lkp@intel.com> - 2015-09-29 15:40 +0200
  Re: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no  callbacks kbuild test robot <lkp@intel.com> - 2015-09-29 15:50 +0200
  Re: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no  callbacks Alan Stern <stern@rowland.harvard.edu> - 2015-09-29 16:40 +0200
  Re: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no  callbacks Pavel Machek <pavel@ucw.cz> - 2015-10-04 17:20 +0200
    Re: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no callbacks Tomeu Vizoso <tomeu.vizoso@collabora.com> - 2015-10-05 10:30 +0200
      Re: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no  callbacks Pavel Machek <pavel@ucw.cz> - 2015-10-05 11:10 +0200
        Re: [PATCH v5 1/2] PM / sleep: Go direct_complete if driver has no callbacks "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-10-05 15:10 +0200

csiph-web