linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Linux PM list <linux-pm@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux-sh list <linux-sh@vger.kernel.org>,
	Magnus Damm <magnus.damm@gmail.com>,
	Paul Mundt <lethal@linux-sh.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 15/15] PM: Do not use the syscore flag for runtime PM
Date: Sun, 05 Aug 2012 23:53:11 +0000	[thread overview]
Message-ID: <201208060153.11582.rjw@sisk.pl> (raw)
In-Reply-To: <201208060138.03950.rjw@sisk.pl>


The syscore device PM flag used to mark the devices (belonging to
PM domains) that should never be turned off, except for the system
core (syscore) suspend/hibernation and resume stages, need not be
accessed by the runtime PM core functions, because all of the devices
it is set for need to be marked as "irq safe" anyway and are
protected from being turned off by runtime PM by ensuring that their
usage counters are always set.

For this reason, make the syscore flag system-wide PM-specific
and simplify the code used for manipulating it, because it need not
acquire the device's power.lock any more.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 drivers/base/power/common.c  |   15 ---------------
 drivers/base/power/domain.c  |    2 +-
 drivers/base/power/runtime.c |    2 +-
 include/linux/device.h       |    7 +++++++
 include/linux/pm.h           |    6 +-----
 5 files changed, 10 insertions(+), 22 deletions(-)

Index: linux/include/linux/pm.h
=================================--- linux.orig/include/linux/pm.h
+++ linux/include/linux/pm.h
@@ -43,12 +43,8 @@ struct device;
 
 #ifdef CONFIG_PM
 extern const char power_group_name[];		/* = "power" */
-
-extern void dev_pm_syscore_device(struct device *dev, bool val);
 #else
 #define power_group_name	NULL
-
-static inline void dev_pm_syscore_device(struct device *dev, bool val) {}
 #endif
 
 typedef struct pm_message {
@@ -515,13 +511,13 @@ struct dev_pm_info {
 	bool			is_suspended:1;	/* Ditto */
 	bool			ignore_children:1;
 	bool			early_init:1;	/* Owned by the PM core */
-	bool			syscore:1;
 	spinlock_t		lock;
 #ifdef CONFIG_PM_SLEEP
 	struct list_head	entry;
 	struct completion	completion;
 	struct wakeup_source	*wakeup;
 	bool			wakeup_path:1;
+	bool			syscore:1;
 #else
 	unsigned int		should_wakeup:1;
 #endif
Index: linux/drivers/base/power/common.c
=================================--- linux.orig/drivers/base/power/common.c
+++ linux/drivers/base/power/common.c
@@ -85,18 +85,3 @@ int dev_pm_put_subsys_data(struct device
 	return ret;
 }
 EXPORT_SYMBOL_GPL(dev_pm_put_subsys_data);
-
-/**
- * dev_pm_syscore_device - Set/unset the given device's power.syscore flag.
- * @dev: Device whose flag is to be modified.
- * @val: New value of the flag.
- */
-void dev_pm_syscore_device(struct device *dev, bool val)
-{
-	unsigned long flags;
-
-	spin_lock_irqsave(&dev->power.lock, flags);
-	dev->power.syscore = val;
-	spin_unlock_irqrestore(&dev->power.lock, flags);
-}
-EXPORT_SYMBOL_GPL(dev_pm_syscore_device);
Index: linux/drivers/base/power/runtime.c
=================================--- linux.orig/drivers/base/power/runtime.c
+++ linux/drivers/base/power/runtime.c
@@ -134,7 +134,7 @@ static int rpm_check_suspend_allowed(str
 
 	if (dev->power.runtime_error)
 		retval = -EINVAL;
-	else if (dev->power.disable_depth > 0 || dev->power.syscore)
+	else if (dev->power.disable_depth > 0)
 		retval = -EACCES;
 	else if (atomic_read(&dev->power.usage_count) > 0)
 		retval = -EAGAIN;
Index: linux/include/linux/device.h
=================================--- linux.orig/include/linux/device.h
+++ linux/include/linux/device.h
@@ -772,6 +772,13 @@ static inline void pm_suspend_ignore_chi
 	dev->power.ignore_children = enable;
 }
 
+static inline void dev_pm_syscore_device(struct device *dev, bool val)
+{
+#ifdef CONFIG_PM_SLEEP
+	dev->power.syscore = val;
+#endif
+}
+
 static inline void device_lock(struct device *dev)
 {
 	mutex_lock(&dev->mutex);
Index: linux/drivers/base/power/domain.c
=================================--- linux.orig/drivers/base/power/domain.c
+++ linux/drivers/base/power/domain.c
@@ -442,7 +442,7 @@ static int pm_genpd_poweroff(struct gene
 	not_suspended = 0;
 	list_for_each_entry(pdd, &genpd->dev_list, list_node)
 		if (pdd->dev->driver && (!pm_runtime_suspended(pdd->dev)
-		    || pdd->dev->power.irq_safe || pdd->dev->power.syscore))
+		    || pdd->dev->power.irq_safe))
 			not_suspended++;
 
 	if (not_suspended > genpd->in_progress)

      parent reply	other threads:[~2012-08-05 23:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-29 14:12 [RFC][PATCH 0/6] PM: Suspend/resume for clock sources/clock event devices in PM domains Rafael J. Wysocki
2012-07-29 14:13 ` [RFC][PATCH 1/6] PM / Domains: Introduce simplified power on routine for system resume Rafael J. Wysocki
2012-07-29 14:14 ` [RFC][PATCH 2/6] PM / Domains: Add power off/on function for system core suspend stage Rafael J. Wysocki
2012-07-29 14:15 ` [RFC][PATCH 3/6] timekeeping: Add suspend and resume of clock event devices Rafael J. Wysocki
2012-07-29 14:16 ` [RFC][PATCH 4/6] sh: TMU: Introduce clocksource/clock events suspend/resume routines Rafael J. Wysocki
2012-07-29 14:16 ` [RFC][PATCH 5/6] sh: CMT: " Rafael J. Wysocki
2012-07-29 14:17 ` [RFC][PATCH 6/6] sh: MTU2: Introduce clock " Rafael J. Wysocki
2012-08-05 23:38 ` [PATCH 0/15] PM: Suspend/resume and runtime PM for clock sources/clock event devices in PM domains Rafael J. Wysocki
2012-08-05 23:39   ` [PATCH 1/15] PM / Domains: Introduce simplified power on routine for system resume Rafael J. Wysocki
2012-08-05 23:39   ` [PATCH 2/15] PM / Domains: Add power off/on function for system core suspend stage Rafael J. Wysocki
2012-08-05 23:40   ` [PATCH 3/15] timekeeping: Add suspend and resume of clock event devices Rafael J. Wysocki
2012-08-05 23:41   ` [PATCH 4/15] sh: TMU: Introduce clocksource/clock events suspend/resume routines Rafael J. Wysocki
2012-08-05 23:43   ` [PATCH 5/15] sh: CMT: " Rafael J. Wysocki
2012-08-05 23:43   ` [PATCH 6/15] sh: MTU2: Introduce clock " Rafael J. Wysocki
2012-08-05 23:44   ` [PATCH 7/15] PM: Reorganize device PM initialization Rafael J. Wysocki
2012-08-05 23:45   ` [PATCH 8/15] PM / Runtime: Allow helpers to be called by early platform drivers Rafael J. Wysocki
2012-08-05 23:45   ` [PATCH 9/15] PM / Domains: Rename the always_on device flag to syscore Rafael J. Wysocki
2012-08-05 23:46   ` [PATCH 10/15] PM / Domains: Move syscore flag from subsys data to struct device Rafael J. Wysocki
2012-08-05 23:47   ` [PATCH 11/15] PM / Domains: Do not measure start time for "irq safe" devices Rafael J. Wysocki
2012-08-05 23:48   ` [PATCH 12/15] sh: TMU: Basic runtime PM support Rafael J. Wysocki
2012-08-05 23:48   ` [PATCH 13/15] sh: CMT: " Rafael J. Wysocki
2012-08-05 23:49   ` [PATCH 14/15] sh: MTU2: " Rafael J. Wysocki
2012-08-11  9:39     ` Geert Uytterhoeven
2012-08-11 22:29       ` Rafael J. Wysocki
2012-08-05 23:53   ` Rafael J. Wysocki [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=201208060153.11582.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=tglx@linutronix.de \
    /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).