Skip to content

Commit

Permalink
Revert "FROMLIST: PM / sleep: Go direct_complete if driver has no cal…
Browse files Browse the repository at this point in the history
…lbacks"

This reverts commit f3e3ccd.

There is a recursive spinlock bug introduced in this change, so revert until
it's fixed upstream.

BUG=chrome-os-partner:46894
TEST=boot oak

Change-Id: I2a7e9bf278bd37919176c09631b8560d08630a95
Signed-off-by: Derek Basehore <dbasehore@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/308997
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
  • Loading branch information
Derek Basehore authored and chrome-bot committed Oct 27, 2015
1 parent 4bab74b commit 7b17ca9
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 47 deletions.
3 changes: 0 additions & 3 deletions drivers/base/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ static void driver_bound(struct device *dev)

klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);

device_pm_check_callbacks(dev);

/*
* Make sure the device is no longer in one of the deferred lists and
* kick off retrying all pending devices
Expand Down Expand Up @@ -659,7 +657,6 @@ static void __device_release_driver(struct device *dev)
dev->driver = NULL;
dev_set_drvdata(dev, NULL);
klist_remove(&dev->p->knode_driver);
device_pm_check_callbacks(dev);
if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_UNBOUND_DRIVER,
Expand Down
3 changes: 0 additions & 3 deletions drivers/base/power/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <linux/acpi.h>
#include <linux/pm_domain.h>

#include "power.h"

/**
* dev_pm_get_subsys_data - Create or refcount power.subsys_data for device.
* @dev: Device to handle.
Expand Down Expand Up @@ -155,6 +153,5 @@ void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd)
WARN(device_is_bound(dev),
"PM domains can only be changed for unbound devices\n");
dev->pm_domain = pd;
device_pm_check_callbacks(dev);
}
EXPORT_SYMBOL_GPL(dev_pm_domain_set);
2 changes: 0 additions & 2 deletions drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <linux/suspend.h>
#include <linux/export.h>

#include "power.h"

#define GENPD_DEV_CALLBACK(genpd, type, callback, dev) \
({ \
type (*__routine)(struct device *__d); \
Expand Down
35 changes: 0 additions & 35 deletions drivers/base/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ void device_pm_add(struct device *dev)
{
pr_debug("PM: Adding info for %s:%s\n",
dev->bus ? dev->bus->name : "No Bus", dev_name(dev));
device_pm_check_callbacks(dev);
mutex_lock(&dpm_list_mtx);
if (dev->parent && dev->parent->power.is_prepared)
dev_warn(dev, "parent %s should not be sleeping\n",
Expand All @@ -149,7 +148,6 @@ void device_pm_remove(struct device *dev)
mutex_unlock(&dpm_list_mtx);
device_wakeup_disable(dev);
pm_runtime_remove(dev);
device_pm_check_callbacks(dev);
}

/**
Expand Down Expand Up @@ -1566,11 +1564,6 @@ static int device_prepare(struct device *dev, pm_message_t state)

dev->power.wakeup_path = device_may_wakeup(dev);

if (dev->power.no_pm_callbacks) {
ret = 1; /* Let device go direct_complete */
goto unlock;
}

if (dev->pm_domain) {
info = "preparing power domain ";
callback = dev->pm_domain->ops.prepare;
Expand All @@ -1596,7 +1589,6 @@ static int device_prepare(struct device *dev, pm_message_t state)
trace_device_pm_callback_end(dev, ret);
}

unlock:
device_unlock(dev);

if (ret < 0) {
Expand Down Expand Up @@ -1723,30 +1715,3 @@ void dpm_for_each_dev(void *data, void (*fn)(struct device *, void *))
device_pm_unlock();
}
EXPORT_SYMBOL_GPL(dpm_for_each_dev);

static bool pm_ops_is_empty(const struct dev_pm_ops *ops)
{
if (!ops)
return true;

return !ops->prepare &&
!ops->suspend &&
!ops->suspend_late &&
!ops->suspend_noirq &&
!ops->resume_noirq &&
!ops->resume_early &&
!ops->resume &&
!ops->complete;
}

void device_pm_check_callbacks(struct device *dev)
{
spin_lock_irq(&dev->power.lock);
dev->power.no_pm_callbacks =
(!dev->bus || pm_ops_is_empty(dev->bus->pm)) &&
(!dev->class || pm_ops_is_empty(dev->class->pm)) &&
(!dev->type || pm_ops_is_empty(dev->type->pm)) &&
(!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) &&
(!dev->driver || pm_ops_is_empty(dev->driver->pm));
spin_unlock_irq(&dev->power.lock);
}
3 changes: 0 additions & 3 deletions drivers/base/power/power.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ extern void device_pm_remove(struct device *);
extern void device_pm_move_before(struct device *, struct device *);
extern void device_pm_move_after(struct device *, struct device *);
extern void device_pm_move_last(struct device *);
extern void device_pm_check_callbacks(struct device *dev);

#else /* !CONFIG_PM_SLEEP */

Expand All @@ -70,8 +69,6 @@ static inline void device_pm_move_after(struct device *deva,
struct device *devb) {}
static inline void device_pm_move_last(struct device *dev) {}

static inline void device_pm_check_callbacks(struct device *dev) {}

#endif /* !CONFIG_PM_SLEEP */

static inline void device_pm_init(struct device *dev)
Expand Down
1 change: 0 additions & 1 deletion include/linux/pm.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,6 @@ struct dev_pm_info {
enum wakeup_type wakeup_source_type;
bool wakeup_path:1;
bool syscore:1;
bool no_pm_callbacks:1; /* Owned by the PM core */
bool use_dark_resume:1;
#else
unsigned int should_wakeup:1;
Expand Down

0 comments on commit 7b17ca9

Please sign in to comment.