Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/rafael/suspend-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6: (23 commits)
  at_hdmac: Rework suspend_late()/resume_early()
  PM: Reset transition_started at dpm_resume_noirq
  PM: Update kerneldoc comments in drivers/base/power/main.c
  PM: Add convenience macro to make switching to dev_pm_ops less error-prone
  hp-wmi: Switch driver to dev_pm_ops
  floppy: Switch driver to dev_pm_ops
  PM: Trivial fixes
  PM / Hibernate / Memory hotplug: Always use for_each_populated_zone()
  PM/Hibernate: Do not try to allocate too much memory too hard (rev. 2)
  PM/Hibernate: Do not release preallocated memory unnecessarily (rev. 2)
  PM/Hibernate: Rework shrinking of memory
  PM: Fix typo in label name s/Platofrm_finish/Platform_finish/
  PM: Run-time PM platform device bus support
  PM: Introduce core framework for run-time PM of I/O devices (rev. 17)
  Driver Core: Make PM operations a const pointer
  PM: Remove platform device suspend_late()/resume_early() V2
  USB: Rework musb suspend()/resume_early()
  I2C: Rework i2c-s3c2410 suspend_late()/resume() V2
  I2C: Rework i2c-pxa suspend_late()/resume_early()
  DMA: Rework txx9dmac suspend_late()/resume_early()
  ...

Fix trivial conflict in drivers/base/platform.c (due to same
constification patch being merged in both sides, along with some other
PM work in the PM branch)
  • Loading branch information
Linus Torvalds committed Sep 15, 2009
2 parents c91d7d5 + 33f82d1 commit f86054c
Show file tree
Hide file tree
Showing 32 changed files with 2,287 additions and 305 deletions.
378 changes: 378 additions & 0 deletions Documentation/power/runtime_pm.txt

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions arch/arm/include/asm/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ struct dev_archdata {
#endif
};

struct pdev_archdata {
};

#endif
11 changes: 7 additions & 4 deletions arch/arm/plat-omap/debug-leds.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,24 +281,27 @@ static int /* __init */ fpga_probe(struct platform_device *pdev)
return 0;
}

static int fpga_suspend_late(struct platform_device *pdev, pm_message_t mesg)
static int fpga_suspend_noirq(struct device *dev)
{
__raw_writew(~0, &fpga->leds);
return 0;
}

static int fpga_resume_early(struct platform_device *pdev)
static int fpga_resume_noirq(struct device *dev)
{
__raw_writew(~hw_led_state, &fpga->leds);
return 0;
}

static struct dev_pm_ops fpga_dev_pm_ops = {
.suspend_noirq = fpga_suspend_noirq,
.resume_noirq = fpga_resume_noirq,
};

static struct platform_driver led_driver = {
.driver.name = "omap_dbg_led",
.driver.pm = &fpga_dev_pm_ops,
.probe = fpga_probe,
.suspend_late = fpga_suspend_late,
.resume_early = fpga_resume_early,
};

static int __init fpga_init(void)
Expand Down
14 changes: 10 additions & 4 deletions arch/arm/plat-omap/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1418,8 +1418,9 @@ static struct irq_chip mpuio_irq_chip = {

#include <linux/platform_device.h>

static int omap_mpuio_suspend_late(struct platform_device *pdev, pm_message_t mesg)
static int omap_mpuio_suspend_noirq(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct gpio_bank *bank = platform_get_drvdata(pdev);
void __iomem *mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT;
unsigned long flags;
Expand All @@ -1432,8 +1433,9 @@ static int omap_mpuio_suspend_late(struct platform_device *pdev, pm_message_t me
return 0;
}

static int omap_mpuio_resume_early(struct platform_device *pdev)
static int omap_mpuio_resume_noirq(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct gpio_bank *bank = platform_get_drvdata(pdev);
void __iomem *mask_reg = bank->base + OMAP_MPUIO_GPIO_MASKIT;
unsigned long flags;
Expand All @@ -1445,14 +1447,18 @@ static int omap_mpuio_resume_early(struct platform_device *pdev)
return 0;
}

static struct dev_pm_ops omap_mpuio_dev_pm_ops = {
.suspend_noirq = omap_mpuio_suspend_noirq,
.resume_noirq = omap_mpuio_resume_noirq,
};

/* use platform_driver for this, now that there's no longer any
* point to sys_device (other than not disturbing old code).
*/
static struct platform_driver omap_mpuio_driver = {
.suspend_late = omap_mpuio_suspend_late,
.resume_early = omap_mpuio_resume_early,
.driver = {
.name = "mpuio",
.pm = &omap_mpuio_dev_pm_ops,
},
};

Expand Down
3 changes: 3 additions & 0 deletions arch/ia64/include/asm/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ struct dev_archdata {
#endif
};

struct pdev_archdata {
};

#endif /* _ASM_IA64_DEVICE_H */
3 changes: 3 additions & 0 deletions arch/microblaze/include/asm/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ struct dev_archdata {
struct device_node *of_node;
};

struct pdev_archdata {
};

#endif /* _ASM_MICROBLAZE_DEVICE_H */


3 changes: 3 additions & 0 deletions arch/powerpc/include/asm/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@ dev_archdata_get_node(const struct dev_archdata *ad)
return ad->of_node;
}

struct pdev_archdata {
};

#endif /* _ASM_POWERPC_DEVICE_H */
3 changes: 3 additions & 0 deletions arch/sparc/include/asm/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,7 @@ dev_archdata_get_node(const struct dev_archdata *ad)
return ad->prom_node;
}

struct pdev_archdata {
};

#endif /* _ASM_SPARC_DEVICE_H */
3 changes: 3 additions & 0 deletions arch/x86/include/asm/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ struct dma_map_ops *dma_ops;
#endif
};

struct pdev_archdata {
};

#endif /* _ASM_X86_DEVICE_H */
11 changes: 11 additions & 0 deletions drivers/base/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/kthread.h>
#include <linux/wait.h>
#include <linux/async.h>
#include <linux/pm_runtime.h>

#include "base.h"
#include "power/power.h"
Expand Down Expand Up @@ -202,7 +203,10 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
pr_debug("bus: '%s': %s: matched device %s with driver %s\n",
drv->bus->name, __func__, dev_name(dev), drv->name);

pm_runtime_get_noresume(dev);
pm_runtime_barrier(dev);
ret = really_probe(dev, drv);
pm_runtime_put_sync(dev);

return ret;
}
Expand Down Expand Up @@ -245,7 +249,9 @@ int device_attach(struct device *dev)
ret = 0;
}
} else {
pm_runtime_get_noresume(dev);
ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
pm_runtime_put_sync(dev);
}
up(&dev->sem);
return ret;
Expand Down Expand Up @@ -306,6 +312,9 @@ static void __device_release_driver(struct device *dev)

drv = dev->driver;
if (drv) {
pm_runtime_get_noresume(dev);
pm_runtime_barrier(dev);

driver_sysfs_remove(dev);

if (dev->bus)
Expand All @@ -324,6 +333,8 @@ static void __device_release_driver(struct device *dev)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_UNBOUND_DRIVER,
dev);

pm_runtime_put_sync(dev);
}
}

Expand Down
82 changes: 37 additions & 45 deletions drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <linux/bootmem.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/pm_runtime.h>

#include "base.h"

Expand Down Expand Up @@ -625,30 +626,6 @@ static int platform_legacy_suspend(struct device *dev, pm_message_t mesg)
return ret;
}

static int platform_legacy_suspend_late(struct device *dev, pm_message_t mesg)
{
struct platform_driver *pdrv = to_platform_driver(dev->driver);
struct platform_device *pdev = to_platform_device(dev);
int ret = 0;

if (dev->driver && pdrv->suspend_late)
ret = pdrv->suspend_late(pdev, mesg);

return ret;
}

static int platform_legacy_resume_early(struct device *dev)
{
struct platform_driver *pdrv = to_platform_driver(dev->driver);
struct platform_device *pdev = to_platform_device(dev);
int ret = 0;

if (dev->driver && pdrv->resume_early)
ret = pdrv->resume_early(pdev);

return ret;
}

static int platform_legacy_resume(struct device *dev)
{
struct platform_driver *pdrv = to_platform_driver(dev->driver);
Expand Down Expand Up @@ -680,6 +657,13 @@ static void platform_pm_complete(struct device *dev)
drv->pm->complete(dev);
}

#else /* !CONFIG_PM_SLEEP */

#define platform_pm_prepare NULL
#define platform_pm_complete NULL

#endif /* !CONFIG_PM_SLEEP */

#ifdef CONFIG_SUSPEND

static int platform_pm_suspend(struct device *dev)
Expand Down Expand Up @@ -711,8 +695,6 @@ static int platform_pm_suspend_noirq(struct device *dev)
if (drv->pm) {
if (drv->pm->suspend_noirq)
ret = drv->pm->suspend_noirq(dev);
} else {
ret = platform_legacy_suspend_late(dev, PMSG_SUSPEND);
}

return ret;
Expand Down Expand Up @@ -747,8 +729,6 @@ static int platform_pm_resume_noirq(struct device *dev)
if (drv->pm) {
if (drv->pm->resume_noirq)
ret = drv->pm->resume_noirq(dev);
} else {
ret = platform_legacy_resume_early(dev);
}

return ret;
Expand Down Expand Up @@ -794,8 +774,6 @@ static int platform_pm_freeze_noirq(struct device *dev)
if (drv->pm) {
if (drv->pm->freeze_noirq)
ret = drv->pm->freeze_noirq(dev);
} else {
ret = platform_legacy_suspend_late(dev, PMSG_FREEZE);
}

return ret;
Expand Down Expand Up @@ -830,8 +808,6 @@ static int platform_pm_thaw_noirq(struct device *dev)
if (drv->pm) {
if (drv->pm->thaw_noirq)
ret = drv->pm->thaw_noirq(dev);
} else {
ret = platform_legacy_resume_early(dev);
}

return ret;
Expand Down Expand Up @@ -866,8 +842,6 @@ static int platform_pm_poweroff_noirq(struct device *dev)
if (drv->pm) {
if (drv->pm->poweroff_noirq)
ret = drv->pm->poweroff_noirq(dev);
} else {
ret = platform_legacy_suspend_late(dev, PMSG_HIBERNATE);
}

return ret;
Expand Down Expand Up @@ -902,8 +876,6 @@ static int platform_pm_restore_noirq(struct device *dev)
if (drv->pm) {
if (drv->pm->restore_noirq)
ret = drv->pm->restore_noirq(dev);
} else {
ret = platform_legacy_resume_early(dev);
}

return ret;
Expand All @@ -922,6 +894,31 @@ static int platform_pm_restore_noirq(struct device *dev)

#endif /* !CONFIG_HIBERNATION */

#ifdef CONFIG_PM_RUNTIME

int __weak platform_pm_runtime_suspend(struct device *dev)
{
return -ENOSYS;
};

int __weak platform_pm_runtime_resume(struct device *dev)
{
return -ENOSYS;
};

int __weak platform_pm_runtime_idle(struct device *dev)
{
return -ENOSYS;
};

#else /* !CONFIG_PM_RUNTIME */

#define platform_pm_runtime_suspend NULL
#define platform_pm_runtime_resume NULL
#define platform_pm_runtime_idle NULL

#endif /* !CONFIG_PM_RUNTIME */

static const struct dev_pm_ops platform_dev_pm_ops = {
.prepare = platform_pm_prepare,
.complete = platform_pm_complete,
Expand All @@ -937,22 +934,17 @@ static const struct dev_pm_ops platform_dev_pm_ops = {
.thaw_noirq = platform_pm_thaw_noirq,
.poweroff_noirq = platform_pm_poweroff_noirq,
.restore_noirq = platform_pm_restore_noirq,
.runtime_suspend = platform_pm_runtime_suspend,
.runtime_resume = platform_pm_runtime_resume,
.runtime_idle = platform_pm_runtime_idle,
};

#define PLATFORM_PM_OPS_PTR (&platform_dev_pm_ops)

#else /* !CONFIG_PM_SLEEP */

#define PLATFORM_PM_OPS_PTR NULL

#endif /* !CONFIG_PM_SLEEP */

struct bus_type platform_bus_type = {
.name = "platform",
.dev_attrs = platform_dev_attrs,
.match = platform_match,
.uevent = platform_uevent,
.pm = PLATFORM_PM_OPS_PTR,
.pm = &platform_dev_pm_ops,
};
EXPORT_SYMBOL_GPL(platform_bus_type);

Expand Down
1 change: 1 addition & 0 deletions drivers/base/power/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
obj-$(CONFIG_PM) += sysfs.o
obj-$(CONFIG_PM_SLEEP) += main.o
obj-$(CONFIG_PM_RUNTIME) += runtime.o
obj-$(CONFIG_PM_TRACE_RTC) += trace.o

ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
Expand Down
Loading

0 comments on commit f86054c

Please sign in to comment.