Skip to contentSkip to conversation

PM: Use CONFIG_PM instead of CONFIG_PM_RUNTIME in core code

PATCH In review Rafael J. Wysocki 6 participants 23 messages Nov 27, 2014 – Dec 4, 2014

Subsystems (20)
ACPI PCI GPIO SPI +16 more subsystems
lore
Share & tools
lore
#0 lore raw

cover PM: Use CONFIG_PM instead of CONFIG_PM_RUNTIME in core code

Hi,

After commit b2b49ccbdd54 "PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected" (currently in Linux next) CONFIG_PM_RUNTIME is set whenever CONFIG_PM is set, so CONFIG_PM can be used in #ifdefs instead of CONFIG_PM_RUNTIME which simplifies things in quite a few cases.

For this reason, the following patches modify some core code to use CONFIG_PM instead of CONFIG_PM_RUNTIME.

[1/4] Drop a macro which is redundant after the above commit. [2/4] Use PM instead of PM_RUNTIME in the core device PM code. [3/4] Use PM instead of PM_RUNTIME in the ACPI core. [4/4] Use PM instead of PM_RUNTIME in the PCI core.

They build for me for all of the relevant combinations of options (on x86), but more testing (on the other architectures) would be welcome.

Thanks!

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#1 lore raw

PATCH 1/4 PM: Drop the SET_PM_RUNTIME_PM_OPS() macro

From: Rafael J. Wysocki <[email protected]>

The SET_PM_RUNTIME_PM_OPS() and SET_RUNTIME_PM_OPS() macros are identical except that one of them is not empty for CONFIG_PM set, while the other one is not empty for CONFIG_PM_RUNTIME set, respectively.

However, after commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so one of these macros is now redundant.

For this reason, drop SET_PM_RUNTIME_PM_OPS() and replace it with SET_RUNTIME_PM_OPS() everywhere.

---
 drivers/amba/bus.c                |    2 +-
 drivers/dma/ste_dma40.c           |    2 +-
 drivers/gpio/gpio-zynq.c          |    2 +-
 drivers/i2c/busses/i2c-hix5hd2.c  |    2 +-
 drivers/i2c/busses/i2c-nomadik.c  |    2 +-
 drivers/mmc/host/mmci.c           |    2 +-
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 drivers/mmc/host/tmio_mmc.c       |    2 +-
 drivers/spi/spi-pl022.c           |    2 +-
 include/linux/pm.h                |   11 +----------
 10 files changed, 10 insertions(+), 19 deletions(-)
drivers/amba/bus.c +1 -1
Index: linux-pm/drivers/amba/bus.c
===================================================================
@@ -124,7 +124,7 @@ static const struct dev_pm_ops amba_pm =
 	.thaw		= pm_generic_thaw,
 	.poweroff	= pm_generic_poweroff,
 	.restore	= pm_generic_restore,
-	SET_PM_RUNTIME_PM_OPS(
+	SET_RUNTIME_PM_OPS(
 		amba_pm_runtime_suspend,
 		amba_pm_runtime_resume,
 		NULL
drivers/dma/ste_dma40.c +1 -1
Index: linux-pm/drivers/dma/ste_dma40.c
===================================================================
@@ -3051,7 +3051,7 @@ static int dma40_runtime_resume(struct d
 
 static const struct dev_pm_ops dma40_pm_ops = {
 	SET_LATE_SYSTEM_SLEEP_PM_OPS(dma40_suspend, dma40_resume)
-	SET_PM_RUNTIME_PM_OPS(dma40_runtime_suspend,
+	SET_RUNTIME_PM_OPS(dma40_runtime_suspend,
 				dma40_runtime_resume,
 				NULL)
 };
drivers/gpio/gpio-zynq.c +1 -1
Index: linux-pm/drivers/gpio/gpio-zynq.c
===================================================================
@@ -578,7 +578,7 @@ static void zynq_gpio_free(struct gpio_c
 
 static const struct dev_pm_ops zynq_gpio_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(zynq_gpio_suspend, zynq_gpio_resume)
-	SET_PM_RUNTIME_PM_OPS(zynq_gpio_runtime_suspend,
+	SET_RUNTIME_PM_OPS(zynq_gpio_runtime_suspend,
 			zynq_gpio_runtime_resume, NULL)
 };
 
drivers/i2c/busses/i2c-hix5hd2.c +1 -1
Index: linux-pm/drivers/i2c/busses/i2c-hix5hd2.c
===================================================================
@@ -528,7 +528,7 @@ static int hix5hd2_i2c_runtime_resume(st
 #endif
 
 static const struct dev_pm_ops hix5hd2_i2c_pm_ops = {
-	SET_PM_RUNTIME_PM_OPS(hix5hd2_i2c_runtime_suspend,
+	SET_RUNTIME_PM_OPS(hix5hd2_i2c_runtime_suspend,
 			      hix5hd2_i2c_runtime_resume,
 			      NULL)
 };
drivers/i2c/busses/i2c-nomadik.c +1 -1
Index: linux-pm/drivers/i2c/busses/i2c-nomadik.c
===================================================================
@@ -932,7 +932,7 @@ static int nmk_i2c_runtime_resume(struct
 
 static const struct dev_pm_ops nmk_i2c_pm = {
 	SET_LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early)
-	SET_PM_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
+	SET_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
 			nmk_i2c_runtime_resume,
 			NULL)
 };
drivers/mmc/host/mmci.c +1 -1
Index: linux-pm/drivers/mmc/host/mmci.c
===================================================================
@@ -1843,7 +1843,7 @@ static int mmci_runtime_resume(struct de
 static const struct dev_pm_ops mmci_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
 				pm_runtime_force_resume)
-	SET_PM_RUNTIME_PM_OPS(mmci_runtime_suspend, mmci_runtime_resume, NULL)
+	SET_RUNTIME_PM_OPS(mmci_runtime_suspend, mmci_runtime_resume, NULL)
 };
 
 static struct amba_id mmci_ids[] = {
drivers/mmc/host/sh_mobile_sdhi.c +1 -1
Index: linux-pm/drivers/mmc/host/sh_mobile_sdhi.c
===================================================================
@@ -375,7 +375,7 @@ static int sh_mobile_sdhi_remove(struct
 static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
 			pm_runtime_force_resume)
-	SET_PM_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
+	SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
 			tmio_mmc_host_runtime_resume,
 			NULL)
 };
drivers/mmc/host/tmio_mmc.c +1 -1
Index: linux-pm/drivers/mmc/host/tmio_mmc.c
===================================================================
@@ -135,7 +135,7 @@ static int tmio_mmc_remove(struct platfo
 
 static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(tmio_mmc_suspend, tmio_mmc_resume)
-	SET_PM_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
+	SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
 			tmio_mmc_host_runtime_resume,
 			NULL)
 };
drivers/spi/spi-pl022.c +1 -1
Index: linux-pm/drivers/spi/spi-pl022.c
===================================================================
@@ -2377,7 +2377,7 @@ static int pl022_runtime_resume(struct d
 
 static const struct dev_pm_ops pl022_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(pl022_suspend, pl022_resume)
-	SET_PM_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL)
+	SET_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL)
 };
 
 static struct vendor_data vendor_arm = {
include/linux/pm.h +1 -10
Index: linux-pm/include/linux/pm.h
===================================================================
@@ -342,7 +342,7 @@ struct dev_pm_ops {
 #define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
 #endif
 
-#ifdef CONFIG_PM_RUNTIME
+#ifdef CONFIG_PM
 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
 	.runtime_suspend = suspend_fn, \
 	.runtime_resume = resume_fn, \
@@ -351,15 +351,6 @@ struct dev_pm_ops {
 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
 #endif
 
-#ifdef CONFIG_PM
-#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
-	.runtime_suspend = suspend_fn, \
-	.runtime_resume = resume_fn, \
-	.runtime_idle = idle_fn,
-#else
-#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
-#endif
-
 /*
  * Use this if you want to use the same suspend and resume callbacks for suspend
  * to RAM and hibernation.
#2 lore raw

PATCH 1/4 PM: Merge the SET*_RUNTIME_PM_OPS() macros

From: Rafael J. Wysocki <[email protected]>

The SET_PM_RUNTIME_PM_OPS() and SET_RUNTIME_PM_OPS() macros are identical except that one of them is not empty for CONFIG_PM set, while the other one is not empty for CONFIG_PM_RUNTIME set, respectively.

However, after commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so one of these macros is now redundant.

For this reason, replace SET_PM_RUNTIME_PM_OPS() with SET_RUNTIME_PM_OPS() everywhere and redefine the SET_PM_RUNTIME_PM_OPS symbol as SET_RUNTIME_PM_OPS in case new code is starting to use the macro being removed here.

---

It turns out that some new drivers are starting to use SET_PM_RUNTIME_PM_OPS, so add a #define mapping it onto SET_RUNTIME_PM_OPS for them (we'll fix that up when things settle).

---
 drivers/amba/bus.c                |    2 +-
 drivers/dma/ste_dma40.c           |    2 +-
 drivers/gpio/gpio-zynq.c          |    2 +-
 drivers/i2c/busses/i2c-hix5hd2.c  |    2 +-
 drivers/i2c/busses/i2c-nomadik.c  |    2 +-
 drivers/mmc/host/mmci.c           |    2 +-
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 drivers/mmc/host/tmio_mmc.c       |    2 +-
 drivers/spi/spi-pl022.c           |    2 +-
 include/linux/pm.h                |   11 ++---------
 10 files changed, 11 insertions(+), 18 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

drivers/amba/bus.c +1 -1
Index: linux-pm/drivers/amba/bus.c
===================================================================
@@ -124,7 +124,7 @@ static const struct dev_pm_ops amba_pm =
 	.thaw		= pm_generic_thaw,
 	.poweroff	= pm_generic_poweroff,
 	.restore	= pm_generic_restore,
-	SET_PM_RUNTIME_PM_OPS(
+	SET_RUNTIME_PM_OPS(
 		amba_pm_runtime_suspend,
 		amba_pm_runtime_resume,
 		NULL
drivers/dma/ste_dma40.c +1 -1
Index: linux-pm/drivers/dma/ste_dma40.c
===================================================================
@@ -3051,7 +3051,7 @@ static int dma40_runtime_resume(struct d
 
 static const struct dev_pm_ops dma40_pm_ops = {
 	SET_LATE_SYSTEM_SLEEP_PM_OPS(dma40_suspend, dma40_resume)
-	SET_PM_RUNTIME_PM_OPS(dma40_runtime_suspend,
+	SET_RUNTIME_PM_OPS(dma40_runtime_suspend,
 				dma40_runtime_resume,
 				NULL)
 };
drivers/gpio/gpio-zynq.c +1 -1
Index: linux-pm/drivers/gpio/gpio-zynq.c
===================================================================
@@ -578,7 +578,7 @@ static void zynq_gpio_free(struct gpio_c
 
 static const struct dev_pm_ops zynq_gpio_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(zynq_gpio_suspend, zynq_gpio_resume)
-	SET_PM_RUNTIME_PM_OPS(zynq_gpio_runtime_suspend,
+	SET_RUNTIME_PM_OPS(zynq_gpio_runtime_suspend,
 			zynq_gpio_runtime_resume, NULL)
 };
 
drivers/i2c/busses/i2c-hix5hd2.c +1 -1
Index: linux-pm/drivers/i2c/busses/i2c-hix5hd2.c
===================================================================
@@ -528,7 +528,7 @@ static int hix5hd2_i2c_runtime_resume(st
 #endif
 
 static const struct dev_pm_ops hix5hd2_i2c_pm_ops = {
-	SET_PM_RUNTIME_PM_OPS(hix5hd2_i2c_runtime_suspend,
+	SET_RUNTIME_PM_OPS(hix5hd2_i2c_runtime_suspend,
 			      hix5hd2_i2c_runtime_resume,
 			      NULL)
 };
drivers/i2c/busses/i2c-nomadik.c +1 -1
Index: linux-pm/drivers/i2c/busses/i2c-nomadik.c
===================================================================
@@ -932,7 +932,7 @@ static int nmk_i2c_runtime_resume(struct
 
 static const struct dev_pm_ops nmk_i2c_pm = {
 	SET_LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early)
-	SET_PM_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
+	SET_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
 			nmk_i2c_runtime_resume,
 			NULL)
 };
drivers/mmc/host/mmci.c +1 -1
Index: linux-pm/drivers/mmc/host/mmci.c
===================================================================
@@ -1843,7 +1843,7 @@ static int mmci_runtime_resume(struct de
 static const struct dev_pm_ops mmci_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
 				pm_runtime_force_resume)
-	SET_PM_RUNTIME_PM_OPS(mmci_runtime_suspend, mmci_runtime_resume, NULL)
+	SET_RUNTIME_PM_OPS(mmci_runtime_suspend, mmci_runtime_resume, NULL)
 };
 
 static struct amba_id mmci_ids[] = {
drivers/mmc/host/sh_mobile_sdhi.c +1 -1
Index: linux-pm/drivers/mmc/host/sh_mobile_sdhi.c
===================================================================
@@ -375,7 +375,7 @@ static int sh_mobile_sdhi_remove(struct
 static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
 			pm_runtime_force_resume)
-	SET_PM_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
+	SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
 			tmio_mmc_host_runtime_resume,
 			NULL)
 };
drivers/mmc/host/tmio_mmc.c +1 -1
Index: linux-pm/drivers/mmc/host/tmio_mmc.c
===================================================================
@@ -135,7 +135,7 @@ static int tmio_mmc_remove(struct platfo
 
 static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(tmio_mmc_suspend, tmio_mmc_resume)
-	SET_PM_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
+	SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
 			tmio_mmc_host_runtime_resume,
 			NULL)
 };
drivers/spi/spi-pl022.c +1 -1
Index: linux-pm/drivers/spi/spi-pl022.c
===================================================================
@@ -2377,7 +2377,7 @@ static int pl022_runtime_resume(struct d
 
 static const struct dev_pm_ops pl022_dev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(pl022_suspend, pl022_resume)
-	SET_PM_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL)
+	SET_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL)
 };
 
 static struct vendor_data vendor_arm = {
include/linux/pm.h +2 -9
Index: linux-pm/include/linux/pm.h
===================================================================
@@ -342,7 +342,7 @@ struct dev_pm_ops {
 #define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
 #endif
 
-#ifdef CONFIG_PM_RUNTIME
+#ifdef CONFIG_PM
 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
 	.runtime_suspend = suspend_fn, \
 	.runtime_resume = resume_fn, \
@@ -351,14 +351,7 @@ struct dev_pm_ops {
 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
 #endif
 
-#ifdef CONFIG_PM
-#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
-	.runtime_suspend = suspend_fn, \
-	.runtime_resume = resume_fn, \
-	.runtime_idle = idle_fn,
-#else
-#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
-#endif
+#define SET_PM_RUNTIME_PM_OPS	SET_RUNTIME_PM_OPS
 
 /*
  * Use this if you want to use the same suspend and resume callbacks for suspend
#3 lore raw

Re: [Replacement][PATCH 1/4] PM: Merge the SET*_RUNTIME_PM_OPS() macros

Quoted 7 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The SET_PM_RUNTIME_PM_OPS() and SET_RUNTIME_PM_OPS() macros are identical except that one of them is not empty for CONFIG_PM set, while the other one is not empty for CONFIG_PM_RUNTIME set, respectively.

Quoted 8 lines

However, after commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so one of these macros is now redundant.

For this reason, replace SET_PM_RUNTIME_PM_OPS() with SET_RUNTIME_PM_OPS() everywhere and redefine the SET_PM_RUNTIME_PM_OPS symbol as SET_RUNTIME_PM_OPS in case new code is starting to use the macro being removed here.

It turns out that I need to defer this one, because it breaks builds for CONFIG_PM selected without CONFIG_PM_SLEEP or CONFIG_PM_RUNTIME (which is arguably invalid, but some defconfigs evidently do that).

I need to fix those defconfigs first.

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#4 lore raw

Re: [PATCH 1/4] PM: Drop the SET_PM_RUNTIME_PM_OPS() macro

In reply to Rafael J. Wysocki
Quoted 7 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The SET_PM_RUNTIME_PM_OPS() and SET_RUNTIME_PM_OPS() macros are identical except that one of them is not empty for CONFIG_PM set, while the other one is not empty for CONFIG_PM_RUNTIME set, respectively.

Quoted 6 lines

However, after commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so one of these macros is now redundant.

For this reason, drop SET_PM_RUNTIME_PM_OPS() and replace it with SET_RUNTIME_PM_OPS() everywhere.

Hi Rafael,

Apparently, I have queued an mmc patch in my mmc tree, which means one mmc driver starts using the SET_PM_RUNTIME_PM_OPS macro. It should cause a build error in linux-next with @subject patch.

I have shared that patch through an immutable branch, I have also checked potential conflicts and it shouldn't be any problems to pull that in to your tree. Then you can fix $subject patch by also converting the mmc driver to use SET_RUNTIME_PM_OPS macro.

The branch is available at:
git://git.linaro.org/people/ulf.hansson/mmc.git mmc_for_linux_pm

Kind regards
Uffe

Quoted 162 lines
---
 drivers/amba/bus.c                |    2 +-
 drivers/dma/ste_dma40.c           |    2 +-
 drivers/gpio/gpio-zynq.c          |    2 +-
 drivers/i2c/busses/i2c-hix5hd2.c  |    2 +-
 drivers/i2c/busses/i2c-nomadik.c  |    2 +-
 drivers/mmc/host/mmci.c           |    2 +-
 drivers/mmc/host/sh_mobile_sdhi.c |    2 +-
 drivers/mmc/host/tmio_mmc.c       |    2 +-
 drivers/spi/spi-pl022.c           |    2 +-
 include/linux/pm.h                |   11 +----------
 10 files changed, 10 insertions(+), 19 deletions(-)

Index: linux-pm/drivers/amba/bus.c
===================================================================

drivers/amba/bus.c +1 -1
@@ -124,7 +124,7 @@ static const struct dev_pm_ops amba_pm =
        .thaw           = pm_generic_thaw,
        .poweroff       = pm_generic_poweroff,
        .restore        = pm_generic_restore,
-       SET_PM_RUNTIME_PM_OPS(
+       SET_RUNTIME_PM_OPS(
                amba_pm_runtime_suspend,
                amba_pm_runtime_resume,
                NULL

Index: linux-pm/drivers/dma/ste_dma40.c
===================================================================

drivers/dma/ste_dma40.c +1 -1
@@ -3051,7 +3051,7 @@ static int dma40_runtime_resume(struct d
 
 static const struct dev_pm_ops dma40_pm_ops = {
        SET_LATE_SYSTEM_SLEEP_PM_OPS(dma40_suspend, dma40_resume)
-       SET_PM_RUNTIME_PM_OPS(dma40_runtime_suspend,
+       SET_RUNTIME_PM_OPS(dma40_runtime_suspend,
                                dma40_runtime_resume,
                                NULL)
 };

Index: linux-pm/drivers/gpio/gpio-zynq.c
===================================================================

drivers/gpio/gpio-zynq.c +1 -1
@@ -578,7 +578,7 @@ static void zynq_gpio_free(struct gpio_c
 
 static const struct dev_pm_ops zynq_gpio_dev_pm_ops = {
        SET_SYSTEM_SLEEP_PM_OPS(zynq_gpio_suspend, zynq_gpio_resume)
-       SET_PM_RUNTIME_PM_OPS(zynq_gpio_runtime_suspend,
+       SET_RUNTIME_PM_OPS(zynq_gpio_runtime_suspend,
                        zynq_gpio_runtime_resume, NULL)
 };
 

Index: linux-pm/drivers/i2c/busses/i2c-hix5hd2.c
===================================================================

drivers/i2c/busses/i2c-hix5hd2.c +1 -1
@@ -528,7 +528,7 @@ static int hix5hd2_i2c_runtime_resume(st
 #endif
 
 static const struct dev_pm_ops hix5hd2_i2c_pm_ops = {
-       SET_PM_RUNTIME_PM_OPS(hix5hd2_i2c_runtime_suspend,
+       SET_RUNTIME_PM_OPS(hix5hd2_i2c_runtime_suspend,
                              hix5hd2_i2c_runtime_resume,
                              NULL)
 };

Index: linux-pm/drivers/i2c/busses/i2c-nomadik.c
===================================================================

drivers/i2c/busses/i2c-nomadik.c +1 -1
@@ -932,7 +932,7 @@ static int nmk_i2c_runtime_resume(struct
 
 static const struct dev_pm_ops nmk_i2c_pm = {
        SET_LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early)
-       SET_PM_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
+       SET_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend,
                        nmk_i2c_runtime_resume,
                        NULL)
 };

Index: linux-pm/drivers/mmc/host/mmci.c
===================================================================

drivers/mmc/host/mmci.c +1 -1
@@ -1843,7 +1843,7 @@ static int mmci_runtime_resume(struct de
 static const struct dev_pm_ops mmci_dev_pm_ops = {
        SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
                                pm_runtime_force_resume)
-       SET_PM_RUNTIME_PM_OPS(mmci_runtime_suspend, mmci_runtime_resume, NULL)
+       SET_RUNTIME_PM_OPS(mmci_runtime_suspend, mmci_runtime_resume, NULL)
 };
 
 static struct amba_id mmci_ids[] = {

Index: linux-pm/drivers/mmc/host/sh_mobile_sdhi.c
===================================================================

drivers/mmc/host/sh_mobile_sdhi.c +1 -1
@@ -375,7 +375,7 @@ static int sh_mobile_sdhi_remove(struct
 static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
        SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
                        pm_runtime_force_resume)
-       SET_PM_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
+       SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
                        tmio_mmc_host_runtime_resume,
                        NULL)
 };

Index: linux-pm/drivers/mmc/host/tmio_mmc.c
===================================================================

drivers/mmc/host/tmio_mmc.c +1 -1
@@ -135,7 +135,7 @@ static int tmio_mmc_remove(struct platfo
 
 static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
        SET_SYSTEM_SLEEP_PM_OPS(tmio_mmc_suspend, tmio_mmc_resume)
-       SET_PM_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
+       SET_RUNTIME_PM_OPS(tmio_mmc_host_runtime_suspend,
                        tmio_mmc_host_runtime_resume,
                        NULL)
 };

Index: linux-pm/drivers/spi/spi-pl022.c
===================================================================

drivers/spi/spi-pl022.c +1 -1
@@ -2377,7 +2377,7 @@ static int pl022_runtime_resume(struct d
 
 static const struct dev_pm_ops pl022_dev_pm_ops = {
        SET_SYSTEM_SLEEP_PM_OPS(pl022_suspend, pl022_resume)
-       SET_PM_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL)
+       SET_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL)
 };
 
 static struct vendor_data vendor_arm = {

Index: linux-pm/include/linux/pm.h
===================================================================

include/linux/pm.h +1 -10
@@ -342,7 +342,7 @@ struct dev_pm_ops {
 #define SET_LATE_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
 #endif
 
-#ifdef CONFIG_PM_RUNTIME
+#ifdef CONFIG_PM
 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
        .runtime_suspend = suspend_fn, \
        .runtime_resume = resume_fn, \
@@ -351,15 +351,6 @@ struct dev_pm_ops {
 #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
 #endif
 
-#ifdef CONFIG_PM
-#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \
-       .runtime_suspend = suspend_fn, \
-       .runtime_resume = resume_fn, \
-       .runtime_idle = idle_fn,
-#else
-#define SET_PM_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn)
-#endif
-
 /*
  * Use this if you want to use the same suspend and resume callbacks for suspend
  * to RAM and hibernation.
#5 lore raw

Re: [PATCH 1/4] PM: Drop the SET_PM_RUNTIME_PM_OPS() macro

Quoted 21 lines · Ulf Hansson
Quoted 7 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The SET_PM_RUNTIME_PM_OPS() and SET_RUNTIME_PM_OPS() macros are identical except that one of them is not empty for CONFIG_PM set, while the other one is not empty for CONFIG_PM_RUNTIME set, respectively.

Quoted 6 lines

However, after commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so one of these macros is now redundant.

For this reason, drop SET_PM_RUNTIME_PM_OPS() and replace it with SET_RUNTIME_PM_OPS() everywhere.

Hi Rafael,

Apparently, I have queued an mmc patch in my mmc tree, which means one mmc driver starts using the SET_PM_RUNTIME_PM_OPS macro. It should cause a build error in linux-next with @subject patch.

Quoted 7 lines

I have shared that patch through an immutable branch, I have also checked potential conflicts and it shouldn't be any problems to pull that in to your tree. Then you can fix $subject patch by also converting the mmc driver to use SET_RUNTIME_PM_OPS macro.

The branch is available at:
git://git.linaro.org/people/ulf.hansson/mmc.git mmc_for_linux_pm

Thanks for letting me know!

What about adding the following line to the $subject patch instead:

#define SET_PM_RUNTIME_PM_OPS SET_RUNTIME_PM_OPS

and fixing things up when all has been merged?

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#6 lore raw

Re: [PATCH 1/4] PM: Drop the SET_PM_RUNTIME_PM_OPS() macro

Quoted 30 lines · Rafael J. Wysocki
Quoted 21 lines · Ulf Hansson
Quoted 7 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The SET_PM_RUNTIME_PM_OPS() and SET_RUNTIME_PM_OPS() macros are identical except that one of them is not empty for CONFIG_PM set, while the other one is not empty for CONFIG_PM_RUNTIME set, respectively.

Quoted 6 lines

However, after commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so one of these macros is now redundant.

For this reason, drop SET_PM_RUNTIME_PM_OPS() and replace it with SET_RUNTIME_PM_OPS() everywhere.

Hi Rafael,

Apparently, I have queued an mmc patch in my mmc tree, which means one mmc driver starts using the SET_PM_RUNTIME_PM_OPS macro. It should cause a build error in linux-next with @subject patch.

Quoted 7 lines

I have shared that patch through an immutable branch, I have also checked potential conflicts and it shouldn't be any problems to pull that in to your tree. Then you can fix $subject patch by also converting the mmc driver to use SET_RUNTIME_PM_OPS macro.

The branch is available at:
git://git.linaro.org/people/ulf.hansson/mmc.git mmc_for_linux_pm

Quoted 7 lines

Thanks for letting me know!

What about adding the following line to the $subject patch instead:

#define SET_PM_RUNTIME_PM_OPS SET_RUNTIME_PM_OPS

and fixing things up when all has been merged?

That's an option.

On the other hand we will have a window of new users of SET_PM_RUNTIME_PM_OPS, during the next release cycle. Or are you saying that we should send fixes for the rc which takes care of the removal of it?

Kind regards
Uffe

Quoted 5 lines

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

#7 lore raw

Re: [PATCH 1/4] PM: Drop the SET_PM_RUNTIME_PM_OPS() macro

Quoted 37 lines · Ulf Hansson
Quoted 36 lines · Rafael J. Wysocki
Quoted 21 lines · Ulf Hansson
Quoted 7 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The SET_PM_RUNTIME_PM_OPS() and SET_RUNTIME_PM_OPS() macros are identical except that one of them is not empty for CONFIG_PM set, while the other one is not empty for CONFIG_PM_RUNTIME set, respectively.

Quoted 6 lines

However, after commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so one of these macros is now redundant.

For this reason, drop SET_PM_RUNTIME_PM_OPS() and replace it with SET_RUNTIME_PM_OPS() everywhere.

Hi Rafael,

Apparently, I have queued an mmc patch in my mmc tree, which means one mmc driver starts using the SET_PM_RUNTIME_PM_OPS macro. It should cause a build error in linux-next with @subject patch.

Quoted 7 lines

I have shared that patch through an immutable branch, I have also checked potential conflicts and it shouldn't be any problems to pull that in to your tree. Then you can fix $subject patch by also converting the mmc driver to use SET_RUNTIME_PM_OPS macro.

The branch is available at:
git://git.linaro.org/people/ulf.hansson/mmc.git mmc_for_linux_pm

Thanks for letting me know!

What about adding the following line to the $subject patch instead:

#define SET_PM_RUNTIME_PM_OPS SET_RUNTIME_PM_OPS

Quoted 8 lines
Quoted 1 line

and fixing things up when all has been merged?

That's an option.

On the other hand we will have a window of new users of SET_PM_RUNTIME_PM_OPS, during the next release cycle. Or are you saying that we should send fixes for the rc which takes care of the removal of it?

That is my plan.

It is quite usual for new users of stuff being reworked to appear at the same time and that can always be addressed by doing a second round of replacements after the merge window.

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#8 lore raw

PATCH 2/4 PM: Drop CONFIG_PM_RUNTIME from the driver core

In reply to Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so quite a few #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM or even may be dropped entirely in some cases.

Replace CONFIG_PM_RUNTIME with CONFIG_PM in the PM core code.

---
 drivers/base/power/clock_ops.c       |   69 +----------------------------------
 drivers/base/power/domain.c          |   34 +----------------
 drivers/base/power/domain_governor.c |   11 -----
 drivers/base/power/power.h           |   56 ++++++++++++----------------
 drivers/base/power/qos.c             |    5 --
 drivers/base/power/runtime.c         |    9 ----
 drivers/base/power/sysfs.c           |   19 ---------
 include/linux/pm.h                   |    2 -
 include/linux/pm_domain.h            |    8 +---
 include/linux/pm_qos.h               |   38 ++++++++-----------
 include/linux/pm_runtime.h           |   21 ++++------
 kernel/power/Kconfig                 |    4 --
 12 files changed, 60 insertions(+), 216 deletions(-)
include/linux/pm.h +1 -1
Index: linux-pm/include/linux/pm.h
===================================================================
@@ -563,7 +563,7 @@ struct dev_pm_info {
 #else
 	unsigned int		should_wakeup:1;
 #endif
-#ifdef CONFIG_PM_RUNTIME
+#ifdef CONFIG_PM
 	struct timer_list	suspend_timer;
 	unsigned long		timer_expires;
 	struct work_struct	work;
include/linux/pm_runtime.h +9 -12
Index: linux-pm/include/linux/pm_runtime.h
===================================================================
@@ -35,16 +35,6 @@ extern int pm_generic_runtime_suspend(st
 extern int pm_generic_runtime_resume(struct device *dev);
 extern int pm_runtime_force_suspend(struct device *dev);
 extern int pm_runtime_force_resume(struct device *dev);
-#else
-static inline bool queue_pm_work(struct work_struct *work) { return false; }
-
-static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
-static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
-static inline int pm_runtime_force_suspend(struct device *dev) { return 0; }
-static inline int pm_runtime_force_resume(struct device *dev) { return 0; }
-#endif
-
-#ifdef CONFIG_PM_RUNTIME
 
 extern int __pm_runtime_idle(struct device *dev, int rpmflags);
 extern int __pm_runtime_suspend(struct device *dev, int rpmflags);
@@ -128,7 +118,14 @@ static inline void pm_runtime_mark_last_
 	ACCESS_ONCE(dev->power.last_busy) = jiffies;
 }
 
-#else /* !CONFIG_PM_RUNTIME */
+#else /* !CONFIG_PM */
+
+static inline bool queue_pm_work(struct work_struct *work) { return false; }
+
+static inline int pm_generic_runtime_suspend(struct device *dev) { return 0; }
+static inline int pm_generic_runtime_resume(struct device *dev) { return 0; }
+static inline int pm_runtime_force_suspend(struct device *dev) { return 0; }
+static inline int pm_runtime_force_resume(struct device *dev) { return 0; }
 
 static inline int __pm_runtime_idle(struct device *dev, int rpmflags)
 {
@@ -179,7 +176,7 @@ static inline unsigned long pm_runtime_a
 static inline void pm_runtime_set_memalloc_noio(struct device *dev,
 						bool enable){}
 
-#endif /* !CONFIG_PM_RUNTIME */
+#endif /* !CONFIG_PM */
 
 static inline int pm_runtime_idle(struct device *dev)
 {
drivers/base/power/power.h +25 -31

77 lines not on this page · raw message

drivers/base/power/clock_ops.c +2 -67

87 lines not on this page · raw message

drivers/base/power/domain.c +3 -31
Index: linux-pm/drivers/base/power/domain.c
===================================================================
@@ -317,8 +317,6 @@ int pm_genpd_name_poweron(const char *do
 	return genpd ? pm_genpd_poweron(genpd) : -EINVAL;
 }
 
-#ifdef CONFIG_PM_RUNTIME
-
 static int genpd_start_dev_no_timing(struct generic_pm_domain *genpd,
 				     struct device *dev)
 {
@@ -777,24 +775,6 @@ static int __init genpd_poweroff_unused(
 }
 late_initcall(genpd_poweroff_unused);
 
-#else
-
-static inline int genpd_dev_pm_qos_notifier(struct notifier_block *nb,
-					    unsigned long val, void *ptr)
-{
-	return NOTIFY_DONE;
-}
-
-static inline void
-genpd_queue_power_off_work(struct generic_pm_domain *genpd) {}
-
-static inline void genpd_power_off_work_fn(struct work_struct *work) {}
-
-#define pm_genpd_runtime_suspend	NULL
-#define pm_genpd_runtime_resume		NULL
-
-#endif /* CONFIG_PM_RUNTIME */
-
 #ifdef CONFIG_PM_SLEEP
 
 /**
@@ -1383,7 +1363,7 @@ void pm_genpd_syscore_poweron(struct dev
 }
 EXPORT_SYMBOL_GPL(pm_genpd_syscore_poweron);
 
-#else
+#else /* !CONFIG_PM_SLEEP */
 
 #define pm_genpd_prepare		NULL
 #define pm_genpd_suspend		NULL
@@ -2240,7 +2220,7 @@ int genpd_dev_pm_attach(struct device *d
 	return 0;
 }
 EXPORT_SYMBOL_GPL(genpd_dev_pm_attach);
-#endif
+#endif /* CONFIG_PM_GENERIC_DOMAINS_OF */
 
 
 /***        debugfs support        ***/
@@ -2256,10 +2236,8 @@ static struct dentry *pm_genpd_debugfs_d
 
 /*
  * TODO: This function is a slightly modified version of rtpm_status_show
- * from sysfs.c, but dependencies between PM_GENERIC_DOMAINS and PM_RUNTIME
- * are too loose to generalize it.
+ * from sysfs.c, so generalize it.
  */
-#ifdef CONFIG_PM_RUNTIME
 static void rtpm_status_str(struct seq_file *s, struct device *dev)
 {
 	static const char * const status_lookup[] = {
@@ -2281,12 +2259,6 @@ static void rtpm_status_str(struct seq_f
 
 	seq_puts(s, p);
 }
-#else
-static void rtpm_status_str(struct seq_file *s, struct device *dev)
-{
-	seq_puts(s, "active");
-}
-#endif
 
 static int pm_genpd_summary_one(struct seq_file *s,
 		struct generic_pm_domain *gpd)
drivers/base/power/domain_governor.c +0 -11
Index: linux-pm/drivers/base/power/domain_governor.c
===================================================================
@@ -11,8 +11,6 @@
 #include <linux/pm_qos.h>
 #include <linux/hrtimer.h>
 
-#ifdef CONFIG_PM_RUNTIME
-
 static int dev_update_qos_constraint(struct device *dev, void *data)
 {
 	s64 *constraint_ns_p = data;
@@ -227,15 +225,6 @@ static bool always_on_power_down_ok(stru
 	return false;
 }
 
-#else /* !CONFIG_PM_RUNTIME */
-
-static inline bool default_stop_ok(struct device *dev) { return false; }
-
-#define default_power_down_ok	NULL
-#define always_on_power_down_ok	NULL
-
-#endif /* !CONFIG_PM_RUNTIME */
-
 struct dev_power_governor simple_qos_governor = {
 	.stop_ok = default_stop_ok,
 	.power_down_ok = default_power_down_ok,
drivers/base/power/qos.c +0 -5
Index: linux-pm/drivers/base/power/qos.c
===================================================================
@@ -599,7 +599,6 @@ int dev_pm_qos_add_ancestor_request(stru
 }
 EXPORT_SYMBOL_GPL(dev_pm_qos_add_ancestor_request);
 
-#ifdef CONFIG_PM_RUNTIME
 static void __dev_pm_qos_drop_user_request(struct device *dev,
 					   enum dev_pm_qos_req_type type)
 {
@@ -880,7 +879,3 @@ int dev_pm_qos_update_user_latency_toler
 	mutex_unlock(&dev_pm_qos_mtx);
 	return ret;
 }
-#else /* !CONFIG_PM_RUNTIME */
-static void __dev_pm_qos_hide_latency_limit(struct device *dev) {}
-static void __dev_pm_qos_hide_flags(struct device *dev) {}
-#endif /* CONFIG_PM_RUNTIME */
drivers/base/power/runtime.c +0 -9
Index: linux-pm/drivers/base/power/runtime.c
===================================================================
@@ -45,8 +45,6 @@ static pm_callback_t __rpm_get_callback(
 #define RPM_GET_CALLBACK(dev, callback) \
 		__rpm_get_callback(dev, offsetof(struct dev_pm_ops, callback))
 
-#ifdef CONFIG_PM_RUNTIME
-
 static int rpm_resume(struct device *dev, int rpmflags);
 static int rpm_suspend(struct device *dev, int rpmflags);
 
@@ -1399,7 +1397,6 @@ void pm_runtime_remove(struct device *de
 	if (dev->power.irq_safe && dev->parent)
 		pm_runtime_put(dev->parent);
 }
-#endif
 
 /**
  * pm_runtime_force_suspend - Force a device into suspend state if needed.
@@ -1419,12 +1416,6 @@ int pm_runtime_force_suspend(struct devi
 	int ret = 0;
 
 	pm_runtime_disable(dev);
-
-	/*
-	 * Note that pm_runtime_status_suspended() returns false while
-	 * !CONFIG_PM_RUNTIME, which means the device will be put into low
-	 * power state.
-	 */
 	if (pm_runtime_status_suspended(dev))
 		return 0;
 
drivers/base/power/sysfs.c +1 -18
Index: linux-pm/drivers/base/power/sysfs.c
===================================================================
@@ -95,7 +95,6 @@
 const char power_group_name[] = "power";
 EXPORT_SYMBOL_GPL(power_group_name);
 
-#ifdef CONFIG_PM_RUNTIME
 static const char ctrl_auto[] = "auto";
 static const char ctrl_on[] = "on";
 
@@ -330,7 +329,6 @@ static ssize_t pm_qos_remote_wakeup_stor
 
 static DEVICE_ATTR(pm_qos_remote_wakeup, 0644,
 		   pm_qos_remote_wakeup_show, pm_qos_remote_wakeup_store);
-#endif /* CONFIG_PM_RUNTIME */
 
 #ifdef CONFIG_PM_SLEEP
 static const char _enabled[] = "enabled";
@@ -531,8 +529,6 @@ static DEVICE_ATTR(wakeup_prevent_sleep_
 #endif /* CONFIG_PM_SLEEP */
 
 #ifdef CONFIG_PM_ADVANCED_DEBUG
-#ifdef CONFIG_PM_RUNTIME
-
 static ssize_t rtpm_usagecount_show(struct device *dev,
 				    struct device_attribute *attr, char *buf)
 {
@@ -562,10 +558,7 @@ static DEVICE_ATTR(runtime_usage, 0444,
 static DEVICE_ATTR(runtime_active_kids, 0444, rtpm_children_show, NULL);
 static DEVICE_ATTR(runtime_enabled, 0444, rtpm_enabled_show, NULL);
 
-#endif
-
 #ifdef CONFIG_PM_SLEEP
-
 static ssize_t async_show(struct device *dev, struct device_attribute *attr,
 			  char *buf)
 {
@@ -595,7 +588,7 @@ static ssize_t async_store(struct device
 
 static DEVICE_ATTR(async, 0644, async_show, async_store);
 
-#endif
+#endif /* CONFIG_PM_SLEEP */
 #endif /* CONFIG_PM_ADVANCED_DEBUG */
 
 static struct attribute *power_attrs[] = {
@@ -603,12 +596,10 @@ static struct attribute *power_attrs[] =
 #ifdef CONFIG_PM_SLEEP
 	&dev_attr_async.attr,
 #endif
-#ifdef CONFIG_PM_RUNTIME
 	&dev_attr_runtime_status.attr,
 	&dev_attr_runtime_usage.attr,
 	&dev_attr_runtime_active_kids.attr,
 	&dev_attr_runtime_enabled.attr,
-#endif
 #endif /* CONFIG_PM_ADVANCED_DEBUG */
 	NULL,
 };
@@ -640,7 +631,6 @@ static struct attribute_group pm_wakeup_
 };
 
 static struct attribute *runtime_attrs[] = {
-#ifdef CONFIG_PM_RUNTIME
 #ifndef CONFIG_PM_ADVANCED_DEBUG
 	&dev_attr_runtime_status.attr,
 #endif
@@ -648,7 +638,6 @@ static struct attribute *runtime_attrs[]
 	&dev_attr_runtime_suspended_time.attr,
 	&dev_attr_runtime_active_time.attr,
 	&dev_attr_autosuspend_delay_ms.attr,
-#endif /* CONFIG_PM_RUNTIME */
 	NULL,
 };
 static struct attribute_group pm_runtime_attr_group = {
@@ -657,9 +646,7 @@ static struct attribute_group pm_runtime
 };
 
 static struct attribute *pm_qos_resume_latency_attrs[] = {
-#ifdef CONFIG_PM_RUNTIME
 	&dev_attr_pm_qos_resume_latency_us.attr,
-#endif /* CONFIG_PM_RUNTIME */
 	NULL,
 };
 static struct attribute_group pm_qos_resume_latency_attr_group = {
@@ -668,9 +655,7 @@ static struct attribute_group pm_qos_res
 };
 
 static struct attribute *pm_qos_latency_tolerance_attrs[] = {
-#ifdef CONFIG_PM_RUNTIME
 	&dev_attr_pm_qos_latency_tolerance_us.attr,
-#endif /* CONFIG_PM_RUNTIME */
 	NULL,
 };
 static struct attribute_group pm_qos_latency_tolerance_attr_group = {
@@ -679,10 +664,8 @@ static struct attribute_group pm_qos_lat
 };
 
 static struct attribute *pm_qos_flags_attrs[] = {
-#ifdef CONFIG_PM_RUNTIME
 	&dev_attr_pm_qos_no_power_off.attr,
 	&dev_attr_pm_qos_remote_wakeup.attr,
-#endif /* CONFIG_PM_RUNTIME */
 	NULL,
 };
 static struct attribute_group pm_qos_flags_attr_group = {
include/linux/pm_domain.h +2 -6
Index: linux-pm/include/linux/pm_domain.h
===================================================================
@@ -152,6 +152,7 @@ extern void pm_genpd_init(struct generic
 
 extern int pm_genpd_poweron(struct generic_pm_domain *genpd);
 extern int pm_genpd_name_poweron(const char *domain_name);
+extern void pm_genpd_poweroff_unused(void);
 
 extern struct dev_power_governor simple_qos_governor;
 extern struct dev_power_governor pm_domain_always_on_gov;
@@ -226,6 +227,7 @@ static inline int pm_genpd_name_poweron(
 {
 	return -ENOSYS;
 }
+static inline void pm_genpd_poweroff_unused(void) {}
 #define simple_qos_governor NULL
 #define pm_domain_always_on_gov NULL
 #endif
@@ -242,12 +244,6 @@ static inline int pm_genpd_name_add_devi
 	return __pm_genpd_name_add_device(domain_name, dev, NULL);
 }
 
-#ifdef CONFIG_PM_GENERIC_DOMAINS_RUNTIME
-extern void pm_genpd_poweroff_unused(void);
-#else
-static inline void pm_genpd_poweroff_unused(void) {}
-#endif
-
 #ifdef CONFIG_PM_GENERIC_DOMAINS_SLEEP
 extern void pm_genpd_syscore_poweroff(struct device *dev);
 extern void pm_genpd_syscore_poweron(struct device *dev);
kernel/power/Kconfig +0 -4
Index: linux-pm/kernel/power/Kconfig
===================================================================
@@ -298,10 +298,6 @@ config PM_GENERIC_DOMAINS_SLEEP
 	def_bool y
 	depends on PM_SLEEP && PM_GENERIC_DOMAINS
 
-config PM_GENERIC_DOMAINS_RUNTIME
-	def_bool y
-	depends on PM_RUNTIME && PM_GENERIC_DOMAINS
-
 config PM_GENERIC_DOMAINS_OF
 	def_bool y
 	depends on PM_GENERIC_DOMAINS && OF
include/linux/pm_qos.h +17 -21
Index: linux-pm/include/linux/pm_qos.h
===================================================================
@@ -154,6 +154,23 @@ void dev_pm_qos_constraints_destroy(stru
 int dev_pm_qos_add_ancestor_request(struct device *dev,
 				    struct dev_pm_qos_request *req,
 				    enum dev_pm_qos_req_type type, s32 value);
+int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value);
+void dev_pm_qos_hide_latency_limit(struct device *dev);
+int dev_pm_qos_expose_flags(struct device *dev, s32 value);
+void dev_pm_qos_hide_flags(struct device *dev);
+int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set);
+s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev);
+int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val);
+
+static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev)
+{
+	return dev->power.qos->resume_latency_req->data.pnode.prio;
+}
+
+static inline s32 dev_pm_qos_requested_flags(struct device *dev)
+{
+	return dev->power.qos->flags_req->data.flr.flags;
+}
 #else
 static inline enum pm_qos_flags_status __dev_pm_qos_flags(struct device *dev,
 							  s32 mask)
@@ -200,27 +217,6 @@ static inline int dev_pm_qos_add_ancesto
 						  enum dev_pm_qos_req_type type,
 						  s32 value)
 			{ return 0; }
-#endif
-
-#ifdef CONFIG_PM_RUNTIME
-int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value);
-void dev_pm_qos_hide_latency_limit(struct device *dev);
-int dev_pm_qos_expose_flags(struct device *dev, s32 value);
-void dev_pm_qos_hide_flags(struct device *dev);
-int dev_pm_qos_update_flags(struct device *dev, s32 mask, bool set);
-s32 dev_pm_qos_get_user_latency_tolerance(struct device *dev);
-int dev_pm_qos_update_user_latency_tolerance(struct device *dev, s32 val);
-
-static inline s32 dev_pm_qos_requested_resume_latency(struct device *dev)
-{
-	return dev->power.qos->resume_latency_req->data.pnode.prio;
-}
-
-static inline s32 dev_pm_qos_requested_flags(struct device *dev)
-{
-	return dev->power.qos->flags_req->data.flr.flags;
-}
-#else
 static inline int dev_pm_qos_expose_latency_limit(struct device *dev, s32 value)
 			{ return 0; }
 static inline void dev_pm_qos_hide_latency_limit(struct device *dev) {}
#9 lore raw

PATCH 3/4 ACPI / PM: Drop CONFIG_PM_RUNTIME from the ACPI core

In reply to Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so quite a few #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM.

Replace CONFIG_PM_RUNTIME with CONFIG_PM in the ACPI core code.

---
 drivers/acpi/acpi_lpss.c |    4 +---
 drivers/acpi/device_pm.c |    8 ++------
 drivers/acpi/pci_irq.c   |    2 +-
 include/linux/acpi.h     |   26 +++++++++++---------------
 4 files changed, 15 insertions(+), 25 deletions(-)
drivers/acpi/acpi_lpss.c +1 -3
Index: linux-pm/drivers/acpi/acpi_lpss.c
===================================================================
@@ -588,7 +588,6 @@ static int acpi_lpss_resume_early(struct
 }
 #endif /* CONFIG_PM_SLEEP */
 
-#ifdef CONFIG_PM_RUNTIME
 static int acpi_lpss_runtime_suspend(struct device *dev)
 {
 	struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
@@ -631,11 +630,11 @@ static int acpi_lpss_runtime_resume(stru
 
 	return pm_generic_runtime_resume(dev);
 }
-#endif /* CONFIG_PM_RUNTIME */
 #endif /* CONFIG_PM */
 
 static struct dev_pm_domain acpi_lpss_pm_domain = {
 	.ops = {
+#ifdef CONFIG_PM
 #ifdef CONFIG_PM_SLEEP
 		.prepare = acpi_subsys_prepare,
 		.complete = acpi_subsys_complete,
@@ -647,7 +646,6 @@ static struct dev_pm_domain acpi_lpss_pm
 		.poweroff_late = acpi_lpss_suspend_late,
 		.restore_early = acpi_lpss_resume_early,
 #endif
-#ifdef CONFIG_PM_RUNTIME
 		.runtime_suspend = acpi_lpss_runtime_suspend,
 		.runtime_resume = acpi_lpss_runtime_resume,
 #endif
drivers/acpi/pci_irq.c +1 -1
Index: linux-pm/drivers/acpi/pci_irq.c
===================================================================
@@ -484,7 +484,7 @@ void acpi_pci_irq_disable(struct pci_dev
 	/* Keep IOAPIC pin configuration when suspending */
 	if (dev->dev.power.is_prepared)
 		return;
-#ifdef	CONFIG_PM_RUNTIME
+#ifdef	CONFIG_PM
 	if (dev->dev.power.runtime_status == RPM_SUSPENDING)
 		return;
 #endif
drivers/acpi/device_pm.c +2 -6
Index: linux-pm/drivers/acpi/device_pm.c
===================================================================
@@ -692,7 +692,6 @@ static int acpi_device_wakeup(struct acp
 	return 0;
 }
 
-#ifdef CONFIG_PM_RUNTIME
 /**
  * acpi_pm_device_run_wake - Enable/disable remote wakeup for given device.
  * @dev: Device to enable/disable the platform to wake up.
@@ -714,7 +713,6 @@ int acpi_pm_device_run_wake(struct devic
 	return acpi_device_wakeup(adev, ACPI_STATE_S0, enable);
 }
 EXPORT_SYMBOL(acpi_pm_device_run_wake);
-#endif /* CONFIG_PM_RUNTIME */
 
 #ifdef CONFIG_PM_SLEEP
 /**
@@ -773,7 +771,6 @@ static int acpi_dev_pm_full_power(struct
 		acpi_device_set_power(adev, ACPI_STATE_D0) : 0;
 }
 
-#ifdef CONFIG_PM_RUNTIME
 /**
  * acpi_dev_runtime_suspend - Put device into a low-power state using ACPI.
  * @dev: Device to put into a low-power state.
@@ -855,7 +852,6 @@ int acpi_subsys_runtime_resume(struct de
 	return ret ? ret : pm_generic_runtime_resume(dev);
 }
 EXPORT_SYMBOL_GPL(acpi_subsys_runtime_resume);
-#endif /* CONFIG_PM_RUNTIME */
 
 #ifdef CONFIG_PM_SLEEP
 /**
@@ -1023,10 +1019,9 @@ EXPORT_SYMBOL_GPL(acpi_subsys_freeze);
 
 static struct dev_pm_domain acpi_general_pm_domain = {
 	.ops = {
-#ifdef CONFIG_PM_RUNTIME
+#ifdef CONFIG_PM
 		.runtime_suspend = acpi_subsys_runtime_suspend,
 		.runtime_resume = acpi_subsys_runtime_resume,
-#endif
 #ifdef CONFIG_PM_SLEEP
 		.prepare = acpi_subsys_prepare,
 		.complete = acpi_subsys_complete,
@@ -1038,6 +1033,7 @@ static struct dev_pm_domain acpi_general
 		.poweroff_late = acpi_subsys_suspend_late,
 		.restore_early = acpi_subsys_resume_early,
 #endif
+#endif
 	},
 };
 
include/linux/acpi.h +11 -15
Index: linux-pm/include/linux/acpi.h
===================================================================
@@ -567,16 +567,26 @@ static inline void arch_reserve_mem_area
 #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
 #endif
 
-#if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
+#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
 int acpi_dev_runtime_suspend(struct device *dev);
 int acpi_dev_runtime_resume(struct device *dev);
 int acpi_subsys_runtime_suspend(struct device *dev);
 int acpi_subsys_runtime_resume(struct device *dev);
+struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
+int acpi_dev_pm_attach(struct device *dev, bool power_on);
 #else
 static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }
 static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }
 static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
 static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
+static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
+{
+	return NULL;
+}
+static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
+{
+	return -ENODEV;
+}
 #endif
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
@@ -599,20 +609,6 @@ static inline int acpi_subsys_suspend(st
 static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
 #endif
 
-#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
-struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
-int acpi_dev_pm_attach(struct device *dev, bool power_on);
-#else
-static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
-{
-	return NULL;
-}
-static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
-{
-	return -ENODEV;
-}
-#endif
-
 #ifdef CONFIG_ACPI
 __printf(3, 4)
 void acpi_handle_printk(const char *level, acpi_handle handle,
#10 lore raw

PATCH 3/4 ACPI / PM: Drop CONFIG_PM_RUNTIME from the ACPI core

From: Rafael J. Wysocki <[email protected]>
Subject: ACPI / PM: Drop CONFIG_PM_RUNTIME from the ACPI core

After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so quite a few #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM.

Replace CONFIG_PM_RUNTIME with CONFIG_PM in the ACPI core code.

---

I missed include/acpi/acpi_bus.h in the previous version.

---
 drivers/acpi/acpi_lpss.c |    4 +---
 drivers/acpi/device_pm.c |    8 ++------
 drivers/acpi/pci_irq.c   |    2 +-
 include/acpi/acpi_bus.h  |    6 +-----
 include/linux/acpi.h     |   26 +++++++++++---------------
 5 files changed, 16 insertions(+), 30 deletions(-)
drivers/acpi/acpi_lpss.c +1 -3
Index: linux-pm/drivers/acpi/acpi_lpss.c
===================================================================
@@ -588,7 +588,6 @@ static int acpi_lpss_resume_early(struct
 }
 #endif /* CONFIG_PM_SLEEP */
 
-#ifdef CONFIG_PM_RUNTIME
 static int acpi_lpss_runtime_suspend(struct device *dev)
 {
 	struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
@@ -631,11 +630,11 @@ static int acpi_lpss_runtime_resume(stru
 
 	return pm_generic_runtime_resume(dev);
 }
-#endif /* CONFIG_PM_RUNTIME */
 #endif /* CONFIG_PM */
 
 static struct dev_pm_domain acpi_lpss_pm_domain = {
 	.ops = {
+#ifdef CONFIG_PM
 #ifdef CONFIG_PM_SLEEP
 		.prepare = acpi_subsys_prepare,
 		.complete = acpi_subsys_complete,
@@ -647,7 +646,6 @@ static struct dev_pm_domain acpi_lpss_pm
 		.poweroff_late = acpi_lpss_suspend_late,
 		.restore_early = acpi_lpss_resume_early,
 #endif
-#ifdef CONFIG_PM_RUNTIME
 		.runtime_suspend = acpi_lpss_runtime_suspend,
 		.runtime_resume = acpi_lpss_runtime_resume,
 #endif
drivers/acpi/pci_irq.c +1 -1
Index: linux-pm/drivers/acpi/pci_irq.c
===================================================================
@@ -484,7 +484,7 @@ void acpi_pci_irq_disable(struct pci_dev
 	/* Keep IOAPIC pin configuration when suspending */
 	if (dev->dev.power.is_prepared)
 		return;
-#ifdef	CONFIG_PM_RUNTIME
+#ifdef	CONFIG_PM
 	if (dev->dev.power.runtime_status == RPM_SUSPENDING)
 		return;
 #endif
drivers/acpi/device_pm.c +2 -6
Index: linux-pm/drivers/acpi/device_pm.c
===================================================================
@@ -692,7 +692,6 @@ static int acpi_device_wakeup(struct acp
 	return 0;
 }
 
-#ifdef CONFIG_PM_RUNTIME
 /**
  * acpi_pm_device_run_wake - Enable/disable remote wakeup for given device.
  * @dev: Device to enable/disable the platform to wake up.
@@ -714,7 +713,6 @@ int acpi_pm_device_run_wake(struct devic
 	return acpi_device_wakeup(adev, ACPI_STATE_S0, enable);
 }
 EXPORT_SYMBOL(acpi_pm_device_run_wake);
-#endif /* CONFIG_PM_RUNTIME */
 
 #ifdef CONFIG_PM_SLEEP
 /**
@@ -773,7 +771,6 @@ static int acpi_dev_pm_full_power(struct
 		acpi_device_set_power(adev, ACPI_STATE_D0) : 0;
 }
 
-#ifdef CONFIG_PM_RUNTIME
 /**
  * acpi_dev_runtime_suspend - Put device into a low-power state using ACPI.
  * @dev: Device to put into a low-power state.
@@ -855,7 +852,6 @@ int acpi_subsys_runtime_resume(struct de
 	return ret ? ret : pm_generic_runtime_resume(dev);
 }
 EXPORT_SYMBOL_GPL(acpi_subsys_runtime_resume);
-#endif /* CONFIG_PM_RUNTIME */
 
 #ifdef CONFIG_PM_SLEEP
 /**
@@ -1023,10 +1019,9 @@ EXPORT_SYMBOL_GPL(acpi_subsys_freeze);
 
 static struct dev_pm_domain acpi_general_pm_domain = {
 	.ops = {
-#ifdef CONFIG_PM_RUNTIME
+#ifdef CONFIG_PM
 		.runtime_suspend = acpi_subsys_runtime_suspend,
 		.runtime_resume = acpi_subsys_runtime_resume,
-#endif
 #ifdef CONFIG_PM_SLEEP
 		.prepare = acpi_subsys_prepare,
 		.complete = acpi_subsys_complete,
@@ -1038,6 +1033,7 @@ static struct dev_pm_domain acpi_general
 		.poweroff_late = acpi_subsys_suspend_late,
 		.restore_early = acpi_subsys_resume_early,
 #endif
+#endif
 	},
 };
 
include/linux/acpi.h +11 -15
Index: linux-pm/include/linux/acpi.h
===================================================================
@@ -567,16 +567,26 @@ static inline void arch_reserve_mem_area
 #define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
 #endif
 
-#if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
+#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
 int acpi_dev_runtime_suspend(struct device *dev);
 int acpi_dev_runtime_resume(struct device *dev);
 int acpi_subsys_runtime_suspend(struct device *dev);
 int acpi_subsys_runtime_resume(struct device *dev);
+struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
+int acpi_dev_pm_attach(struct device *dev, bool power_on);
 #else
 static inline int acpi_dev_runtime_suspend(struct device *dev) { return 0; }
 static inline int acpi_dev_runtime_resume(struct device *dev) { return 0; }
 static inline int acpi_subsys_runtime_suspend(struct device *dev) { return 0; }
 static inline int acpi_subsys_runtime_resume(struct device *dev) { return 0; }
+static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
+{
+	return NULL;
+}
+static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
+{
+	return -ENODEV;
+}
 #endif
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_PM_SLEEP)
@@ -599,20 +609,6 @@ static inline int acpi_subsys_suspend(st
 static inline int acpi_subsys_freeze(struct device *dev) { return 0; }
 #endif
 
-#if defined(CONFIG_ACPI) && defined(CONFIG_PM)
-struct acpi_device *acpi_dev_pm_get_node(struct device *dev);
-int acpi_dev_pm_attach(struct device *dev, bool power_on);
-#else
-static inline struct acpi_device *acpi_dev_pm_get_node(struct device *dev)
-{
-	return NULL;
-}
-static inline int acpi_dev_pm_attach(struct device *dev, bool power_on)
-{
-	return -ENODEV;
-}
-#endif
-
 #ifdef CONFIG_ACPI
 __printf(3, 4)
 void acpi_handle_printk(const char *level, acpi_handle handle,
include/acpi/acpi_bus.h +1 -5
Index: linux-pm/include/acpi/acpi_bus.h
===================================================================
@@ -544,6 +544,7 @@ acpi_status acpi_add_pm_notifier(struct
 				 void (*work_func)(struct work_struct *work));
 acpi_status acpi_remove_pm_notifier(struct acpi_device *adev);
 int acpi_pm_device_sleep_state(struct device *, int *, int);
+int acpi_pm_device_run_wake(struct device *, bool);
 #else
 static inline acpi_status acpi_add_pm_notifier(struct acpi_device *adev,
 					       struct device *dev,
@@ -563,11 +564,6 @@ static inline int acpi_pm_device_sleep_s
 	return (m >= ACPI_STATE_D0 && m <= ACPI_STATE_D3_COLD) ?
 		m : ACPI_STATE_D0;
 }
-#endif
-
-#ifdef CONFIG_PM_RUNTIME
-int acpi_pm_device_run_wake(struct device *, bool);
-#else
 static inline int acpi_pm_device_run_wake(struct device *dev, bool enable)
 {
 	return -ENODEV;
#11 lore raw

PATCH 4/4 PCI / PM: Drop CONFIG_PM_RUNTIME from the PCI core

In reply to Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so quite a few #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM.

Replace CONFIG_PM_RUNTIME with CONFIG_PM in the ACPI core code.

---
 drivers/pci/pci-driver.c |   20 +++++++-------------
 drivers/pci/pci-sysfs.c  |    4 ++--
 drivers/pci/pcie/Kconfig |    2 +-
 3 files changed, 10 insertions(+), 16 deletions(-)
drivers/pci/pcie/Kconfig +1 -1
Index: linux-pm/drivers/pci/pcie/Kconfig
===================================================================
@@ -79,4 +79,4 @@ endchoice
 
 config PCIE_PME
 	def_bool y
-	depends on PCIEPORTBUS && PM_RUNTIME
+	depends on PCIEPORTBUS && PM
drivers/pci/pci-driver.c +7 -13
Index: linux-pm/drivers/pci/pci-driver.c
===================================================================
@@ -1104,7 +1104,7 @@ static int pci_pm_restore(struct device
 
 #endif /* !CONFIG_HIBERNATE_CALLBACKS */
 
-#ifdef CONFIG_PM_RUNTIME
+#ifdef CONFIG_PM
 
 static int pci_pm_runtime_suspend(struct device *dev)
 {
@@ -1200,16 +1200,6 @@ static int pci_pm_runtime_idle(struct de
 	return ret;
 }
 
-#else /* !CONFIG_PM_RUNTIME */
-
-#define pci_pm_runtime_suspend	NULL
-#define pci_pm_runtime_resume	NULL
-#define pci_pm_runtime_idle	NULL
-
-#endif /* !CONFIG_PM_RUNTIME */
-
-#ifdef CONFIG_PM
-
 static const struct dev_pm_ops pci_dev_pm_ops = {
 	.prepare = pci_pm_prepare,
 	.suspend = pci_pm_suspend,
@@ -1231,11 +1221,15 @@ static const struct dev_pm_ops pci_dev_p
 
 #define PCI_PM_OPS_PTR	(&pci_dev_pm_ops)
 
-#else /* !COMFIG_PM_OPS */
+#else /* !CONFIG_PM */
+
+#define pci_pm_runtime_suspend	NULL
+#define pci_pm_runtime_resume	NULL
+#define pci_pm_runtime_idle	NULL
 
 #define PCI_PM_OPS_PTR	NULL
 
-#endif /* !COMFIG_PM_OPS */
+#endif /* !CONFIG_PM */
 
 /**
  * __pci_register_driver - register a new pci driver
drivers/pci/pci-sysfs.c +2 -2
Index: linux-pm/drivers/pci/pci-sysfs.c
===================================================================
@@ -385,7 +385,7 @@ static ssize_t dev_bus_rescan_store(stru
 }
 static DEVICE_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store);
 
-#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
+#if defined(CONFIG_PM) && defined(CONFIG_ACPI)
 static ssize_t d3cold_allowed_store(struct device *dev,
 				    struct device_attribute *attr,
 				    const char *buf, size_t count)
@@ -566,7 +566,7 @@ static struct attribute *pci_dev_attrs[]
 	&dev_attr_enable.attr,
 	&dev_attr_broken_parity_status.attr,
 	&dev_attr_msi_bus.attr,
-#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
+#if defined(CONFIG_PM) && defined(CONFIG_ACPI)
 	&dev_attr_d3cold_allowed.attr,
 #endif
 #ifdef CONFIG_OF
#12 lore raw

PATCH 4/4 PCI / PM: Drop CONFIG_PM_RUNTIME from the PCI core

From: Rafael J. Wysocki <[email protected]>
Subject: PCI / PM: Drop CONFIG_PM_RUNTIME from the PCI core

After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so quite a few #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM.

Replace CONFIG_PM_RUNTIME with CONFIG_PM in the PCI core code.

---

Changelog fixup.

---
 drivers/pci/pci-driver.c |   20 +++++++-------------
 drivers/pci/pci-sysfs.c  |    4 ++--
 drivers/pci/pcie/Kconfig |    2 +-
 3 files changed, 10 insertions(+), 16 deletions(-)
drivers/pci/pcie/Kconfig +1 -1
Index: linux-pm/drivers/pci/pcie/Kconfig
===================================================================
@@ -79,4 +79,4 @@ endchoice
 
 config PCIE_PME
 	def_bool y
-	depends on PCIEPORTBUS && PM_RUNTIME
+	depends on PCIEPORTBUS && PM
drivers/pci/pci-driver.c +7 -13
Index: linux-pm/drivers/pci/pci-driver.c
===================================================================
@@ -1104,7 +1104,7 @@ static int pci_pm_restore(struct device
 
 #endif /* !CONFIG_HIBERNATE_CALLBACKS */
 
-#ifdef CONFIG_PM_RUNTIME
+#ifdef CONFIG_PM
 
 static int pci_pm_runtime_suspend(struct device *dev)
 {
@@ -1200,16 +1200,6 @@ static int pci_pm_runtime_idle(struct de
 	return ret;
 }
 
-#else /* !CONFIG_PM_RUNTIME */
-
-#define pci_pm_runtime_suspend	NULL
-#define pci_pm_runtime_resume	NULL
-#define pci_pm_runtime_idle	NULL
-
-#endif /* !CONFIG_PM_RUNTIME */
-
-#ifdef CONFIG_PM
-
 static const struct dev_pm_ops pci_dev_pm_ops = {
 	.prepare = pci_pm_prepare,
 	.suspend = pci_pm_suspend,
@@ -1231,11 +1221,15 @@ static const struct dev_pm_ops pci_dev_p
 
 #define PCI_PM_OPS_PTR	(&pci_dev_pm_ops)
 
-#else /* !COMFIG_PM_OPS */
+#else /* !CONFIG_PM */
+
+#define pci_pm_runtime_suspend	NULL
+#define pci_pm_runtime_resume	NULL
+#define pci_pm_runtime_idle	NULL
 
 #define PCI_PM_OPS_PTR	NULL
 
-#endif /* !COMFIG_PM_OPS */
+#endif /* !CONFIG_PM */
 
 /**
  * __pci_register_driver - register a new pci driver
drivers/pci/pci-sysfs.c +2 -2
Index: linux-pm/drivers/pci/pci-sysfs.c
===================================================================
@@ -385,7 +385,7 @@ static ssize_t dev_bus_rescan_store(stru
 }
 static DEVICE_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store);
 
-#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
+#if defined(CONFIG_PM) && defined(CONFIG_ACPI)
 static ssize_t d3cold_allowed_store(struct device *dev,
 				    struct device_attribute *attr,
 				    const char *buf, size_t count)
@@ -566,7 +566,7 @@ static struct attribute *pci_dev_attrs[]
 	&dev_attr_enable.attr,
 	&dev_attr_broken_parity_status.attr,
 	&dev_attr_msi_bus.attr,
-#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
+#if defined(CONFIG_PM) && defined(CONFIG_ACPI)
 	&dev_attr_d3cold_allowed.attr,
 #endif
 #ifdef CONFIG_OF
maintainer Acked-by on v1 4/4
#13 lore raw

Re: [Update][PATCH 4/4] PCI / PM: Drop CONFIG_PM_RUNTIME from the PCI core

Quoted 11 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>
Subject: PCI / PM: Drop CONFIG_PM_RUNTIME from the PCI core

After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected) PM_RUNTIME is always set if PM is set, so quite a few #ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to depend on CONFIG_PM.

Replace CONFIG_PM_RUNTIME with CONFIG_PM in the PCI core code.

I acked this on IRC, and I think Rafael plans to merge this via his tree, but for the archives:

Quoted 91 lines

---

Changelog fixup.

---
 drivers/pci/pci-driver.c |   20 +++++++-------------
 drivers/pci/pci-sysfs.c  |    4 ++--
 drivers/pci/pcie/Kconfig |    2 +-
 3 files changed, 10 insertions(+), 16 deletions(-)

Index: linux-pm/drivers/pci/pcie/Kconfig
===================================================================

drivers/pci/pcie/Kconfig +1 -1
@@ -79,4 +79,4 @@ endchoice
 
 config PCIE_PME
        def_bool y
-       depends on PCIEPORTBUS && PM_RUNTIME
+       depends on PCIEPORTBUS && PM

Index: linux-pm/drivers/pci/pci-driver.c
===================================================================

drivers/pci/pci-driver.c +7 -13
@@ -1104,7 +1104,7 @@ static int pci_pm_restore(struct device
 
 #endif /* !CONFIG_HIBERNATE_CALLBACKS */
 
-#ifdef CONFIG_PM_RUNTIME
+#ifdef CONFIG_PM
 
 static int pci_pm_runtime_suspend(struct device *dev)
 {
@@ -1200,16 +1200,6 @@ static int pci_pm_runtime_idle(struct de
        return ret;
 }
 
-#else /* !CONFIG_PM_RUNTIME */
-
-#define pci_pm_runtime_suspend NULL
-#define pci_pm_runtime_resume  NULL
-#define pci_pm_runtime_idle    NULL
-
-#endif /* !CONFIG_PM_RUNTIME */
-
-#ifdef CONFIG_PM
-
 static const struct dev_pm_ops pci_dev_pm_ops = {
        .prepare = pci_pm_prepare,
        .suspend = pci_pm_suspend,
@@ -1231,11 +1221,15 @@ static const struct dev_pm_ops pci_dev_p
 
 #define PCI_PM_OPS_PTR (&pci_dev_pm_ops)
 
-#else /* !COMFIG_PM_OPS */
+#else /* !CONFIG_PM */
+
+#define pci_pm_runtime_suspend NULL
+#define pci_pm_runtime_resume  NULL
+#define pci_pm_runtime_idle    NULL
 
 #define PCI_PM_OPS_PTR NULL
 
-#endif /* !COMFIG_PM_OPS */
+#endif /* !CONFIG_PM */
 
 /**
  * __pci_register_driver - register a new pci driver

Index: linux-pm/drivers/pci/pci-sysfs.c
===================================================================

drivers/pci/pci-sysfs.c +2 -2
@@ -385,7 +385,7 @@ static ssize_t dev_bus_rescan_store(stru
 }
 static DEVICE_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, dev_bus_rescan_store);
 
-#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
+#if defined(CONFIG_PM) && defined(CONFIG_ACPI)
 static ssize_t d3cold_allowed_store(struct device *dev,
                                    struct device_attribute *attr,
                                    const char *buf, size_t count)
@@ -566,7 +566,7 @@ static struct attribute *pci_dev_attrs[]
        &dev_attr_enable.attr,
        &dev_attr_broken_parity_status.attr,
        &dev_attr_msi_bus.attr,
-#if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
+#if defined(CONFIG_PM) && defined(CONFIG_ACPI)
        &dev_attr_d3cold_allowed.attr,
 #endif
 #ifdef CONFIG_OF
#14 lore raw
In reply to Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki

Hi,

After commit b2b49ccbdd54 "PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected" (currently in Linux next) CONFIG_PM_RUNTIME is set whenever CONFIG_PM is set, so CONFIG_PM can be used in #ifdefs instead of CONFIG_PM_RUNTIME which simplifies things in quite a few cases.

For this reason, the following patches modify some core code to use CONFIG_PM instead of CONFIG_PM_RUNTIME.

Quoted 7 lines

[1/4] Drop a macro which is redundant after the above commit. [2/4] Use PM instead of PM_RUNTIME in the core device PM code. [3/4] Use PM instead of PM_RUNTIME in the ACPI core. [4/4] Use PM instead of PM_RUNTIME in the PCI core.

They build for me for all of the relevant combinations of options (on x86), but more testing (on the other architectures) would be welcome.

I really like the looks of this patchset!

Noticed that you have applied it for your bleeding edge branch, I suppose that means you will get some "free" testing in linux-next?

Anyway, I have tested it for ux500 (including the genpd support for it, available in linux-next). It works nicely!

I have also tested the two Kconfig options; CONFIG_PM_SLEEP (which selects CONFIG_PM_RUNTIME) and for CONFIG_PM_RUNTIME (with CONFIG_PM_SLEEP unset).

That brings me to a raise a question; why do we need to keep these two configurations options? Couldn't we also have CONFIG_PM_RUNTIME to select CONFIG_PM_SLEEP, that will further simplify things?

Kind regards
Uffe

#15 lore raw
Quoted 27 lines · Ulf Hansson
Quoted 10 lines · Rafael J. Wysocki

Hi,

After commit b2b49ccbdd54 "PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected" (currently in Linux next) CONFIG_PM_RUNTIME is set whenever CONFIG_PM is set, so CONFIG_PM can be used in #ifdefs instead of CONFIG_PM_RUNTIME which simplifies things in quite a few cases.

For this reason, the following patches modify some core code to use CONFIG_PM instead of CONFIG_PM_RUNTIME.

Quoted 7 lines

[1/4] Drop a macro which is redundant after the above commit. [2/4] Use PM instead of PM_RUNTIME in the core device PM code. [3/4] Use PM instead of PM_RUNTIME in the ACPI core. [4/4] Use PM instead of PM_RUNTIME in the PCI core.

They build for me for all of the relevant combinations of options (on x86), but more testing (on the other architectures) would be welcome.

I really like the looks of this patchset!

Noticed that you have applied it for your bleeding edge branch, I suppose that means you will get some "free" testing in linux-next?

Anyway, I have tested it for ux500 (including the genpd support for it, available in linux-next). It works nicely!

Quoted 8 lines

I have also tested the two Kconfig options; CONFIG_PM_SLEEP (which selects CONFIG_PM_RUNTIME) and for CONFIG_PM_RUNTIME (with CONFIG_PM_SLEEP unset).

That brings me to a raise a question; why do we need to keep these two configurations options? Couldn't we also have CONFIG_PM_RUNTIME to select CONFIG_PM_SLEEP, that will further simplify things?

I had look at it. Do you think the below approach could work?

I guess the questions is if there are some configurations that use CONFIG_PM_RUNTIME but not CONFIG_PM_SLEEP. And if so, should we care?

kernel/power/Kconfig +3 -13
index 6e7708c..425f83a 100644
@@ -94,7 +94,6 @@ config PM_STD_PARTITION
 config PM_SLEEP
        def_bool y
        depends on SUSPEND || HIBERNATE_CALLBACKS
-       select PM_RUNTIME
 
 config PM_SLEEP_SMP
        def_bool y
@@ -131,21 +130,12 @@ config PM_WAKELOCKS_GC
        default y
 
 config PM_RUNTIME
-       bool "Run-time PM core functionality"
-       ---help---
-         Enable functionality allowing I/O devices to be put into energy-saving
-         (low power) states at run time (or autosuspended) after a specified
-         period of inactivity and woken up in response to a hardware-generated
-         wake-up event or a driver's request.
-
-         Hardware support is generally required for this functionality to work
-         and the bus type drivers of the buses the devices are on are
-         responsible for the actual handling of the autosuspend requests and
-         wake-up events.
+       def_bool y
+       depends on PM_SLEEP
 
 config PM
        def_bool y
-       depends on PM_SLEEP || PM_RUNTIME
+       depends on PM_SLEEP
 
 

Kind regards
Uffe

#16 lore raw
In reply to Ulf Hansson
Quoted 27 lines · Ulf Hansson
Quoted 10 lines · Rafael J. Wysocki

Hi,

After commit b2b49ccbdd54 "PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected" (currently in Linux next) CONFIG_PM_RUNTIME is set whenever CONFIG_PM is set, so CONFIG_PM can be used in #ifdefs instead of CONFIG_PM_RUNTIME which simplifies things in quite a few cases.

For this reason, the following patches modify some core code to use CONFIG_PM instead of CONFIG_PM_RUNTIME.

Quoted 7 lines

[1/4] Drop a macro which is redundant after the above commit. [2/4] Use PM instead of PM_RUNTIME in the core device PM code. [3/4] Use PM instead of PM_RUNTIME in the ACPI core. [4/4] Use PM instead of PM_RUNTIME in the PCI core.

They build for me for all of the relevant combinations of options (on x86), but more testing (on the other architectures) would be welcome.

I really like the looks of this patchset!

Noticed that you have applied it for your bleeding edge branch, I suppose that means you will get some "free" testing in linux-next?

Anyway, I have tested it for ux500 (including the genpd support for it, available in linux-next). It works nicely!

Quoted 7 lines

I have also tested the two Kconfig options; CONFIG_PM_SLEEP (which selects CONFIG_PM_RUNTIME) and for CONFIG_PM_RUNTIME (with CONFIG_PM_SLEEP unset).

That brings me to a raise a question; why do we need to keep these two configurations options? Couldn't we also have CONFIG_PM_RUNTIME to select CONFIG_PM_SLEEP, that will further simplify things?

My plan is different. I'm going to eliminate PM_RUNTIME from the code and then replace it with PM as a selectable option. Then, PM_SLEEP will select PM (directly) and PM_RUNTIME can be entirely dropped.

So in the end we'll have one Kconfig option less, which is a win IMO.

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#17 lore raw

Hi Rafael,

Quoted 11 lines · Rafael J. Wysocki
Quoted 7 lines

I have also tested the two Kconfig options; CONFIG_PM_SLEEP (which selects CONFIG_PM_RUNTIME) and for CONFIG_PM_RUNTIME (with CONFIG_PM_SLEEP unset).

That brings me to a raise a question; why do we need to keep these two configurations options? Couldn't we also have CONFIG_PM_RUNTIME to select CONFIG_PM_SLEEP, that will further simplify things?

My plan is different. I'm going to eliminate PM_RUNTIME from the code and then replace it with PM as a selectable option. Then, PM_SLEEP will select PM (directly) and PM_RUNTIME can be entirely dropped.

What's your rationale for keeping PM_SLEEP, and not consolidating both PM_RUNTIME and PM_SLEEP into PM? I.e. what am I missing, still considering myself a PM newbie?

Quoted 1 line

So in the end we'll have one Kconfig option less, which is a win IMO.

Having two less may be a bigger win ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#18 lore raw
Quoted 15 lines · Geert Uytterhoeven

Hi Rafael,

Quoted 11 lines · Rafael J. Wysocki
Quoted 7 lines

I have also tested the two Kconfig options; CONFIG_PM_SLEEP (which selects CONFIG_PM_RUNTIME) and for CONFIG_PM_RUNTIME (with CONFIG_PM_SLEEP unset).

That brings me to a raise a question; why do we need to keep these two configurations options? Couldn't we also have CONFIG_PM_RUNTIME to select CONFIG_PM_SLEEP, that will further simplify things?

My plan is different. I'm going to eliminate PM_RUNTIME from the code and then replace it with PM as a selectable option. Then, PM_SLEEP will select PM (directly) and PM_RUNTIME can be entirely dropped.

Quoted 7 lines

What's your rationale for keeping PM_SLEEP, and not consolidating both PM_RUNTIME and PM_SLEEP into PM? I.e. what am I missing, still considering myself a PM newbie?

Quoted 1 line

So in the end we'll have one Kconfig option less, which is a win IMO.

Having two less may be a bigger win ;-)

I imagine that Rafael would like to continue supporting platforms that want to have runtime power management but not suspend or hibernation. A number of embedded systems might fall into this category.

Alan Stern

#19 lore raw
Quoted 21 lines · Alan Stern
Quoted 19 lines · Geert Uytterhoeven

Hi Rafael,

Quoted 11 lines · Rafael J. Wysocki
Quoted 7 lines

I have also tested the two Kconfig options; CONFIG_PM_SLEEP (which selects CONFIG_PM_RUNTIME) and for CONFIG_PM_RUNTIME (with CONFIG_PM_SLEEP unset).

That brings me to a raise a question; why do we need to keep these two configurations options? Couldn't we also have CONFIG_PM_RUNTIME to select CONFIG_PM_SLEEP, that will further simplify things?

My plan is different. I'm going to eliminate PM_RUNTIME from the code and then replace it with PM as a selectable option. Then, PM_SLEEP will select PM (directly) and PM_RUNTIME can be entirely dropped.

What's your rationale for keeping PM_SLEEP, and not consolidating both PM_RUNTIME and PM_SLEEP into PM? I.e. what am I missing, still considering myself a PM newbie?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

So in the end we'll have one Kconfig option less, which is a win IMO.

Having two less may be a bigger win ;-)

I imagine that Rafael would like to continue supporting platforms that want to have runtime power management but not suspend or hibernation. A number of embedded systems might fall into this category.

Right.

That said whether or not it is ever useful to set PM_RUNTIME alone is a good question. In my opinion it is useful today, at least on some platforms that don't really support system suspend or hibernation in any form. However, it may not be the case any more when suspend-to-idle becomes mature enough, because that should just work for any platform without any kind of special support. We're still missing some timekeeping bits there, but once that gap has been covered, we may just eliminate PM_SLEEP as well if there's a broad consensus on that.

Rafael

#20 lore raw

[...]

Quoted 8 lines

That said whether or not it is ever useful to set PM_RUNTIME alone is a good question. In my opinion it is useful today, at least on some platforms that don't really support system suspend or hibernation in any form. However, it may not be the case any more when suspend-to-idle becomes mature enough, because that should just work for any platform without any kind of special support. We're still missing some timekeeping bits there, but once that gap has been covered, we may just eliminate PM_SLEEP as well if there's a broad consensus on that.

That's sounds like a good approach, thanks for sharing your ideas and plans.

Feel free to add my reviewed-by tag to this patchset as well.

Kind regards
Uffe

#21 lore raw
Quoted 11 lines · Ulf Hansson

[...]

Quoted 8 lines

That said whether or not it is ever useful to set PM_RUNTIME alone is a good question. In my opinion it is useful today, at least on some platforms that don't really support system suspend or hibernation in any form. However, it may not be the case any more when suspend-to-idle becomes mature enough, because that should just work for any platform without any kind of special support. We're still missing some timekeeping bits there, but once that gap has been covered, we may just eliminate PM_SLEEP as well if there's a broad consensus on that.

Quoted 3 lines

That's sounds like a good approach, thanks for sharing your ideas and plans.

Feel free to add my reviewed-by tag to this patchset as well.

I'll do that, thanks!

Acked-by on the v1 series
#22 lore raw
In reply to Rafael J. Wysocki
Quoted 10 lines · Rafael J. Wysocki

Hi,

After commit b2b49ccbdd54 "PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is selected" (currently in Linux next) CONFIG_PM_RUNTIME is set whenever CONFIG_PM is set, so CONFIG_PM can be used in #ifdefs instead of CONFIG_PM_RUNTIME which simplifies things in quite a few cases.

For this reason, the following patches modify some core code to use CONFIG_PM instead of CONFIG_PM_RUNTIME.

Quoted 7 lines

[1/4] Drop a macro which is redundant after the above commit. [2/4] Use PM instead of PM_RUNTIME in the core device PM code. [3/4] Use PM instead of PM_RUNTIME in the ACPI core. [4/4] Use PM instead of PM_RUNTIME in the PCI core.

They build for me for all of the relevant combinations of options (on x86), but more testing (on the other architectures) would be welcome.

I gave this a quick boot test on all the OMAP boards I have, and it's booting fine. As soon as this hits linux-next, it will be boot tested on a pile of different ARM platforms, and will let you know what happens.

Kevin